diff mbox

[06/23] hyperv: helper to find vcpu by VP index

Message ID 20170606181948.16238-7-rkagan@virtuozzo.com
State New
Headers show

Commit Message

Roman Kagan June 6, 2017, 6:19 p.m. UTC
Locate the vcpu by its VP index (equal to QEMU cpu_index).

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
---
 target/i386/hyperv.h | 1 +
 target/i386/hyperv.c | 5 +++++
 2 files changed, 6 insertions(+)
diff mbox

Patch

diff --git a/target/i386/hyperv.h b/target/i386/hyperv.h
index 35da0b1..c5843c9 100644
--- a/target/i386/hyperv.h
+++ b/target/i386/hyperv.h
@@ -40,5 +40,6 @@  void kvm_hv_sint_route_destroy(HvSintRoute *sint_route);
 int kvm_hv_sint_route_set_sint(HvSintRoute *sint_route);
 
 uint32_t hyperv_vp_index(X86CPU *cpu);
+X86CPU *hyperv_find_vcpu(uint32_t vcpu_id);
 
 #endif
diff --git a/target/i386/hyperv.c b/target/i386/hyperv.c
index 27de5bc..480bdfe 100644
--- a/target/i386/hyperv.c
+++ b/target/i386/hyperv.c
@@ -21,6 +21,11 @@  uint32_t hyperv_vp_index(X86CPU *cpu)
     return CPU(cpu)->cpu_index;
 }
 
+X86CPU *hyperv_find_vcpu(uint32_t vp_index)
+{
+    return X86_CPU(qemu_get_cpu(vp_index));
+}
+
 int kvm_hv_handle_exit(X86CPU *cpu, struct kvm_hyperv_exit *exit)
 {
     CPUX86State *env = &cpu->env;