linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: VMX: use vmcs_clear/set_bits for debug register exits
@ 2016-02-26 11:55 Paolo Bonzini
  2016-02-26 12:04 ` Xiao Guangrong
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2016-02-26 11:55 UTC (permalink / raw)
  To: linux-kernel, kvm; +Cc: guangrong.xiao

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 arch/x86/kvm/vmx.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index aa16d5874fe6..46154dac71e6 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -5619,11 +5619,8 @@ static int handle_dr(struct kvm_vcpu *vcpu)
 	}
 
 	if (vcpu->guest_debug == 0) {
-		u32 cpu_based_vm_exec_control;
-
-		cpu_based_vm_exec_control = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL);
-		cpu_based_vm_exec_control &= ~CPU_BASED_MOV_DR_EXITING;
-		vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control);
+		vmcs_clear_bits(CPU_BASED_VM_EXEC_CONTROL,
+				CPU_BASED_MOV_DR_EXITING);
 
 		/*
 		 * No more DR vmexits; force a reload of the debug registers
@@ -5660,8 +5657,6 @@ static void vmx_set_dr6(struct kvm_vcpu *vcpu, unsigned long val)
 
 static void vmx_sync_dirty_debug_regs(struct kvm_vcpu *vcpu)
 {
-	u32 cpu_based_vm_exec_control;
-
 	get_debugreg(vcpu->arch.db[0], 0);
 	get_debugreg(vcpu->arch.db[1], 1);
 	get_debugreg(vcpu->arch.db[2], 2);
@@ -5670,10 +5665,7 @@ static void vmx_sync_dirty_debug_regs(struct kvm_vcpu *vcpu)
 	vcpu->arch.dr7 = vmcs_readl(GUEST_DR7);
 
 	vcpu->arch.switch_db_regs &= ~KVM_DEBUGREG_WONT_EXIT;
-
-	cpu_based_vm_exec_control = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL);
-	cpu_based_vm_exec_control |= CPU_BASED_MOV_DR_EXITING;
-	vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control);
+	vmcs_set_bits(CPU_BASED_VM_EXEC_CONTROL, CPU_BASED_MOV_DR_EXITING);
 }
 
 static void vmx_set_dr7(struct kvm_vcpu *vcpu, unsigned long val)
-- 
1.8.3.1

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

* Re: [PATCH] KVM: VMX: use vmcs_clear/set_bits for debug register exits
  2016-02-26 11:55 [PATCH] KVM: VMX: use vmcs_clear/set_bits for debug register exits Paolo Bonzini
@ 2016-02-26 12:04 ` Xiao Guangrong
  0 siblings, 0 replies; 2+ messages in thread
From: Xiao Guangrong @ 2016-02-26 12:04 UTC (permalink / raw)
  To: Paolo Bonzini, linux-kernel, kvm



On 02/26/2016 07:55 PM, Paolo Bonzini wrote:
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   arch/x86/kvm/vmx.c | 14 +++-----------
>   1 file changed, 3 insertions(+), 11 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index aa16d5874fe6..46154dac71e6 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -5619,11 +5619,8 @@ static int handle_dr(struct kvm_vcpu *vcpu)
>   	}
>
>   	if (vcpu->guest_debug == 0) {
> -		u32 cpu_based_vm_exec_control;
> -
> -		cpu_based_vm_exec_control = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL);
> -		cpu_based_vm_exec_control &= ~CPU_BASED_MOV_DR_EXITING;
> -		vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control);
> +		vmcs_clear_bits(CPU_BASED_VM_EXEC_CONTROL,
> +				CPU_BASED_MOV_DR_EXITING);
>
>   		/*
>   		 * No more DR vmexits; force a reload of the debug registers
> @@ -5660,8 +5657,6 @@ static void vmx_set_dr6(struct kvm_vcpu *vcpu, unsigned long val)
>
>   static void vmx_sync_dirty_debug_regs(struct kvm_vcpu *vcpu)
>   {
> -	u32 cpu_based_vm_exec_control;
> -
>   	get_debugreg(vcpu->arch.db[0], 0);
>   	get_debugreg(vcpu->arch.db[1], 1);
>   	get_debugreg(vcpu->arch.db[2], 2);
> @@ -5670,10 +5665,7 @@ static void vmx_sync_dirty_debug_regs(struct kvm_vcpu *vcpu)
>   	vcpu->arch.dr7 = vmcs_readl(GUEST_DR7);
>
>   	vcpu->arch.switch_db_regs &= ~KVM_DEBUGREG_WONT_EXIT;
> -
> -	cpu_based_vm_exec_control = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL);
> -	cpu_based_vm_exec_control |= CPU_BASED_MOV_DR_EXITING;
> -	vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control);
> +	vmcs_set_bits(CPU_BASED_VM_EXEC_CONTROL, CPU_BASED_MOV_DR_EXITING);
>   }
>
>   static void vmx_set_dr7(struct kvm_vcpu *vcpu, unsigned long val)
>

Reviewed-by: Xiao Guangrong <guangrong.xiao@linux.intel.com>

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

end of thread, other threads:[~2016-02-26 12:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-26 11:55 [PATCH] KVM: VMX: use vmcs_clear/set_bits for debug register exits Paolo Bonzini
2016-02-26 12:04 ` Xiao Guangrong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).