diff mbox

KVM: vmx: rename KVM_GUEST_CR0_MASK tp KVM_VM_CR0_ALWAYS_OFF

Message ID 20180713154230.1695-1-sean.j.christopherson@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Sean Christopherson July 13, 2018, 3:42 p.m. UTC
The KVM_GUEST_CR0_MASK macro tracks CR0 bits that are forced to zero
by the VMX architecture, i.e. CR0.{NW,CD} must always be zero in the
hardware CR0 post-VMXON.  Rename the macro to clarify its purpose,
be consistent with KVM_VM_CR0_ALWAYS_ON and avoid confusion with the
CR0_GUEST_HOST_MASK field.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
 arch/x86/kvm/vmx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Sean Christopherson Aug. 30, 2018, 2:21 p.m. UTC | #1
Ping.

On Fri, 2018-07-13 at 08:42 -0700, Sean Christopherson wrote:
> The KVM_GUEST_CR0_MASK macro tracks CR0 bits that are forced to zero
> by the VMX architecture, i.e. CR0.{NW,CD} must always be zero in the
> hardware CR0 post-VMXON.  Rename the macro to clarify its purpose,
> be consistent with KVM_VM_CR0_ALWAYS_ON and avoid confusion with the
> CR0_GUEST_HOST_MASK field.
> 
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> ---
>  arch/x86/kvm/vmx.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 1689f433f3a0..d7dbba7a61c6 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -131,7 +131,7 @@ static bool __read_mostly enable_preemption_timer = 1;
>  module_param_named(preemption_timer, enable_preemption_timer, bool, S_IRUGO);
>  #endif
>  
> -#define KVM_GUEST_CR0_MASK (X86_CR0_NW | X86_CR0_CD)
> +#define KVM_VM_CR0_ALWAYS_OFF (X86_CR0_NW | X86_CR0_CD)
>  #define KVM_VM_CR0_ALWAYS_ON_UNRESTRICTED_GUEST X86_CR0_NE
>  #define KVM_VM_CR0_ALWAYS_ON				\
>  	(KVM_VM_CR0_ALWAYS_ON_UNRESTRICTED_GUEST | 	\
> @@ -4904,7 +4904,7 @@ static void vmx_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0)
>  	struct vcpu_vmx *vmx = to_vmx(vcpu);
>  	unsigned long hw_cr0;
>  
> -	hw_cr0 = (cr0 & ~KVM_GUEST_CR0_MASK);
> +	hw_cr0 = (cr0 & ~KVM_VM_CR0_ALWAYS_OFF);
>  	if (enable_unrestricted_guest)
>  		hw_cr0 |= KVM_VM_CR0_ALWAYS_ON_UNRESTRICTED_GUEST;
>  	else {
Jim Mattson Aug. 30, 2018, 4:11 p.m. UTC | #2
On Thu, Aug 30, 2018 at 7:21 AM, Sean Christopherson
<sean.j.christopherson@intel.com> wrote:
> Ping.
>
> On Fri, 2018-07-13 at 08:42 -0700, Sean Christopherson wrote:
>> The KVM_GUEST_CR0_MASK macro tracks CR0 bits that are forced to zero
>> by the VMX architecture, i.e. CR0.{NW,CD} must always be zero in the
>> hardware CR0 post-VMXON.  Rename the macro to clarify its purpose,
>> be consistent with KVM_VM_CR0_ALWAYS_ON and avoid confusion with the
>> CR0_GUEST_HOST_MASK field.
>>
>> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>

Reviewed-by: Jim Mattson <jmattson@google.com>
Paolo Bonzini Oct. 1, 2018, 12:50 p.m. UTC | #3
On 13/07/2018 17:42, Sean Christopherson wrote:
> The KVM_GUEST_CR0_MASK macro tracks CR0 bits that are forced to zero
> by the VMX architecture, i.e. CR0.{NW,CD} must always be zero in the
> hardware CR0 post-VMXON.  Rename the macro to clarify its purpose,
> be consistent with KVM_VM_CR0_ALWAYS_ON and avoid confusion with the
> CR0_GUEST_HOST_MASK field.
> 
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> ---
>  arch/x86/kvm/vmx.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 1689f433f3a0..d7dbba7a61c6 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -131,7 +131,7 @@ static bool __read_mostly enable_preemption_timer = 1;
>  module_param_named(preemption_timer, enable_preemption_timer, bool, S_IRUGO);
>  #endif
>  
> -#define KVM_GUEST_CR0_MASK (X86_CR0_NW | X86_CR0_CD)
> +#define KVM_VM_CR0_ALWAYS_OFF (X86_CR0_NW | X86_CR0_CD)
>  #define KVM_VM_CR0_ALWAYS_ON_UNRESTRICTED_GUEST X86_CR0_NE
>  #define KVM_VM_CR0_ALWAYS_ON				\
>  	(KVM_VM_CR0_ALWAYS_ON_UNRESTRICTED_GUEST | 	\
> @@ -4904,7 +4904,7 @@ static void vmx_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0)
>  	struct vcpu_vmx *vmx = to_vmx(vcpu);
>  	unsigned long hw_cr0;
>  
> -	hw_cr0 = (cr0 & ~KVM_GUEST_CR0_MASK);
> +	hw_cr0 = (cr0 & ~KVM_VM_CR0_ALWAYS_OFF);
>  	if (enable_unrestricted_guest)
>  		hw_cr0 |= KVM_VM_CR0_ALWAYS_ON_UNRESTRICTED_GUEST;
>  	else {
> 

Queued now, thanks!

Paolo
diff mbox

Patch

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 1689f433f3a0..d7dbba7a61c6 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -131,7 +131,7 @@  static bool __read_mostly enable_preemption_timer = 1;
 module_param_named(preemption_timer, enable_preemption_timer, bool, S_IRUGO);
 #endif
 
-#define KVM_GUEST_CR0_MASK (X86_CR0_NW | X86_CR0_CD)
+#define KVM_VM_CR0_ALWAYS_OFF (X86_CR0_NW | X86_CR0_CD)
 #define KVM_VM_CR0_ALWAYS_ON_UNRESTRICTED_GUEST X86_CR0_NE
 #define KVM_VM_CR0_ALWAYS_ON				\
 	(KVM_VM_CR0_ALWAYS_ON_UNRESTRICTED_GUEST | 	\
@@ -4904,7 +4904,7 @@  static void vmx_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0)
 	struct vcpu_vmx *vmx = to_vmx(vcpu);
 	unsigned long hw_cr0;
 
-	hw_cr0 = (cr0 & ~KVM_GUEST_CR0_MASK);
+	hw_cr0 = (cr0 & ~KVM_VM_CR0_ALWAYS_OFF);
 	if (enable_unrestricted_guest)
 		hw_cr0 |= KVM_VM_CR0_ALWAYS_ON_UNRESTRICTED_GUEST;
 	else {