From: Wei Liu Date: Sun, 29 Dec 2019 17:16:40 +0000 (+0000) Subject: x86/hyperv: retrieve vp_index from Hyper-V X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=a37007356cd5f6f4fd4550e315cfd2e6d5a785a0;p=people%2Fdwmw2%2Fxen.git x86/hyperv: retrieve vp_index from Hyper-V This will be useful when invoking hypercall that targets specific vcpu(s). Signed-off-by: Wei Liu Reviewed-by: Paul Durrant Acked-by: Jan Beulich --- diff --git a/xen/arch/x86/guest/hyperv/hyperv.c b/xen/arch/x86/guest/hyperv/hyperv.c index ce0a02a3b1..507082a00a 100644 --- a/xen/arch/x86/guest/hyperv/hyperv.c +++ b/xen/arch/x86/guest/hyperv/hyperv.c @@ -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; } diff --git a/xen/arch/x86/guest/hyperv/private.h b/xen/arch/x86/guest/hyperv/private.h index 093985a94b..d1765d4f23 100644 --- a/xen/arch/x86/guest/hyperv/private.h +++ b/xen/arch/x86/guest/hyperv/private.h @@ -25,5 +25,6 @@ #include DECLARE_PER_CPU(void *, hv_input_page); +DECLARE_PER_CPU(unsigned int, hv_vp_index); #endif /* __XEN_HYPERV_PRIVIATE_H__ */