mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-17 20:54:10 +00:00
asm-generic/hyperv: provide cpumask_to_vpset_noself
This is a new variant which removes `self' cpu from the vpset. It will be used in Hyper-V enlightened IPI code. Signed-off-by: Wei Liu <wei.liu@kernel.org> Reviewed-by: Michael Kelley <mikelley@microsoft.com> Link: https://lore.kernel.org/r/20210910185714.299411-2-wei.liu@kernel.org
This commit is contained in:
parent
f1940d4e9c
commit
7ad9bb9d0f
1 changed files with 19 additions and 2 deletions
|
@ -184,10 +184,12 @@ static inline int hv_cpu_number_to_vp_number(int cpu_number)
|
||||||
return hv_vp_index[cpu_number];
|
return hv_vp_index[cpu_number];
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int cpumask_to_vpset(struct hv_vpset *vpset,
|
static inline int __cpumask_to_vpset(struct hv_vpset *vpset,
|
||||||
const struct cpumask *cpus)
|
const struct cpumask *cpus,
|
||||||
|
bool exclude_self)
|
||||||
{
|
{
|
||||||
int cpu, vcpu, vcpu_bank, vcpu_offset, nr_bank = 1;
|
int cpu, vcpu, vcpu_bank, vcpu_offset, nr_bank = 1;
|
||||||
|
int this_cpu = smp_processor_id();
|
||||||
|
|
||||||
/* valid_bank_mask can represent up to 64 banks */
|
/* valid_bank_mask can represent up to 64 banks */
|
||||||
if (hv_max_vp_index / 64 >= 64)
|
if (hv_max_vp_index / 64 >= 64)
|
||||||
|
@ -205,6 +207,8 @@ static inline int cpumask_to_vpset(struct hv_vpset *vpset,
|
||||||
* Some banks may end up being empty but this is acceptable.
|
* Some banks may end up being empty but this is acceptable.
|
||||||
*/
|
*/
|
||||||
for_each_cpu(cpu, cpus) {
|
for_each_cpu(cpu, cpus) {
|
||||||
|
if (exclude_self && cpu == this_cpu)
|
||||||
|
continue;
|
||||||
vcpu = hv_cpu_number_to_vp_number(cpu);
|
vcpu = hv_cpu_number_to_vp_number(cpu);
|
||||||
if (vcpu == VP_INVAL)
|
if (vcpu == VP_INVAL)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -219,6 +223,19 @@ static inline int cpumask_to_vpset(struct hv_vpset *vpset,
|
||||||
return nr_bank;
|
return nr_bank;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int cpumask_to_vpset(struct hv_vpset *vpset,
|
||||||
|
const struct cpumask *cpus)
|
||||||
|
{
|
||||||
|
return __cpumask_to_vpset(vpset, cpus, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int cpumask_to_vpset_noself(struct hv_vpset *vpset,
|
||||||
|
const struct cpumask *cpus)
|
||||||
|
{
|
||||||
|
WARN_ON_ONCE(preemptible());
|
||||||
|
return __cpumask_to_vpset(vpset, cpus, true);
|
||||||
|
}
|
||||||
|
|
||||||
void hyperv_report_panic(struct pt_regs *regs, long err, bool in_die);
|
void hyperv_report_panic(struct pt_regs *regs, long err, bool in_die);
|
||||||
bool hv_is_hyperv_initialized(void);
|
bool hv_is_hyperv_initialized(void);
|
||||||
bool hv_is_hibernation_supported(void);
|
bool hv_is_hibernation_supported(void);
|
||||||
|
|
Loading…
Add table
Reference in a new issue