]> xenbits.xensource.com Git - people/dariof/xen.git/commitdiff
x86/hyperv: retrieve vp_index from Hyper-V
authorWei Liu <liuwe@microsoft.com>
Sun, 29 Dec 2019 17:16:40 +0000 (17:16 +0000)
committerWei Liu <wl@xen.org>
Wed, 5 Feb 2020 16:05:06 +0000 (16:05 +0000)
This will be useful when invoking hypercall that targets specific
vcpu(s).

Signed-off-by: Wei Liu <liuwe@microsoft.com>
Reviewed-by: Paul Durrant <paul@xen.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/guest/hyperv/hyperv.c
xen/arch/x86/guest/hyperv/private.h

index ce0a02a3b1af89c0f89f4c10e82cc77cea11679c..507082a00aa89805d6850c5c4b4dcc4a0dfff3fb 100644 (file)
@@ -30,6 +30,7 @@
 
 struct ms_hyperv_info __read_mostly ms_hyperv;
 DEFINE_PER_CPU_READ_MOSTLY(void *, hv_input_page);
+DEFINE_PER_CPU_READ_MOSTLY(unsigned int, hv_vp_index);
 
 static uint64_t generate_guest_id(void)
 {
@@ -121,6 +122,8 @@ static void __init setup_hypercall_page(void)
 
 static int setup_hypercall_pcpu_arg(void)
 {
+    uint64_t vp_index_msr;
+
     if ( this_cpu(hv_input_page) )
         return 0;
 
@@ -132,6 +135,9 @@ static int setup_hypercall_pcpu_arg(void)
         return -ENOMEM;
     }
 
+    rdmsrl(HV_X64_MSR_VP_INDEX, vp_index_msr);
+    this_cpu(hv_vp_index) = vp_index_msr;
+
     return 0;
 }
 
index 093985a94b06e16dea65bf61350594b6ac545a1c..d1765d4f23614e325b76d1925fd489d9c65196f9 100644 (file)
@@ -25,5 +25,6 @@
 #include <xen/percpu.h>
 
 DECLARE_PER_CPU(void *, hv_input_page);
+DECLARE_PER_CPU(unsigned int, hv_vp_index);
 
 #endif /* __XEN_HYPERV_PRIVIATE_H__  */