From: linmiaohe <linmiaohe@huawei.com>
To: <pbonzini@redhat.com>, <rkrcmar@redhat.com>,
<sean.j.christopherson@intel.com>, <vkuznets@redhat.com>,
<jmattson@google.com>, <joro@8bytes.org>, <tglx@linutronix.de>,
<mingo@redhat.com>, <bp@alien8.de>, <hpa@zytor.com>
Cc: <linmiaohe@huawei.com>, <kvm@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <x86@kernel.org>
Subject: [PATCH] KVM: VMX: Use wrapper macro ~RMODE_GUEST_OWNED_EFLAGS_BITS directly
Date: Thu, 5 Mar 2020 10:35:31 +0800 [thread overview]
Message-ID: <1583375731-18219-1-git-send-email-linmiaohe@huawei.com> (raw)
From: Miaohe Lin <linmiaohe@huawei.com>
(X86_EFLAGS_IOPL | X86_EFLAGS_VM) indicates the eflag bits that can not be
owned by realmode guest, i.e. ~RMODE_GUEST_OWNED_EFLAGS_BITS. Use wrapper
macro directly to make it clear and also improve readability.
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
arch/x86/kvm/vmx/vmx.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index 743b81642ce2..9571f8dea016 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -1466,7 +1466,7 @@ void vmx_set_rflags(struct kvm_vcpu *vcpu, unsigned long rflags)
vmx->rflags = rflags;
if (vmx->rmode.vm86_active) {
vmx->rmode.save_rflags = rflags;
- rflags |= X86_EFLAGS_IOPL | X86_EFLAGS_VM;
+ rflags |= ~RMODE_GUEST_OWNED_EFLAGS_BITS;
}
vmcs_writel(GUEST_RFLAGS, rflags);
@@ -2797,7 +2797,7 @@ static void enter_rmode(struct kvm_vcpu *vcpu)
flags = vmcs_readl(GUEST_RFLAGS);
vmx->rmode.save_rflags = flags;
- flags |= X86_EFLAGS_IOPL | X86_EFLAGS_VM;
+ flags |= ~RMODE_GUEST_OWNED_EFLAGS_BITS;
vmcs_writel(GUEST_RFLAGS, flags);
vmcs_writel(GUEST_CR4, vmcs_readl(GUEST_CR4) | X86_CR4_VME);
--
2.19.1
next reply other threads:[~2020-03-05 2:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-05 2:35 linmiaohe [this message]
2020-03-05 10:08 ` Vitaly Kuznetsov
2020-03-05 11:49 ` Paolo Bonzini
2020-03-06 2:11 linmiaohe
2020-03-06 2:17 linmiaohe
2020-03-06 5:32 ` Paolo Bonzini
2020-03-06 9:44 ` Vitaly Kuznetsov
2020-03-06 10:00 ` Paolo Bonzini
2020-03-06 10:15 ` Vitaly Kuznetsov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1583375731-18219-1-git-send-email-linmiaohe@huawei.com \
--to=linmiaohe@huawei.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=sean.j.christopherson@intel.com \
--cc=tglx@linutronix.de \
--cc=vkuznets@redhat.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®