From: Vitaly Kuznetsov Date: Thu, 30 Jun 2016 15:56:39 +0000 (+0200) Subject: x86/xen: use xen_vcpu_id mapping when pointing vcpu_info to shared_info X-Git-Tag: v4.1.12-92~55^2~10 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=77da1a442daff72988e20338bea029b66b25f163;p=users%2Fjedix%2Flinux-maple.git x86/xen: use xen_vcpu_id mapping when pointing vcpu_info to shared_info shared_info page has space for 32 vcpu info slots for first 32 vCPUs but these are the first 32 vCPUs from Xen's perspective and we should map them accordingly with the newly introduced xen_vcpu_id mapping. Signed-off-by: Vitaly Kuznetsov Signed-off-by: David Vrabel (cherry picked from commit e15a8621935cac527b4e0ed4078d24c3e5ef73a6) Signed-off-by: Bob Liu Orabug: 24820937 Conflicts: arch/x86/xen/enlighten.c --- diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index eb6d6dc8148e..706eef560b4f 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c @@ -207,8 +207,9 @@ static void xen_vcpu_setup(int cpu) if (per_cpu(xen_vcpu, cpu) == &per_cpu(xen_vcpu_info, cpu)) return; } - if (cpu < MAX_VIRT_CPUS) - per_cpu(xen_vcpu,cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu]; + if (xen_vcpu_nr(cpu) < MAX_VIRT_CPUS) + per_cpu(xen_vcpu, cpu) = + &HYPERVISOR_shared_info->vcpu_info[xen_vcpu_nr(cpu)]; if (!have_vcpu_info_placement) { if (cpu >= MAX_VIRT_CPUS) @@ -1808,7 +1809,7 @@ void __ref xen_hvm_init_shared_info(void) /* Leave it to be NULL. */ if (cpu >= MAX_VIRT_CPUS && cpu <= NR_CPUS) per_cpu(xen_vcpu, cpu) = NULL; /* Triggers xen_vcpu_setup.*/ - per_cpu(xen_vcpu, cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu]; + per_cpu(xen_vcpu, cpu) = &HYPERVISOR_shared_info->vcpu_info[xen_vcpu_nr(cpu)]; } }