Re: [Xen-devel] [PATCH 1/3] x86/vmx: Misc cleanup to vmx_update_guest_cr()

2017-10-09 Thread Tian, Kevin
> From: Andrew Cooper [mailto:andrew.coop...@citrix.com]
> Sent: Saturday, September 30, 2017 2:31 AM
> 
>  * Drop trailing whitespace
>  * Fix indendation and newlines
>  * Use bool where appropriate
> 
> No functional change.
> 
> Signed-off-by: Andrew Cooper 

Acked-by: Kevin Tian 

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH 1/3] x86/vmx: Misc cleanup to vmx_update_guest_cr()

2017-10-03 Thread Roger Pau Monné
On Fri, Sep 29, 2017 at 06:31:01PM +, Andrew Cooper wrote:
>  * Drop trailing whitespace
>  * Fix indendation and newlines
>  * Use bool where appropriate
> 
> No functional change.
> 
> Signed-off-by: Andrew Cooper 

Reviewed-by: Roger Pau Monné 

Thanks, Roger.

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH 1/3] x86/vmx: Misc cleanup to vmx_update_guest_cr()

2017-09-29 Thread Andrew Cooper
 * Drop trailing whitespace
 * Fix indendation and newlines
 * Use bool where appropriate

No functional change.

Signed-off-by: Andrew Cooper 
---
CC: Jan Beulich 
CC: Jun Nakajima 
CC: Kevin Tian 
---
 xen/arch/x86/hvm/vmx/vmx.c | 25 +++--
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 9cfa9b6..61047e0 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -1547,15 +1547,16 @@ static void vmx_update_guest_cr(struct vcpu *v, 
unsigned int cr)
 
 switch ( cr )
 {
-case 0: {
-int realmode;
+case 0:
+{
+bool realmode;
 unsigned long hw_cr0_mask = X86_CR0_NE;
 
 if ( !vmx_unrestricted_guest(v) )
 hw_cr0_mask |= X86_CR0_PG | X86_CR0_PE;
 
 if ( paging_mode_shadow(v->domain) )
-   hw_cr0_mask |= X86_CR0_WP;
+hw_cr0_mask |= X86_CR0_WP;
 
 if ( paging_mode_hap(v->domain) )
 {
@@ -1590,12 +1591,12 @@ static void vmx_update_guest_cr(struct vcpu *v, 
unsigned int cr)
 vmx_fpu_enter(v);
 }
 
-realmode = !(v->arch.hvm_vcpu.guest_cr[0] & X86_CR0_PE); 
+realmode = !(v->arch.hvm_vcpu.guest_cr[0] & X86_CR0_PE);
 
-if ( (!vmx_unrestricted_guest(v)) &&
+if ( !vmx_unrestricted_guest(v) &&
  (realmode != v->arch.hvm_vmx.vmx_realmode) )
 {
-enum x86_segment s; 
+enum x86_segment s;
 struct segment_register reg[x86_seg_tr + 1];
 
 BUILD_BUG_ON(x86_seg_tr != x86_seg_gs + 1);
@@ -1606,13 +1607,13 @@ static void vmx_update_guest_cr(struct vcpu *v, 
unsigned int cr)
 for ( s = 0; s < ARRAY_SIZE(reg); s++ )
 hvm_get_segment_register(v, s, [s]);
 v->arch.hvm_vmx.vmx_realmode = realmode;
-
+
 if ( realmode )
 {
 for ( s = 0; s < ARRAY_SIZE(reg); s++ )
 hvm_set_segment_register(v, s, [s]);
 }
-else 
+else
 {
 for ( s = 0; s < ARRAY_SIZE(reg); s++ )
 if ( !(v->arch.hvm_vmx.vm86_segment_mask & (1<domain) )
 {
@@ -1642,10 +1645,11 @@ static void vmx_update_guest_cr(struct vcpu *v, 
unsigned int cr)
 v->domain->arch.hvm_domain.params[HVM_PARAM_IDENT_PT];
 vmx_load_pdptrs(v);
 }
- 
+
 __vmwrite(GUEST_CR3, v->arch.hvm_vcpu.hw_cr[3]);
 hvm_asid_flush_vcpu(v);
 break;
+
 case 4:
 v->arch.hvm_vcpu.hw_cr[4] = HVM_CR4_HOST_MASK;
 if ( paging_mode_hap(v->domain) )
@@ -1657,7 +1661,7 @@ static void vmx_update_guest_cr(struct vcpu *v, unsigned 
int cr)
 nvmx_set_cr_read_shadow(v, 4);
 
 v->arch.hvm_vcpu.hw_cr[4] |= v->arch.hvm_vcpu.guest_cr[4];
-if ( v->arch.hvm_vmx.vmx_realmode ) 
+if ( v->arch.hvm_vmx.vmx_realmode )
 v->arch.hvm_vcpu.hw_cr[4] |= X86_CR4_VME;
 if ( paging_mode_hap(v->domain) && !hvm_paging_enabled(v) )
 {
@@ -1676,6 +1680,7 @@ static void vmx_update_guest_cr(struct vcpu *v, unsigned 
int cr)
 }
 __vmwrite(GUEST_CR4, v->arch.hvm_vcpu.hw_cr[4]);
 break;
+
 default:
 BUG();
 }
-- 
2.1.4


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel