From: Joao Martins <
joao.m.martins@oracle.com
Handle the hypercall to set a per vcpu info, and also wire up the
default
vcpu_info in the shared_info page for the first 32 vCPUs.
To avoid deadlock within KVM a vCPU thread must set its *own*
vcpu_info
rather than it being set from the context in which the hypercall is
invoked.
Add the vcpu_info (and default) GPA to the vmstate_x86_cpu for
migration,
and restore it in kvm_arch_put_registers() appropriately.
Signed-off-by: Joao Martins <
joao.m.martins@oracle.com
Signed-off-by: David Woodhouse <
dwmw@amazon.co.uk
---
target/i386/cpu.h | 2 ++
target/i386/kvm/kvm.c | 19 +++++++++++
target/i386/machine.c | 21 ++++++++++++
target/i386/trace-events | 1 +
target/i386/xen.c | 74
+++++++++++++++++++++++++++++++++++++---
target/i386/xen.h | 1 +
6 files changed, 113 insertions(+), 5 deletions(-)
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index c6c57baed5..109b2e5669 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -1788,6 +1788,8 @@ typedef struct CPUArchState {
#endif
#if defined(CONFIG_KVM)
struct kvm_nested_state *nested_state;
+ uint64_t xen_vcpu_info_gpa;
+ uint64_t xen_vcpu_info_default_gpa;
#endif
#if defined(CONFIG_HVF)
HVFX86LazyFlags hvf_lflags;
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index ebde6bc204..fa45e2f99a 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -1811,6 +1811,9 @@ int kvm_arch_init_vcpu(CPUState *cs)
has_msr_hv_hypercall = true;
}
+ env->xen_vcpu_info_gpa = UINT64_MAX;
+ env->xen_vcpu_info_default_gpa = UINT64_MAX;