Add more fields definition for vmcs and vmcs12, which can be used to extend vmcs shadow fields support for VMX emulation. Signed-off-by: Jason Chen CJ <jason.cj.chen@xxxxxxxxx> --- arch/x86/include/asm/vmx.h | 4 ++++ arch/x86/kvm/vmx/vmcs12.c | 6 ++++++ arch/x86/kvm/vmx/vmcs12.h | 16 ++++++++++++++-- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h index 498dc600bd5c..d9f119bab5b2 100644 --- a/arch/x86/include/asm/vmx.h +++ b/arch/x86/include/asm/vmx.h @@ -322,6 +322,10 @@ enum vmcs_field { CR3_TARGET_VALUE2 = 0x0000600c, CR3_TARGET_VALUE3 = 0x0000600e, EXIT_QUALIFICATION = 0x00006400, + EXIT_IO_RCX = 0x00006402, + EXIT_IO_RSI = 0x00006404, + EXIT_IO_RDI = 0x00006406, + EXIT_IO_RIP = 0x00006408, GUEST_LINEAR_ADDRESS = 0x0000640a, GUEST_CR0 = 0x00006800, GUEST_CR3 = 0x00006802, diff --git a/arch/x86/kvm/vmx/vmcs12.c b/arch/x86/kvm/vmx/vmcs12.c index 2251b60920f8..6ab29b869914 100644 --- a/arch/x86/kvm/vmx/vmcs12.c +++ b/arch/x86/kvm/vmx/vmcs12.c @@ -112,6 +112,8 @@ const unsigned short vmcs12_field_offsets[] = { FIELD(GUEST_SYSENTER_CS, guest_sysenter_cs), FIELD(HOST_IA32_SYSENTER_CS, host_ia32_sysenter_cs), FIELD(VMX_PREEMPTION_TIMER_VALUE, vmx_preemption_timer_value), + FIELD(PLE_GAP, ple_gap), + FIELD(PLE_WINDOW, ple_window), FIELD(CR0_GUEST_HOST_MASK, cr0_guest_host_mask), FIELD(CR4_GUEST_HOST_MASK, cr4_guest_host_mask), FIELD(CR0_READ_SHADOW, cr0_read_shadow), @@ -150,5 +152,9 @@ const unsigned short vmcs12_field_offsets[] = { FIELD(HOST_IA32_SYSENTER_EIP, host_ia32_sysenter_eip), FIELD(HOST_RSP, host_rsp), FIELD(HOST_RIP, host_rip), + FIELD(EXIT_IO_RCX, exit_io_rcx), + FIELD(EXIT_IO_RSI, exit_io_rsi), + FIELD(EXIT_IO_RDI, exit_io_rdi), + FIELD(EXIT_IO_RIP, exit_io_rip), }; const unsigned int nr_vmcs12_fields = ARRAY_SIZE(vmcs12_field_offsets); diff --git a/arch/x86/kvm/vmx/vmcs12.h b/arch/x86/kvm/vmx/vmcs12.h index 01936013428b..92483940bb40 100644 --- a/arch/x86/kvm/vmx/vmcs12.h +++ b/arch/x86/kvm/vmx/vmcs12.h @@ -117,7 +117,11 @@ struct __packed vmcs12 { natural_width host_ia32_sysenter_eip; natural_width host_rsp; natural_width host_rip; - natural_width paddingl[8]; /* room for future expansion */ + natural_width exit_io_rcx; + natural_width exit_io_rsi; + natural_width exit_io_rdi; + natural_width exit_io_rip; + natural_width paddingl[4]; /* room for future expansion */ u32 pin_based_vm_exec_control; u32 cpu_based_vm_exec_control; u32 exception_bitmap; @@ -165,7 +169,9 @@ struct __packed vmcs12 { u32 guest_sysenter_cs; u32 host_ia32_sysenter_cs; u32 vmx_preemption_timer_value; - u32 padding32[7]; /* room for future expansion */ + u32 ple_gap; + u32 ple_window; + u32 padding32[5]; /* room for future expansion */ u16 virtual_processor_id; u16 posted_intr_nv; u16 guest_es_selector; @@ -292,6 +298,10 @@ static inline void vmx_check_vmcs12_offsets(void) CHECK_OFFSET(host_ia32_sysenter_eip, 656); CHECK_OFFSET(host_rsp, 664); CHECK_OFFSET(host_rip, 672); + CHECK_OFFSET(exit_io_rcx, 680); + CHECK_OFFSET(exit_io_rsi, 688); + CHECK_OFFSET(exit_io_rdi, 696); + CHECK_OFFSET(exit_io_rip, 704); CHECK_OFFSET(pin_based_vm_exec_control, 744); CHECK_OFFSET(cpu_based_vm_exec_control, 748); CHECK_OFFSET(exception_bitmap, 752); @@ -339,6 +349,8 @@ static inline void vmx_check_vmcs12_offsets(void) CHECK_OFFSET(guest_sysenter_cs, 920); CHECK_OFFSET(host_ia32_sysenter_cs, 924); CHECK_OFFSET(vmx_preemption_timer_value, 928); + CHECK_OFFSET(ple_gap, 932); + CHECK_OFFSET(ple_window, 936); CHECK_OFFSET(virtual_processor_id, 960); CHECK_OFFSET(posted_intr_nv, 962); CHECK_OFFSET(guest_es_selector, 964); -- 2.25.1