diff mbox series

[v5,11/12] x86/hyperv: retrieve vp_index from Hyper-V

Message ID 20200129202034.15052-12-liuwe@microsoft.com (mailing list archive)
State Superseded
Headers show
Series More Hyper-V infrastructures | expand

Commit Message

Wei Liu Jan. 29, 2020, 8:20 p.m. UTC
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>
---
v5:
1. Add Jan's Ack.

v4:
1. Use private.h
2. Add Paul's review tag

v2:
1. Fold into setup_pcpu_arg function
---
 xen/arch/x86/guest/hyperv/hyperv.c  | 5 +++++
 xen/arch/x86/guest/hyperv/private.h | 1 +
 2 files changed, 6 insertions(+)

Comments

Jan Beulich Jan. 31, 2020, 2:27 p.m. UTC | #1
On 29.01.2020 21:20, Wei Liu wrote:
> 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>
> ---
> v5:
> 1. Add Jan's Ack.

And I now realize that it's actually irrelevant for this

>  xen/arch/x86/guest/hyperv/hyperv.c  | 5 +++++
>  xen/arch/x86/guest/hyperv/private.h | 1 +
>  2 files changed, 6 insertions(+)

set of changed files. (Feel free to keep, of course.)

Jan
diff mbox series

Patch

diff --git a/xen/arch/x86/guest/hyperv/hyperv.c b/xen/arch/x86/guest/hyperv/hyperv.c
index f0facccbad..af0d6ed692 100644
--- a/xen/arch/x86/guest/hyperv/hyperv.c
+++ b/xen/arch/x86/guest/hyperv/hyperv.c
@@ -31,6 +31,7 @@ 
 
 struct ms_hyperv_info __read_mostly ms_hyperv;
 DEFINE_PER_CPU_READ_MOSTLY(void *, hv_pcpu_input_page);
+DEFINE_PER_CPU_READ_MOSTLY(unsigned int, hv_vp_index);
 
 static uint64_t generate_guest_id(void)
 {
@@ -133,6 +134,7 @@  static void __init setup_hypercall_page(void)
 static int setup_hypercall_pcpu_arg(void)
 {
     void *mapping;
+    uint64_t vp_index_msr;
 
     if ( this_cpu(hv_pcpu_input_page) )
         return 0;
@@ -147,6 +149,9 @@  static int setup_hypercall_pcpu_arg(void)
 
     this_cpu(hv_pcpu_input_page) = mapping;
 
+    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 a339274985..c1c2431eff 100644
--- a/xen/arch/x86/guest/hyperv/private.h
+++ b/xen/arch/x86/guest/hyperv/private.h
@@ -25,5 +25,6 @@ 
 #include <xen/percpu.h>
 
 DECLARE_PER_CPU(void *, hv_pcpu_input_page);
+DECLARE_PER_CPU(unsigned int, hv_vp_index);
 
 #endif /* __XEN_HYPERV_PRIVIATE_H__  */