diff mbox

kvm: x86: fix x86 eflags fixed bit

Message ID 1428473294-6633-1-git-send-email-wanpeng.li@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wanpeng Li April 8, 2015, 6:08 a.m. UTC
Guest can't be booted w/ ept=0, there is a message dumped as below:

If you're running a guest on an Intel machine without unrestricted mode
support, the failure can be most likely due to the guest entering an invalid
state for Intel VT. For example, the guest maybe running in big real mode
which is not supported on less recent Intel processors.

EAX=00000011 EBX=f000d2f6 ECX=00006cac EDX=000f8956
ESI=bffbdf62 EDI=00000000 EBP=00006c68 ESP=00006c68
EIP=0000d187 EFL=00000004 [-----P-] CPL=0 II=0 A20=1 SMM=0 HLT=0
ES =e000 000e0000 ffffffff 00809300 DPL=0 DS16 [-WA]
CS =f000 000f0000 ffffffff 00809b00 DPL=0 CS16 [-RA]
SS =0000 00000000 ffffffff 00809300 DPL=0 DS16 [-WA]
DS =0000 00000000 ffffffff 00809300 DPL=0 DS16 [-WA]
FS =0000 00000000 ffffffff 00809300 DPL=0 DS16 [-WA]
GS =0000 00000000 ffffffff 00809300 DPL=0 DS16 [-WA]
LDT=0000 00000000 0000ffff 00008200 DPL=0 LDT
TR =0000 00000000 0000ffff 00008b00 DPL=0 TSS32-busy
GDT=     000f6a80 00000037
IDT=     000f6abe 00000000
CR0=00000011 CR2=00000000 CR3=00000000 CR4=00000000
DR0=0000000000000000 DR1=0000000000000000 DR2=0000000000000000 DR3=0000000000000000 
DR6=00000000ffff0ff0 DR7=0000000000000400
EFER=0000000000000000
Code=01 1e b8 6a 2e 0f 01 16 74 6a 0f 20 c0 66 83 c8 01 0f 22 c0 <66> ea 8f d1 0f 00 08 00 b8 10 00 00 00 8e d8 8e c0 8e d0 8e e0 8e e8 89 c8 ff e2 89 c1 b8X

X86 eflags bit 1 is fixed set, which means that 1 << 1 is set instead of 1, 
this patch fix it.

Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
---
 arch/x86/kvm/emulate.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

Comments

Nadav Amit April 8, 2015, 8:21 a.m. UTC | #1
Sorry for that - fixes 0efb04406de834d820f7ba150a00d1d3194aa8a6 ("KVM: x86:
removing redundant eflags bits definitions”).

Nadav

Wanpeng Li <wanpeng.li@linux.intel.com> wrote:

> Guest can't be booted w/ ept=0, there is a message dumped as below:
> 
> If you're running a guest on an Intel machine without unrestricted mode
> support, the failure can be most likely due to the guest entering an invalid
> state for Intel VT. For example, the guest maybe running in big real mode
> which is not supported on less recent Intel processors.
> 
> EAX=00000011 EBX=f000d2f6 ECX=00006cac EDX=000f8956
> ESI=bffbdf62 EDI=00000000 EBP=00006c68 ESP=00006c68
> EIP=0000d187 EFL=00000004 [-----P-] CPL=0 II=0 A20=1 SMM=0 HLT=0
> ES =e000 000e0000 ffffffff 00809300 DPL=0 DS16 [-WA]
> CS =f000 000f0000 ffffffff 00809b00 DPL=0 CS16 [-RA]
> SS =0000 00000000 ffffffff 00809300 DPL=0 DS16 [-WA]
> DS =0000 00000000 ffffffff 00809300 DPL=0 DS16 [-WA]
> FS =0000 00000000 ffffffff 00809300 DPL=0 DS16 [-WA]
> GS =0000 00000000 ffffffff 00809300 DPL=0 DS16 [-WA]
> LDT=0000 00000000 0000ffff 00008200 DPL=0 LDT
> TR =0000 00000000 0000ffff 00008b00 DPL=0 TSS32-busy
> GDT=     000f6a80 00000037
> IDT=     000f6abe 00000000
> CR0=00000011 CR2=00000000 CR3=00000000 CR4=00000000
> DR0=0000000000000000 DR1=0000000000000000 DR2=0000000000000000 DR3=0000000000000000 
> DR6=00000000ffff0ff0 DR7=0000000000000400
> EFER=0000000000000000
> Code=01 1e b8 6a 2e 0f 01 16 74 6a 0f 20 c0 66 83 c8 01 0f 22 c0 <66> ea 8f d1 0f 00 08 00 b8 10 00 00 00 8e d8 8e c0 8e d0 8e e0 8e e8 89 c8 ff e2 89 c1 b8X
> 
> X86 eflags bit 1 is fixed set, which means that 1 << 1 is set instead of 1, 
> this patch fix it.
> 
> Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
> ---
> arch/x86/kvm/emulate.c |    6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index b304728..630bcb0 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -2033,7 +2033,7 @@ static int emulate_iret_real(struct x86_emulate_ctxt *ctxt)
> 			     X86_EFLAGS_IF | X86_EFLAGS_DF | X86_EFLAGS_OF |
> 			     X86_EFLAGS_IOPL | X86_EFLAGS_NT | X86_EFLAGS_RF |
> 			     X86_EFLAGS_AC | X86_EFLAGS_ID |
> -			     X86_EFLAGS_FIXED_BIT;
> +			     X86_EFLAGS_FIXED;
> 	unsigned long vm86_mask = X86_EFLAGS_VM | X86_EFLAGS_VIF |
> 				  X86_EFLAGS_VIP;
> 
> @@ -2072,7 +2072,7 @@ static int emulate_iret_real(struct x86_emulate_ctxt *ctxt)
> 	}
> 
> 	ctxt->eflags &= ~EFLG_RESERVED_ZEROS_MASK; /* Clear reserved zeros */
> -	ctxt->eflags |= X86_EFLAGS_FIXED_BIT;
> +	ctxt->eflags |= X86_EFLAGS_FIXED;
> 	ctxt->ops->set_nmi_mask(ctxt, false);
> 
> 	return rc;
> @@ -2390,7 +2390,7 @@ static int em_syscall(struct x86_emulate_ctxt *ctxt)
> 
> 		ops->get_msr(ctxt, MSR_SYSCALL_MASK, &msr_data);
> 		ctxt->eflags &= ~msr_data;
> -		ctxt->eflags |= X86_EFLAGS_FIXED_BIT;
> +		ctxt->eflags |= X86_EFLAGS_FIXED;
> #endif
> 	} else {
> 		/* legacy mode */
> -- 
> 1.7.1
> 
> --
> 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


--
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
Paolo Bonzini April 8, 2015, 8:47 a.m. UTC | #2
On 08/04/2015 08:08, Wanpeng Li wrote:
> Guest can't be booted w/ ept=0, there is a message dumped as below:
> 
> If you're running a guest on an Intel machine without unrestricted mode
> support, the failure can be most likely due to the guest entering an invalid
> state for Intel VT. For example, the guest maybe running in big real mode
> which is not supported on less recent Intel processors.
> 
> EAX=00000011 EBX=f000d2f6 ECX=00006cac EDX=000f8956
> ESI=bffbdf62 EDI=00000000 EBP=00006c68 ESP=00006c68
> EIP=0000d187 EFL=00000004 [-----P-] CPL=0 II=0 A20=1 SMM=0 HLT=0
> ES =e000 000e0000 ffffffff 00809300 DPL=0 DS16 [-WA]
> CS =f000 000f0000 ffffffff 00809b00 DPL=0 CS16 [-RA]
> SS =0000 00000000 ffffffff 00809300 DPL=0 DS16 [-WA]
> DS =0000 00000000 ffffffff 00809300 DPL=0 DS16 [-WA]
> FS =0000 00000000 ffffffff 00809300 DPL=0 DS16 [-WA]
> GS =0000 00000000 ffffffff 00809300 DPL=0 DS16 [-WA]
> LDT=0000 00000000 0000ffff 00008200 DPL=0 LDT
> TR =0000 00000000 0000ffff 00008b00 DPL=0 TSS32-busy
> GDT=     000f6a80 00000037
> IDT=     000f6abe 00000000
> CR0=00000011 CR2=00000000 CR3=00000000 CR4=00000000
> DR0=0000000000000000 DR1=0000000000000000 DR2=0000000000000000 DR3=0000000000000000 
> DR6=00000000ffff0ff0 DR7=0000000000000400
> EFER=0000000000000000
> Code=01 1e b8 6a 2e 0f 01 16 74 6a 0f 20 c0 66 83 c8 01 0f 22 c0 <66> ea 8f d1 0f 00 08 00 b8 10 00 00 00 8e d8 8e c0 8e d0 8e e0 8e e8 89 c8 ff e2 89 c1 b8X
> 
> X86 eflags bit 1 is fixed set, which means that 1 << 1 is set instead of 1, 
> this patch fix it.
> 
> Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
> ---
>  arch/x86/kvm/emulate.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index b304728..630bcb0 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -2033,7 +2033,7 @@ static int emulate_iret_real(struct x86_emulate_ctxt *ctxt)
>  			     X86_EFLAGS_IF | X86_EFLAGS_DF | X86_EFLAGS_OF |
>  			     X86_EFLAGS_IOPL | X86_EFLAGS_NT | X86_EFLAGS_RF |
>  			     X86_EFLAGS_AC | X86_EFLAGS_ID |
> -			     X86_EFLAGS_FIXED_BIT;
> +			     X86_EFLAGS_FIXED;
>  	unsigned long vm86_mask = X86_EFLAGS_VM | X86_EFLAGS_VIF |
>  				  X86_EFLAGS_VIP;
>  
> @@ -2072,7 +2072,7 @@ static int emulate_iret_real(struct x86_emulate_ctxt *ctxt)
>  	}
>  
>  	ctxt->eflags &= ~EFLG_RESERVED_ZEROS_MASK; /* Clear reserved zeros */
> -	ctxt->eflags |= X86_EFLAGS_FIXED_BIT;
> +	ctxt->eflags |= X86_EFLAGS_FIXED;
>  	ctxt->ops->set_nmi_mask(ctxt, false);
>  
>  	return rc;
> @@ -2390,7 +2390,7 @@ static int em_syscall(struct x86_emulate_ctxt *ctxt)
>  
>  		ops->get_msr(ctxt, MSR_SYSCALL_MASK, &msr_data);
>  		ctxt->eflags &= ~msr_data;
> -		ctxt->eflags |= X86_EFLAGS_FIXED_BIT;
> +		ctxt->eflags |= X86_EFLAGS_FIXED;
>  #endif
>  	} else {
>  		/* legacy mode */
> 

Thanks Wanpeng.  Applied.

Paolo
--
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
diff mbox

Patch

diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index b304728..630bcb0 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -2033,7 +2033,7 @@  static int emulate_iret_real(struct x86_emulate_ctxt *ctxt)
 			     X86_EFLAGS_IF | X86_EFLAGS_DF | X86_EFLAGS_OF |
 			     X86_EFLAGS_IOPL | X86_EFLAGS_NT | X86_EFLAGS_RF |
 			     X86_EFLAGS_AC | X86_EFLAGS_ID |
-			     X86_EFLAGS_FIXED_BIT;
+			     X86_EFLAGS_FIXED;
 	unsigned long vm86_mask = X86_EFLAGS_VM | X86_EFLAGS_VIF |
 				  X86_EFLAGS_VIP;
 
@@ -2072,7 +2072,7 @@  static int emulate_iret_real(struct x86_emulate_ctxt *ctxt)
 	}
 
 	ctxt->eflags &= ~EFLG_RESERVED_ZEROS_MASK; /* Clear reserved zeros */
-	ctxt->eflags |= X86_EFLAGS_FIXED_BIT;
+	ctxt->eflags |= X86_EFLAGS_FIXED;
 	ctxt->ops->set_nmi_mask(ctxt, false);
 
 	return rc;
@@ -2390,7 +2390,7 @@  static int em_syscall(struct x86_emulate_ctxt *ctxt)
 
 		ops->get_msr(ctxt, MSR_SYSCALL_MASK, &msr_data);
 		ctxt->eflags &= ~msr_data;
-		ctxt->eflags |= X86_EFLAGS_FIXED_BIT;
+		ctxt->eflags |= X86_EFLAGS_FIXED;
 #endif
 	} else {
 		/* legacy mode */