This will be used to generate correct cpuid.01h results.
Signed-off-by: Jan Kiszka <[email protected]>
---
hypervisor/arch/x86/include/asm/vcpu.h | 2 ++
hypervisor/arch/x86/svm.c | 5 +++++
hypervisor/arch/x86/vmx.c | 8 ++++++++
3 files changed, 15 insertions(+)
diff --git a/hypervisor/arch/x86/include/asm/vcpu.h
b/hypervisor/arch/x86/include/asm/vcpu.h
index 3194bfc..edf592f 100644
--- a/hypervisor/arch/x86/include/asm/vcpu.h
+++ b/hypervisor/arch/x86/include/asm/vcpu.h
@@ -100,6 +100,8 @@ void vcpu_vendor_get_execution_state(struct
vcpu_execution_state *x_state);
void vcpu_vendor_get_io_intercept(struct vcpu_io_intercept *io);
void vcpu_vendor_get_mmio_intercept(struct vcpu_mmio_intercept *mmio);
+unsigned long vcpu_vendor_get_guest_cr4(void);
+
bool vcpu_get_guest_paging_structs(struct guest_paging_structures *pg_structs);
void vcpu_vendor_set_guest_pat(unsigned long val);
diff --git a/hypervisor/arch/x86/svm.c b/hypervisor/arch/x86/svm.c
index 0a536d0..a4990bc 100644
--- a/hypervisor/arch/x86/svm.c
+++ b/hypervisor/arch/x86/svm.c
@@ -902,6 +902,11 @@ void vcpu_vendor_get_mmio_intercept(struct
vcpu_mmio_intercept *mmio)
mmio->is_write = !!(vmcb->exitinfo1 & 0x2);
}
+unsigned long vcpu_vendor_get_guest_cr4(void)
+{
+ return this_cpu_data()->vmcb.cr4;
+}
+
void vcpu_handle_exit(struct per_cpu *cpu_data)
{
struct vmcb *vmcb = &cpu_data->vmcb;
diff --git a/hypervisor/arch/x86/vmx.c b/hypervisor/arch/x86/vmx.c
index 33f48b9..131b869 100644
--- a/hypervisor/arch/x86/vmx.c
+++ b/hypervisor/arch/x86/vmx.c
@@ -436,6 +436,14 @@ static bool vmx_set_guest_cr(unsigned int cr_idx, unsigned
long val)
return ok;
}
+unsigned long vcpu_vendor_get_guest_cr4(void)
+{
+ unsigned long host_mask = cr_required1[CR4_IDX] | ~cr_maybe1[CR4_IDX];
+
+ return (vmcs_read64(CR4_READ_SHADOW) & host_mask) |
+ (vmcs_read64(GUEST_CR4) & ~host_mask);
+}
+
static bool vmx_set_cell_config(void)
{
struct cell *cell = this_cell();
--
2.1.4
--
You received this message because you are subscribed to the Google Groups
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.