From patchwork Tue Nov 3 11:40:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wanpeng Li X-Patchwork-Id: 7541971 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 55367BF90C for ; Tue, 3 Nov 2015 11:41:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D32FD20546 for ; Tue, 3 Nov 2015 11:41:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0048B2052A for ; Tue, 3 Nov 2015 11:41:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751394AbbKCLlJ (ORCPT ); Tue, 3 Nov 2015 06:41:09 -0500 Received: from blu004-omc1s9.hotmail.com ([65.55.116.20]:62587 "EHLO BLU004-OMC1S9.hotmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750887AbbKCLlI (ORCPT ); Tue, 3 Nov 2015 06:41:08 -0500 Received: from BLU437-SMTP23 ([65.55.116.7]) by BLU004-OMC1S9.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Tue, 3 Nov 2015 03:41:06 -0800 X-TMN: [SH4eBmtyDLK1peiWh2wTkyrgPaI2BC7n] X-Originating-Email: [wanpeng.li@hotmail.com] Message-ID: From: Wanpeng Li To: Paolo Bonzini CC: Nadav Amit , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Wanpeng Li Subject: [PATCH v2] KVM: x86: Reset RFLAGS state following processor init/reset Date: Tue, 3 Nov 2015 19:40:20 +0800 X-Mailer: git-send-email 1.9.1 X-OriginalArrivalTime: 03 Nov 2015 11:41:04.0727 (UTC) FILETIME=[85A8F670:01D1162C] MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Reference SDM Volume 1 3.4.3: Following initialization of the processor (either by asserting the RESET pin or the INIT pin), the state of the EFLAGS register is 00000002H. However, the eflags fixed bit is not set and other bits are also not cleared during the init/reset in kvm. This patch reset eflags register to 00000002H following initialization of the processor. Signed-off-by: Wanpeng Li --- v1 -> v2: * use vmcs_writel arch/x86/kvm/vmx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index b680c2e..1a95ef7 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -4935,6 +4935,7 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event) vmx_set_efer(vcpu, 0); vmx_fpu_activate(vcpu); update_exception_bitmap(vcpu); + vmcs_writel(GUEST_RFLAGS, X86_EFLAGS_FIXED); vpid_sync_context(vmx->vpid); }