* [PATCH 0/7] KVM: nVMX: Enable unrestricted guest mode and fix some nEPT issues
@ 2013-08-04 17:48 Jan Kiszka
2013-08-04 17:49 ` [PATCH 1/7] KVM: nEPT: Advertise WB type EPTP Jan Kiszka
` (6 more replies)
0 siblings, 7 replies; 11+ messages in thread
From: Jan Kiszka @ 2013-08-04 17:48 UTC (permalink / raw)
To: Gleb Natapov, Paolo Bonzini; +Cc: kvm, Xiao Guangrong, Jun Nakajima, Yang Zhang
These patches apply on top of nEPT v6 and basically enable unrestricted
guest mode to be used by L1.
Jan Kiszka (7):
KVM: nEPT: Advertise WB type EPTP
KVM: nVMX: Replace kvm_set_cr0 with vmx_set_cr0 in
load_vmcs12_host_state
KVM: nVMX: Enable unrestricted guest mode support
KVM: nVMX: Fix guest CR3 read-back on VM-exit
KVM: nVMX: Load nEPT state after EFER
KVM: nVMX: Implement support for EFER saving on VM-exit
KVM: nVMX: Update mmu.base_role.nxe after EFER loading on
VM-entry/exit
arch/x86/kvm/vmx.c | 44 ++++++++++++++++++++++++++++++--------------
1 files changed, 30 insertions(+), 14 deletions(-)
--
1.7.3.4
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/7] KVM: nEPT: Advertise WB type EPTP
2013-08-04 17:48 [PATCH 0/7] KVM: nVMX: Enable unrestricted guest mode and fix some nEPT issues Jan Kiszka
@ 2013-08-04 17:49 ` Jan Kiszka
2013-08-05 13:12 ` Gleb Natapov
2013-08-04 17:49 ` [PATCH 2/7] KVM: nVMX: Replace kvm_set_cr0 with vmx_set_cr0 in load_vmcs12_host_state Jan Kiszka
` (5 subsequent siblings)
6 siblings, 1 reply; 11+ messages in thread
From: Jan Kiszka @ 2013-08-04 17:49 UTC (permalink / raw)
To: Gleb Natapov, Paolo Bonzini; +Cc: kvm, Xiao Guangrong, Jun Nakajima, Yang Zhang
From: Jan Kiszka <jan.kiszka@siemens.com>
At least WB must be possible.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
arch/x86/kvm/vmx.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index e51bf4a..53050a0 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -2250,8 +2250,8 @@ static __init void nested_vmx_setup_ctls_msrs(void)
if (enable_ept) {
/* nested EPT: emulate EPT also to L1 */
nested_vmx_secondary_ctls_high |= SECONDARY_EXEC_ENABLE_EPT;
- nested_vmx_ept_caps = VMX_EPT_PAGE_WALK_4_BIT;
- nested_vmx_ept_caps |= VMX_EPT_INVEPT_BIT;
+ nested_vmx_ept_caps = VMX_EPT_PAGE_WALK_4_BIT |
+ VMX_EPTP_WB_BIT | VMX_EPT_INVEPT_BIT;
nested_vmx_ept_caps &= vmx_capability.ept;
/*
* Since invept is completely emulated we support both global
--
1.7.3.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/7] KVM: nVMX: Replace kvm_set_cr0 with vmx_set_cr0 in load_vmcs12_host_state
2013-08-04 17:48 [PATCH 0/7] KVM: nVMX: Enable unrestricted guest mode and fix some nEPT issues Jan Kiszka
2013-08-04 17:49 ` [PATCH 1/7] KVM: nEPT: Advertise WB type EPTP Jan Kiszka
@ 2013-08-04 17:49 ` Jan Kiszka
2013-08-04 17:49 ` [PATCH 3/7] KVM: nVMX: Enable unrestricted guest mode support Jan Kiszka
` (4 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Jan Kiszka @ 2013-08-04 17:49 UTC (permalink / raw)
To: Gleb Natapov, Paolo Bonzini; +Cc: kvm, Xiao Guangrong, Jun Nakajima, Yang Zhang
From: Jan Kiszka <jan.kiszka@siemens.com>
Likely a typo, but a fatal one as kvm_set_cr0 performs checks on the
state transition that may prevent loading L1's cr0.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
arch/x86/kvm/vmx.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 53050a0..fc4a401 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -8174,7 +8174,7 @@ static void load_vmcs12_host_state(struct kvm_vcpu *vcpu,
* fpu_active (which may have changed).
* Note that vmx_set_cr0 refers to efer set above.
*/
- kvm_set_cr0(vcpu, vmcs12->host_cr0);
+ vmx_set_cr0(vcpu, vmcs12->host_cr0);
/*
* If we did fpu_activate()/fpu_deactivate() during L2's run, we need
* to apply the same changes to L1's vmcs. We just set cr0 correctly,
--
1.7.3.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 3/7] KVM: nVMX: Enable unrestricted guest mode support
2013-08-04 17:48 [PATCH 0/7] KVM: nVMX: Enable unrestricted guest mode and fix some nEPT issues Jan Kiszka
2013-08-04 17:49 ` [PATCH 1/7] KVM: nEPT: Advertise WB type EPTP Jan Kiszka
2013-08-04 17:49 ` [PATCH 2/7] KVM: nVMX: Replace kvm_set_cr0 with vmx_set_cr0 in load_vmcs12_host_state Jan Kiszka
@ 2013-08-04 17:49 ` Jan Kiszka
2013-08-04 17:49 ` [PATCH 4/7] KVM: nVMX: Fix guest CR3 read-back on VM-exit Jan Kiszka
` (3 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Jan Kiszka @ 2013-08-04 17:49 UTC (permalink / raw)
To: Gleb Natapov, Paolo Bonzini; +Cc: kvm, Xiao Guangrong, Jun Nakajima, Yang Zhang
From: Jan Kiszka <jan.kiszka@siemens.com>
Now that we provide EPT support, there is no reason to torture our
guests by hiding the relieving unrestricted guest mode feature. We just
need to relax CR0 checks for always-on bits as PE and PG can now be
switched off.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
arch/x86/kvm/vmx.c | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index fc4a401..22f396f 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -2245,6 +2245,7 @@ static __init void nested_vmx_setup_ctls_msrs(void)
nested_vmx_secondary_ctls_low = 0;
nested_vmx_secondary_ctls_high &=
SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES |
+ SECONDARY_EXEC_UNRESTRICTED_GUEST |
SECONDARY_EXEC_WBINVD_EXITING;
if (enable_ept) {
@@ -4868,6 +4869,17 @@ vmx_patch_hypercall(struct kvm_vcpu *vcpu, unsigned char *hypercall)
hypercall[2] = 0xc1;
}
+static bool nested_cr0_valid(struct vmcs12 *vmcs12, unsigned long val)
+{
+ unsigned long always_on = VMXON_CR0_ALWAYSON;
+
+ if (nested_vmx_secondary_ctls_high &
+ SECONDARY_EXEC_UNRESTRICTED_GUEST &&
+ nested_cpu_has2(vmcs12, SECONDARY_EXEC_UNRESTRICTED_GUEST))
+ always_on &= ~(X86_CR0_PE | X86_CR0_PG);
+ return (val & always_on) == always_on;
+}
+
/* called to set cr0 as appropriate for a mov-to-cr0 exit. */
static int handle_set_cr0(struct kvm_vcpu *vcpu, unsigned long val)
{
@@ -4886,9 +4898,7 @@ static int handle_set_cr0(struct kvm_vcpu *vcpu, unsigned long val)
val = (val & ~vmcs12->cr0_guest_host_mask) |
(vmcs12->guest_cr0 & vmcs12->cr0_guest_host_mask);
- /* TODO: will have to take unrestricted guest mode into
- * account */
- if ((val & VMXON_CR0_ALWAYSON) != VMXON_CR0_ALWAYSON)
+ if (!nested_cr0_valid(vmcs12, val))
return 1;
if (kvm_set_cr0(vcpu, val))
@@ -7849,7 +7859,7 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch)
return 1;
}
- if (((vmcs12->guest_cr0 & VMXON_CR0_ALWAYSON) != VMXON_CR0_ALWAYSON) ||
+ if (!nested_cr0_valid(vmcs12, vmcs12->guest_cr0) ||
((vmcs12->guest_cr4 & VMXON_CR4_ALWAYSON) != VMXON_CR4_ALWAYSON)) {
nested_vmx_entry_failure(vcpu, vmcs12,
EXIT_REASON_INVALID_STATE, ENTRY_FAIL_DEFAULT);
--
1.7.3.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 4/7] KVM: nVMX: Fix guest CR3 read-back on VM-exit
2013-08-04 17:48 [PATCH 0/7] KVM: nVMX: Enable unrestricted guest mode and fix some nEPT issues Jan Kiszka
` (2 preceding siblings ...)
2013-08-04 17:49 ` [PATCH 3/7] KVM: nVMX: Enable unrestricted guest mode support Jan Kiszka
@ 2013-08-04 17:49 ` Jan Kiszka
2013-08-04 17:49 ` [PATCH 5/7] KVM: nVMX: Load nEPT state after EFER Jan Kiszka
` (2 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Jan Kiszka @ 2013-08-04 17:49 UTC (permalink / raw)
To: Gleb Natapov, Paolo Bonzini; +Cc: kvm, Xiao Guangrong, Jun Nakajima, Yang Zhang
From: Jan Kiszka <jan.kiszka@siemens.com>
If nested EPT is enabled, the L2 guest may change CR3 without any exits.
We therefore have to read the current value from the VMCS when switching
to L1. However, if paging wasn't enabled, L0 tracks L2's CR3, and
GUEST_CR3 rather contains the real-mode identity map. So we need to
retrieve CR3 from the architectural state after conditionally updating
it - and this is what kvm_read_cr3 does.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
arch/x86/kvm/vmx.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 22f396f..d0e1d5f 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -8097,7 +8097,7 @@ static void prepare_vmcs12(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
* Additionally, restore L2's PDPTR to vmcs12.
*/
if (enable_ept) {
- vmcs12->guest_cr3 = vmcs_read64(GUEST_CR3);
+ vmcs12->guest_cr3 = kvm_read_cr3(vcpu);
vmcs12->guest_pdptr0 = vmcs_read64(GUEST_PDPTR0);
vmcs12->guest_pdptr1 = vmcs_read64(GUEST_PDPTR1);
vmcs12->guest_pdptr2 = vmcs_read64(GUEST_PDPTR2);
--
1.7.3.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 5/7] KVM: nVMX: Load nEPT state after EFER
2013-08-04 17:48 [PATCH 0/7] KVM: nVMX: Enable unrestricted guest mode and fix some nEPT issues Jan Kiszka
` (3 preceding siblings ...)
2013-08-04 17:49 ` [PATCH 4/7] KVM: nVMX: Fix guest CR3 read-back on VM-exit Jan Kiszka
@ 2013-08-04 17:49 ` Jan Kiszka
2013-08-04 17:49 ` [PATCH 6/7] KVM: nVMX: Implement support for EFER saving on VM-exit Jan Kiszka
2013-08-04 17:49 ` [PATCH 7/7] KVM: nVMX: Update mmu.base_role.nxe after EFER loading on VM-entry/exit Jan Kiszka
6 siblings, 0 replies; 11+ messages in thread
From: Jan Kiszka @ 2013-08-04 17:49 UTC (permalink / raw)
To: Gleb Natapov, Paolo Bonzini; +Cc: kvm, Xiao Guangrong, Jun Nakajima, Yang Zhang
From: Jan Kiszka <jan.kiszka@siemens.com>
We need to update EFER.NX before building the nEPT state via
nested_ept_init_mmu_context. Otherwise, we risk to create an MMU context
that claims to have NX disabled while the guest EPT used NX. This will
cause spurious faults for L2.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
arch/x86/kvm/vmx.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index d0e1d5f..84a05b4 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -7724,11 +7724,6 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
vmx_flush_tlb(vcpu);
}
- if (nested_cpu_has_ept(vmcs12)) {
- kvm_mmu_unload(vcpu);
- nested_ept_init_mmu_context(vcpu);
- }
-
if (vmcs12->vm_entry_controls & VM_ENTRY_LOAD_IA32_EFER)
vcpu->arch.efer = vmcs12->guest_ia32_efer;
else if (vmcs12->vm_entry_controls & VM_ENTRY_IA32E_MODE)
@@ -7738,6 +7733,11 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
/* Note: modifies VM_ENTRY/EXIT_CONTROLS and GUEST/HOST_IA32_EFER */
vmx_set_efer(vcpu, vcpu->arch.efer);
+ if (nested_cpu_has_ept(vmcs12)) {
+ kvm_mmu_unload(vcpu);
+ nested_ept_init_mmu_context(vcpu);
+ }
+
/*
* This sets GUEST_CR0 to vmcs12->guest_cr0, with possibly a modified
* TS bit (for lazy fpu) and bits which we consider mandatory enabled.
--
1.7.3.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 6/7] KVM: nVMX: Implement support for EFER saving on VM-exit
2013-08-04 17:48 [PATCH 0/7] KVM: nVMX: Enable unrestricted guest mode and fix some nEPT issues Jan Kiszka
` (4 preceding siblings ...)
2013-08-04 17:49 ` [PATCH 5/7] KVM: nVMX: Load nEPT state after EFER Jan Kiszka
@ 2013-08-04 17:49 ` Jan Kiszka
2013-08-05 7:21 ` Arthur Chunqi Li
2013-08-04 17:49 ` [PATCH 7/7] KVM: nVMX: Update mmu.base_role.nxe after EFER loading on VM-entry/exit Jan Kiszka
6 siblings, 1 reply; 11+ messages in thread
From: Jan Kiszka @ 2013-08-04 17:49 UTC (permalink / raw)
To: Gleb Natapov, Paolo Bonzini; +Cc: kvm, Xiao Guangrong, Jun Nakajima, Yang Zhang
From: Jan Kiszka <jan.kiszka@siemens.com>
Implement and advertise VM_EXIT_SAVE_IA32_EFER. L0 traps EFER writes
unconditionally, so we always find the current L2 value in the
architectural state.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
arch/x86/kvm/vmx.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 84a05b4..7208d0b 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -2203,7 +2203,7 @@ static __init void nested_vmx_setup_ctls_msrs(void)
nested_vmx_exit_ctls_high = 0;
#endif
nested_vmx_exit_ctls_high |= (VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR |
- VM_EXIT_LOAD_IA32_EFER);
+ VM_EXIT_LOAD_IA32_EFER | VM_EXIT_SAVE_IA32_EFER);
/* entry controls */
rdmsr(MSR_IA32_VMX_ENTRY_CTLS,
@@ -8113,6 +8113,8 @@ static void prepare_vmcs12(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
vmcs12->guest_ia32_debugctl = vmcs_read64(GUEST_IA32_DEBUGCTL);
if (vmcs12->vm_exit_controls & VM_EXIT_SAVE_IA32_PAT)
vmcs12->guest_ia32_pat = vmcs_read64(GUEST_IA32_PAT);
+ if (vmcs12->vm_exit_controls & VM_EXIT_SAVE_IA32_EFER)
+ vmcs12->guest_ia32_efer = vcpu->arch.efer;
vmcs12->guest_sysenter_cs = vmcs_read32(GUEST_SYSENTER_CS);
vmcs12->guest_sysenter_esp = vmcs_readl(GUEST_SYSENTER_ESP);
vmcs12->guest_sysenter_eip = vmcs_readl(GUEST_SYSENTER_EIP);
--
1.7.3.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 7/7] KVM: nVMX: Update mmu.base_role.nxe after EFER loading on VM-entry/exit
2013-08-04 17:48 [PATCH 0/7] KVM: nVMX: Enable unrestricted guest mode and fix some nEPT issues Jan Kiszka
` (5 preceding siblings ...)
2013-08-04 17:49 ` [PATCH 6/7] KVM: nVMX: Implement support for EFER saving on VM-exit Jan Kiszka
@ 2013-08-04 17:49 ` Jan Kiszka
6 siblings, 0 replies; 11+ messages in thread
From: Jan Kiszka @ 2013-08-04 17:49 UTC (permalink / raw)
To: Gleb Natapov, Paolo Bonzini; +Cc: kvm, Xiao Guangrong, Jun Nakajima, Yang Zhang
From: Jan Kiszka <jan.kiszka@siemens.com>
This job is normally performed by the architectural EFER set service
which we cannot use as it prevents transitions that are valid when
switching between L1 and L2. So open-code the update of base_role.nxe
after changing EFER on VM-entry and exit.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
arch/x86/kvm/vmx.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 7208d0b..84480ef 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -7732,6 +7732,8 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
vcpu->arch.efer &= ~(EFER_LMA | EFER_LME);
/* Note: modifies VM_ENTRY/EXIT_CONTROLS and GUEST/HOST_IA32_EFER */
vmx_set_efer(vcpu, vcpu->arch.efer);
+ vcpu->arch.mmu.base_role.nxe =
+ (vcpu->arch.efer & EFER_NX) && !enable_ept;
if (nested_cpu_has_ept(vmcs12)) {
kvm_mmu_unload(vcpu);
@@ -8176,6 +8178,8 @@ static void load_vmcs12_host_state(struct kvm_vcpu *vcpu,
else
vcpu->arch.efer &= ~(EFER_LMA | EFER_LME);
vmx_set_efer(vcpu, vcpu->arch.efer);
+ vcpu->arch.mmu.base_role.nxe =
+ (vcpu->arch.efer & EFER_NX) && !enable_ept;
kvm_register_write(vcpu, VCPU_REGS_RSP, vmcs12->host_rsp);
kvm_register_write(vcpu, VCPU_REGS_RIP, vmcs12->host_rip);
--
1.7.3.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 6/7] KVM: nVMX: Implement support for EFER saving on VM-exit
2013-08-04 17:49 ` [PATCH 6/7] KVM: nVMX: Implement support for EFER saving on VM-exit Jan Kiszka
@ 2013-08-05 7:21 ` Arthur Chunqi Li
2013-08-05 7:35 ` Jan Kiszka
0 siblings, 1 reply; 11+ messages in thread
From: Arthur Chunqi Li @ 2013-08-05 7:21 UTC (permalink / raw)
To: Jan Kiszka
Cc: Gleb Natapov, Paolo Bonzini, kvm, Xiao Guangrong, Jun Nakajima,
Yang Zhang
On Mon, Aug 5, 2013 at 1:49 AM, Jan Kiszka <jan.kiszka@web.de> wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> Implement and advertise VM_EXIT_SAVE_IA32_EFER. L0 traps EFER writes
> unconditionally, so we always find the current L2 value in the
> architectural state.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
> arch/x86/kvm/vmx.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 84a05b4..7208d0b 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -2203,7 +2203,7 @@ static __init void nested_vmx_setup_ctls_msrs(void)
> nested_vmx_exit_ctls_high = 0;
> #endif
> nested_vmx_exit_ctls_high |= (VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR |
> - VM_EXIT_LOAD_IA32_EFER);
> + VM_EXIT_LOAD_IA32_EFER | VM_EXIT_SAVE_IA32_EFER);
Here you may need to access MSR_IA32_VMX_EXIT_CTLS first to check if
host support these two features. The codes for "entry controls"
following it can achieve goals like this.
Arthur
>
> /* entry controls */
> rdmsr(MSR_IA32_VMX_ENTRY_CTLS,
> @@ -8113,6 +8113,8 @@ static void prepare_vmcs12(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
> vmcs12->guest_ia32_debugctl = vmcs_read64(GUEST_IA32_DEBUGCTL);
> if (vmcs12->vm_exit_controls & VM_EXIT_SAVE_IA32_PAT)
> vmcs12->guest_ia32_pat = vmcs_read64(GUEST_IA32_PAT);
> + if (vmcs12->vm_exit_controls & VM_EXIT_SAVE_IA32_EFER)
> + vmcs12->guest_ia32_efer = vcpu->arch.efer;
> vmcs12->guest_sysenter_cs = vmcs_read32(GUEST_SYSENTER_CS);
> vmcs12->guest_sysenter_esp = vmcs_readl(GUEST_SYSENTER_ESP);
> vmcs12->guest_sysenter_eip = vmcs_readl(GUEST_SYSENTER_EIP);
> --
> 1.7.3.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 6/7] KVM: nVMX: Implement support for EFER saving on VM-exit
2013-08-05 7:21 ` Arthur Chunqi Li
@ 2013-08-05 7:35 ` Jan Kiszka
0 siblings, 0 replies; 11+ messages in thread
From: Jan Kiszka @ 2013-08-05 7:35 UTC (permalink / raw)
To: Arthur Chunqi Li
Cc: Gleb Natapov, Paolo Bonzini, kvm, Xiao Guangrong, Jun Nakajima,
Yang Zhang
[-- Attachment #1: Type: text/plain, Size: 1351 bytes --]
On 2013-08-05 09:21, Arthur Chunqi Li wrote:
> On Mon, Aug 5, 2013 at 1:49 AM, Jan Kiszka <jan.kiszka@web.de> wrote:
>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>
>> Implement and advertise VM_EXIT_SAVE_IA32_EFER. L0 traps EFER writes
>> unconditionally, so we always find the current L2 value in the
>> architectural state.
>>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>> ---
>> arch/x86/kvm/vmx.c | 4 +++-
>> 1 files changed, 3 insertions(+), 1 deletions(-)
>>
>> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
>> index 84a05b4..7208d0b 100644
>> --- a/arch/x86/kvm/vmx.c
>> +++ b/arch/x86/kvm/vmx.c
>> @@ -2203,7 +2203,7 @@ static __init void nested_vmx_setup_ctls_msrs(void)
>> nested_vmx_exit_ctls_high = 0;
>> #endif
>> nested_vmx_exit_ctls_high |= (VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR |
>> - VM_EXIT_LOAD_IA32_EFER);
>> + VM_EXIT_LOAD_IA32_EFER | VM_EXIT_SAVE_IA32_EFER);
> Here you may need to access MSR_IA32_VMX_EXIT_CTLS first to check if
> host support these two features. The codes for "entry controls"
> following it can achieve goals like this.
We are providing this feature independently of the host's support. Every
write to EFER is trapped by L0, so we can emulate saving by reading what
L0 recorded.
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/7] KVM: nEPT: Advertise WB type EPTP
2013-08-04 17:49 ` [PATCH 1/7] KVM: nEPT: Advertise WB type EPTP Jan Kiszka
@ 2013-08-05 13:12 ` Gleb Natapov
0 siblings, 0 replies; 11+ messages in thread
From: Gleb Natapov @ 2013-08-05 13:12 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Paolo Bonzini, kvm, Xiao Guangrong, Jun Nakajima, Yang Zhang
On Sun, Aug 04, 2013 at 07:49:00PM +0200, Jan Kiszka wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> At least WB must be possible.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Gleb Natapov <gleb@redhat.com>
> ---
> arch/x86/kvm/vmx.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index e51bf4a..53050a0 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -2250,8 +2250,8 @@ static __init void nested_vmx_setup_ctls_msrs(void)
> if (enable_ept) {
> /* nested EPT: emulate EPT also to L1 */
> nested_vmx_secondary_ctls_high |= SECONDARY_EXEC_ENABLE_EPT;
> - nested_vmx_ept_caps = VMX_EPT_PAGE_WALK_4_BIT;
> - nested_vmx_ept_caps |= VMX_EPT_INVEPT_BIT;
> + nested_vmx_ept_caps = VMX_EPT_PAGE_WALK_4_BIT |
> + VMX_EPTP_WB_BIT | VMX_EPT_INVEPT_BIT;
> nested_vmx_ept_caps &= vmx_capability.ept;
> /*
> * Since invept is completely emulated we support both global
> --
> 1.7.3.4
--
Gleb.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2013-08-05 13:12 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-04 17:48 [PATCH 0/7] KVM: nVMX: Enable unrestricted guest mode and fix some nEPT issues Jan Kiszka
2013-08-04 17:49 ` [PATCH 1/7] KVM: nEPT: Advertise WB type EPTP Jan Kiszka
2013-08-05 13:12 ` Gleb Natapov
2013-08-04 17:49 ` [PATCH 2/7] KVM: nVMX: Replace kvm_set_cr0 with vmx_set_cr0 in load_vmcs12_host_state Jan Kiszka
2013-08-04 17:49 ` [PATCH 3/7] KVM: nVMX: Enable unrestricted guest mode support Jan Kiszka
2013-08-04 17:49 ` [PATCH 4/7] KVM: nVMX: Fix guest CR3 read-back on VM-exit Jan Kiszka
2013-08-04 17:49 ` [PATCH 5/7] KVM: nVMX: Load nEPT state after EFER Jan Kiszka
2013-08-04 17:49 ` [PATCH 6/7] KVM: nVMX: Implement support for EFER saving on VM-exit Jan Kiszka
2013-08-05 7:21 ` Arthur Chunqi Li
2013-08-05 7:35 ` Jan Kiszka
2013-08-04 17:49 ` [PATCH 7/7] KVM: nVMX: Update mmu.base_role.nxe after EFER loading on VM-entry/exit Jan Kiszka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox