public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] KVM: nVMX: Fix content of MSR_IA32_VMX_ENTRY/EXIT_CTLS
@ 2013-03-04 16:15 Jan Kiszka
  2013-03-04 16:33 ` Paolo Bonzini
  2013-03-06  0:10 ` Marcelo Tosatti
  0 siblings, 2 replies; 5+ messages in thread
From: Jan Kiszka @ 2013-03-04 16:15 UTC (permalink / raw)
  To: Gleb Natapov, Marcelo Tosatti
  Cc: kvm, Nadav Har'El, Nakajima, Jun, Paolo Bonzini

Properly set those bits to 1 that the spec demands in case bit 55 of
VMX_BASIC is 0 - like in our case.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

Changes in v2:
 - use symbolic constants

 arch/x86/include/asm/vmx.h |    4 ++++
 arch/x86/kvm/vmx.c         |   13 ++++++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h
index f6b599b..a0c2ad2 100644
--- a/arch/x86/include/asm/vmx.h
+++ b/arch/x86/include/asm/vmx.h
@@ -169,6 +169,8 @@
 #define VM_EXIT_LOAD_IA32_EFER                  0x00200000
 #define VM_EXIT_SAVE_VMX_PREEMPTION_TIMER       0x00400000
 
+#define VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR	0x00036dff
+
 #define VM_ENTRY_LOAD_DEBUG_CONTROLS            0x00000002
 #define VM_ENTRY_IA32E_MODE                     0x00000200
 #define VM_ENTRY_SMM                            0x00000400
@@ -177,6 +179,8 @@
 #define VM_ENTRY_LOAD_IA32_PAT			0x00004000
 #define VM_ENTRY_LOAD_IA32_EFER                 0x00008000
 
+#define VM_ENTRY_ALWAYSON_WITHOUT_TRUE_MSR	0x000011ff
+
 #define VMX_MISC_SAVE_EFER_LMA			0x00000020
 
 /* VMCS Encodings */
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 631cdb3..1f917de 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -2050,21 +2050,28 @@ static __init void nested_vmx_setup_ctls_msrs(void)
 		PIN_BASED_EXT_INTR_MASK | PIN_BASED_NMI_EXITING |
 		PIN_BASED_VIRTUAL_NMIS;
 
-	/* exit controls */
-	nested_vmx_exit_ctls_low = 0;
+	/*
+	 * Exit controls
+	 * If bit 55 of VMX_BASIC is off, bits 0-8 and 10, 11, 13, 14, 16 and
+	 * 17 must be 1.
+	 */
+	nested_vmx_exit_ctls_low = VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR;
 	/* Note that guest use of VM_EXIT_ACK_INTR_ON_EXIT is not supported. */
 #ifdef CONFIG_X86_64
 	nested_vmx_exit_ctls_high = VM_EXIT_HOST_ADDR_SPACE_SIZE;
 #else
 	nested_vmx_exit_ctls_high = 0;
 #endif
+	nested_vmx_exit_ctls_high |= VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR;
 
 	/* entry controls */
 	rdmsr(MSR_IA32_VMX_ENTRY_CTLS,
 		nested_vmx_entry_ctls_low, nested_vmx_entry_ctls_high);
-	nested_vmx_entry_ctls_low = 0;
+	/* If bit 55 of VMX_BASIC is off, bits 0-8 and 12 must be 1. */
+	nested_vmx_entry_ctls_low = VM_ENTRY_ALWAYSON_WITHOUT_TRUE_MSR;
 	nested_vmx_entry_ctls_high &=
 		VM_ENTRY_LOAD_IA32_PAT | VM_ENTRY_IA32E_MODE;
+	nested_vmx_entry_ctls_high |= VM_ENTRY_ALWAYSON_WITHOUT_TRUE_MSR;
 
 	/* cpu-based controls */
 	rdmsr(MSR_IA32_VMX_PROCBASED_CTLS,
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] KVM: nVMX: Fix content of MSR_IA32_VMX_ENTRY/EXIT_CTLS
  2013-03-04 16:15 [PATCH v2] KVM: nVMX: Fix content of MSR_IA32_VMX_ENTRY/EXIT_CTLS Jan Kiszka
@ 2013-03-04 16:33 ` Paolo Bonzini
  2013-03-06  0:10 ` Marcelo Tosatti
  1 sibling, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2013-03-04 16:33 UTC (permalink / raw)
  To: Jan Kiszka
  Cc: Gleb Natapov, Marcelo Tosatti, kvm, Nadav Har'El,
	Nakajima, Jun

Il 04/03/2013 17:15, Jan Kiszka ha scritto:
> Properly set those bits to 1 that the spec demands in case bit 55 of
> VMX_BASIC is 0 - like in our case.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>


> ---
> 
> Changes in v2:
>  - use symbolic constants
> 
>  arch/x86/include/asm/vmx.h |    4 ++++
>  arch/x86/kvm/vmx.c         |   13 ++++++++++---
>  2 files changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h
> index f6b599b..a0c2ad2 100644
> --- a/arch/x86/include/asm/vmx.h
> +++ b/arch/x86/include/asm/vmx.h
> @@ -169,6 +169,8 @@
>  #define VM_EXIT_LOAD_IA32_EFER                  0x00200000
>  #define VM_EXIT_SAVE_VMX_PREEMPTION_TIMER       0x00400000
>  
> +#define VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR	0x00036dff
> +
>  #define VM_ENTRY_LOAD_DEBUG_CONTROLS            0x00000002
>  #define VM_ENTRY_IA32E_MODE                     0x00000200
>  #define VM_ENTRY_SMM                            0x00000400
> @@ -177,6 +179,8 @@
>  #define VM_ENTRY_LOAD_IA32_PAT			0x00004000
>  #define VM_ENTRY_LOAD_IA32_EFER                 0x00008000
>  
> +#define VM_ENTRY_ALWAYSON_WITHOUT_TRUE_MSR	0x000011ff
> +
>  #define VMX_MISC_SAVE_EFER_LMA			0x00000020
>  
>  /* VMCS Encodings */
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 631cdb3..1f917de 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -2050,21 +2050,28 @@ static __init void nested_vmx_setup_ctls_msrs(void)
>  		PIN_BASED_EXT_INTR_MASK | PIN_BASED_NMI_EXITING |
>  		PIN_BASED_VIRTUAL_NMIS;
>  
> -	/* exit controls */
> -	nested_vmx_exit_ctls_low = 0;
> +	/*
> +	 * Exit controls
> +	 * If bit 55 of VMX_BASIC is off, bits 0-8 and 10, 11, 13, 14, 16 and
> +	 * 17 must be 1.
> +	 */
> +	nested_vmx_exit_ctls_low = VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR;
>  	/* Note that guest use of VM_EXIT_ACK_INTR_ON_EXIT is not supported. */
>  #ifdef CONFIG_X86_64
>  	nested_vmx_exit_ctls_high = VM_EXIT_HOST_ADDR_SPACE_SIZE;
>  #else
>  	nested_vmx_exit_ctls_high = 0;
>  #endif
> +	nested_vmx_exit_ctls_high |= VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR;
>  
>  	/* entry controls */
>  	rdmsr(MSR_IA32_VMX_ENTRY_CTLS,
>  		nested_vmx_entry_ctls_low, nested_vmx_entry_ctls_high);
> -	nested_vmx_entry_ctls_low = 0;
> +	/* If bit 55 of VMX_BASIC is off, bits 0-8 and 12 must be 1. */
> +	nested_vmx_entry_ctls_low = VM_ENTRY_ALWAYSON_WITHOUT_TRUE_MSR;
>  	nested_vmx_entry_ctls_high &=
>  		VM_ENTRY_LOAD_IA32_PAT | VM_ENTRY_IA32E_MODE;
> +	nested_vmx_entry_ctls_high |= VM_ENTRY_ALWAYSON_WITHOUT_TRUE_MSR;
>  
>  	/* cpu-based controls */
>  	rdmsr(MSR_IA32_VMX_PROCBASED_CTLS,
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] KVM: nVMX: Fix content of MSR_IA32_VMX_ENTRY/EXIT_CTLS
  2013-03-04 16:15 [PATCH v2] KVM: nVMX: Fix content of MSR_IA32_VMX_ENTRY/EXIT_CTLS Jan Kiszka
  2013-03-04 16:33 ` Paolo Bonzini
@ 2013-03-06  0:10 ` Marcelo Tosatti
  2013-03-06 14:44   ` [PATCH v3] " Jan Kiszka
  1 sibling, 1 reply; 5+ messages in thread
From: Marcelo Tosatti @ 2013-03-06  0:10 UTC (permalink / raw)
  To: Jan Kiszka
  Cc: Gleb Natapov, kvm, Nadav Har'El, Nakajima, Jun, Paolo Bonzini

On Mon, Mar 04, 2013 at 05:15:48PM +0100, Jan Kiszka wrote:
> Properly set those bits to 1 that the spec demands in case bit 55 of
> VMX_BASIC is 0 - like in our case.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
> 
> Changes in v2:
>  - use symbolic constants
> 
>  arch/x86/include/asm/vmx.h |    4 ++++
>  arch/x86/kvm/vmx.c         |   13 ++++++++++---
>  2 files changed, 14 insertions(+), 3 deletions(-)

Please regenerate against queue branch.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v3] KVM: nVMX: Fix content of MSR_IA32_VMX_ENTRY/EXIT_CTLS
  2013-03-06  0:10 ` Marcelo Tosatti
@ 2013-03-06 14:44   ` Jan Kiszka
  2013-03-07  0:36     ` Marcelo Tosatti
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Kiszka @ 2013-03-06 14:44 UTC (permalink / raw)
  To: Marcelo Tosatti
  Cc: Gleb Natapov, kvm, Nadav Har'El, Nakajima, Jun, Paolo Bonzini

Properly set those bits to 1 that the spec demands in case bit 55 of
VMX_BASIC is 0 - like in our case.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

Changes in v3:
 - rebase over queue

 arch/x86/include/asm/vmx.h |    4 ++++
 arch/x86/kvm/vmx.c         |   13 ++++++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h
index b6fbf86..5fb6e24 100644
--- a/arch/x86/include/asm/vmx.h
+++ b/arch/x86/include/asm/vmx.h
@@ -81,6 +81,8 @@
 #define VM_EXIT_LOAD_IA32_EFER                  0x00200000
 #define VM_EXIT_SAVE_VMX_PREEMPTION_TIMER       0x00400000
 
+#define VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR	0x00036dff
+
 #define VM_ENTRY_LOAD_DEBUG_CONTROLS            0x00000002
 #define VM_ENTRY_IA32E_MODE                     0x00000200
 #define VM_ENTRY_SMM                            0x00000400
@@ -89,6 +91,8 @@
 #define VM_ENTRY_LOAD_IA32_PAT			0x00004000
 #define VM_ENTRY_LOAD_IA32_EFER                 0x00008000
 
+#define VM_ENTRY_ALWAYSON_WITHOUT_TRUE_MSR	0x000011ff
+
 /* VMCS Encodings */
 enum vmcs_field {
 	VIRTUAL_PROCESSOR_ID            = 0x00000000,
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index aacf6a4..a9d8853 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -2049,21 +2049,28 @@ static __init void nested_vmx_setup_ctls_msrs(void)
 		PIN_BASED_EXT_INTR_MASK | PIN_BASED_NMI_EXITING |
 		PIN_BASED_VIRTUAL_NMIS;
 
-	/* exit controls */
-	nested_vmx_exit_ctls_low = 0;
+	/*
+	 * Exit controls
+	 * If bit 55 of VMX_BASIC is off, bits 0-8 and 10, 11, 13, 14, 16 and
+	 * 17 must be 1.
+	 */
+	nested_vmx_exit_ctls_low = VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR;
 	/* Note that guest use of VM_EXIT_ACK_INTR_ON_EXIT is not supported. */
 #ifdef CONFIG_X86_64
 	nested_vmx_exit_ctls_high = VM_EXIT_HOST_ADDR_SPACE_SIZE;
 #else
 	nested_vmx_exit_ctls_high = 0;
 #endif
+	nested_vmx_exit_ctls_high |= VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR;
 
 	/* entry controls */
 	rdmsr(MSR_IA32_VMX_ENTRY_CTLS,
 		nested_vmx_entry_ctls_low, nested_vmx_entry_ctls_high);
-	nested_vmx_entry_ctls_low = 0;
+	/* If bit 55 of VMX_BASIC is off, bits 0-8 and 12 must be 1. */
+	nested_vmx_entry_ctls_low = VM_ENTRY_ALWAYSON_WITHOUT_TRUE_MSR;
 	nested_vmx_entry_ctls_high &=
 		VM_ENTRY_LOAD_IA32_PAT | VM_ENTRY_IA32E_MODE;
+	nested_vmx_entry_ctls_high |= VM_ENTRY_ALWAYSON_WITHOUT_TRUE_MSR;
 
 	/* cpu-based controls */
 	rdmsr(MSR_IA32_VMX_PROCBASED_CTLS,
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v3] KVM: nVMX: Fix content of MSR_IA32_VMX_ENTRY/EXIT_CTLS
  2013-03-06 14:44   ` [PATCH v3] " Jan Kiszka
@ 2013-03-07  0:36     ` Marcelo Tosatti
  0 siblings, 0 replies; 5+ messages in thread
From: Marcelo Tosatti @ 2013-03-07  0:36 UTC (permalink / raw)
  To: Jan Kiszka
  Cc: Gleb Natapov, kvm, Nadav Har'El, Nakajima, Jun, Paolo Bonzini

On Wed, Mar 06, 2013 at 03:44:03PM +0100, Jan Kiszka wrote:
> Properly set those bits to 1 that the spec demands in case bit 55 of
> VMX_BASIC is 0 - like in our case.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
> 
> Changes in v3:
>  - rebase over queue
> 
>  arch/x86/include/asm/vmx.h |    4 ++++
>  arch/x86/kvm/vmx.c         |   13 ++++++++++---
>  2 files changed, 14 insertions(+), 3 deletions(-)

Applied, thanks.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-03-07  0:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-04 16:15 [PATCH v2] KVM: nVMX: Fix content of MSR_IA32_VMX_ENTRY/EXIT_CTLS Jan Kiszka
2013-03-04 16:33 ` Paolo Bonzini
2013-03-06  0:10 ` Marcelo Tosatti
2013-03-06 14:44   ` [PATCH v3] " Jan Kiszka
2013-03-07  0:36     ` Marcelo Tosatti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox