x86/hyperv: implement and use hv_smp_prepare_cpus
Microsoft Hypervisor requires the root partition to make a few hypercalls to setup application processors before they can be used. Signed-off-by: Lillian Grassin-Drake <ligrassi@microsoft.com> Signed-off-by: Sunil Muthuswamy <sunilmut@microsoft.com> Co-Developed-by: Lillian Grassin-Drake <ligrassi@microsoft.com> Co-Developed-by: Sunil Muthuswamy <sunilmut@microsoft.com> Signed-off-by: Wei Liu <wei.liu@kernel.org> Reviewed-by: Michael Kelley <mikelley@microsoft.com> Link: https://lore.kernel.org/r/20210203150435.27941-11-wei.liu@kernel.org
This commit is contained in:
parent
86b5ec3552
commit
333abaf5ab
@ -31,6 +31,7 @@
|
|||||||
#include <asm/reboot.h>
|
#include <asm/reboot.h>
|
||||||
#include <asm/nmi.h>
|
#include <asm/nmi.h>
|
||||||
#include <clocksource/hyperv_timer.h>
|
#include <clocksource/hyperv_timer.h>
|
||||||
|
#include <asm/numa.h>
|
||||||
|
|
||||||
/* Is Linux running as the root partition? */
|
/* Is Linux running as the root partition? */
|
||||||
bool hv_root_partition;
|
bool hv_root_partition;
|
||||||
@ -230,6 +231,32 @@ static void __init hv_smp_prepare_boot_cpu(void)
|
|||||||
hv_init_spinlocks();
|
hv_init_spinlocks();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void __init hv_smp_prepare_cpus(unsigned int max_cpus)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_X86_64
|
||||||
|
int i;
|
||||||
|
int ret;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
native_smp_prepare_cpus(max_cpus);
|
||||||
|
|
||||||
|
#ifdef CONFIG_X86_64
|
||||||
|
for_each_present_cpu(i) {
|
||||||
|
if (i == 0)
|
||||||
|
continue;
|
||||||
|
ret = hv_call_add_logical_proc(numa_cpu_node(i), i, cpu_physical_id(i));
|
||||||
|
BUG_ON(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
for_each_present_cpu(i) {
|
||||||
|
if (i == 0)
|
||||||
|
continue;
|
||||||
|
ret = hv_call_create_vp(numa_cpu_node(i), hv_current_partition_id, i, i);
|
||||||
|
BUG_ON(ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void __init ms_hyperv_init_platform(void)
|
static void __init ms_hyperv_init_platform(void)
|
||||||
@ -395,6 +422,8 @@ static void __init ms_hyperv_init_platform(void)
|
|||||||
|
|
||||||
# ifdef CONFIG_SMP
|
# ifdef CONFIG_SMP
|
||||||
smp_ops.smp_prepare_boot_cpu = hv_smp_prepare_boot_cpu;
|
smp_ops.smp_prepare_boot_cpu = hv_smp_prepare_boot_cpu;
|
||||||
|
if (hv_root_partition)
|
||||||
|
smp_ops.smp_prepare_cpus = hv_smp_prepare_cpus;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user