From: Paolo Bonzini <pbonzini@redhat.com>
To: speck@linutronix.de
Subject: [MODERATED] Re: ***UNCHECKED*** Re: Re: [PATCH v7 3/5] NX 3
Date: Thu, 31 Oct 2019 12:02:48 +0100 [thread overview]
Message-ID: <ae13119c-4f41-d8c9-e06f-217d9a8e1975@redhat.com> (raw)
In-Reply-To: <20191029203353.GA10372@u1904>
[-- Attachment #1: Type: text/plain, Size: 2296 bytes --]
On 29/10/19 21:33, speck for mark gross wrote:
> On Fri, Oct 25, 2019 at 12:39:58PM +0200, speck for Paolo Bonzini wrote:
>> On 25/10/19 11:45, speck for Joerg Roedel wrote:
>>> On Fri, Oct 25, 2019 at 11:08:25AM +0200, speck for Paolo Bonzini wrote:
>>>> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
>>>> index e7970a2e8eae..8979d5e7b6f5 100644
>>>> --- a/arch/x86/kvm/vmx/vmx.c
>>>> +++ b/arch/x86/kvm/vmx/vmx.c
>>>> @@ -969,17 +969,9 @@ static bool update_transition_efer(struct vcpu_vmx *vmx, int efer_offset)
>>>> u64 guest_efer = vmx->vcpu.arch.efer;
>>>> u64 ignore_bits = 0;
>>>>
>>>> - if (!enable_ept) {
>>>> - /*
>>>> - * NX is needed to handle CR0.WP=1, CR4.SMEP=1. Testing
>>>> - * host CPUID is more efficient than testing guest CPUID
>>>> - * or CR4. Host SMEP is anyway a requirement for guest SMEP.
>>>> - */
>>>> - if (boot_cpu_has(X86_FEATURE_SMEP))
>>>> - guest_efer |= EFER_NX;
>>>> - else if (!(guest_efer & EFER_NX))
>>>> - ignore_bits |= EFER_NX;
>>>> - }
>>>> + /* Shadow paging assumes the NX bit to be available. */
>>>> + if (!enable_ept)
>>>> + guest_efer |= EFER_NX;
>>>>
>>>> /*
>>>> * LMA and LME handled by hardware; SCE meaningless outside long mode.
>>>
>>> Works with ept on and off, thanks.
>>
>> Thanks, I'll include also the AMD version in a new patch and send it out as v8:
>>
>> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
>> index 4153ca8cddb7..29feb3ecc91c 100644
>> --- a/arch/x86/kvm/svm.c
>> +++ b/arch/x86/kvm/svm.c
>> @@ -739,8 +739,12 @@ static int get_npt_level(struct kvm_vcpu *vcpu)
>> static void svm_set_efer(struct kvm_vcpu *vcpu, u64 efer)
>> {
>> vcpu->arch.efer = efer;
>> - if (!npt_enabled && !(efer & EFER_LMA))
>> - efer &= ~EFER_LME;
>> + if (!npt_enabled) {
>> + /* Shadow paging assumes the NX bit to be available. */
>> + efer |= EFER_NXE;
> ^EFER_NX ?
Yes, see message id 20191027152323.24326-1-pbonzini@redhat.com on
kvm@vger.kernel.org; I am about to send it to Linus.
Paolo
>
>> + if (!(efer & EFER_LMA))
>> + efer &= ~EFER_LME;
>> + }
>>
>> to_svm(vcpu)->vmcb->save.efer = efer | EFER_SVME;
>> mark_dirty(to_svm(vcpu)->vmcb, VMCB_CR);
>>
>> Paolo
>>
>
next prev parent reply other threads:[~2019-10-31 11:02 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-24 16:34 [MODERATED] [PATCH v7 0/5] NX 0 Paolo Bonzini
2019-10-24 16:34 ` [MODERATED] [PATCH v7 1/5] NX 1 Paolo Bonzini
2019-10-30 18:38 ` [MODERATED] " Josh Poimboeuf
2019-10-31 11:05 ` Paolo Bonzini
2019-10-24 16:34 ` [MODERATED] [PATCH v7 2/5] NX 2 Paolo Bonzini
2019-10-24 16:34 ` [MODERATED] [PATCH v7 3/5] NX 3 Paolo Bonzini
2019-10-25 8:37 ` [MODERATED] Re: ***UNCHECKED*** " Joerg Roedel
2019-10-25 8:48 ` Paolo Bonzini
2019-10-25 9:03 ` [MODERATED] Re: ***UNCHECKED*** " Joerg Roedel
2019-10-25 9:08 ` Paolo Bonzini
2019-10-25 9:45 ` [MODERATED] Re: ***UNCHECKED*** " Joerg Roedel
2019-10-25 10:39 ` Paolo Bonzini
2019-10-29 20:33 ` mark gross
2019-10-31 11:02 ` Paolo Bonzini [this message]
2019-10-24 16:34 ` [MODERATED] [PATCH v7 4/5] NX 4 Paolo Bonzini
2019-10-24 16:34 ` [MODERATED] [PATCH v7 5/5] NX 5 Paolo Bonzini
2019-10-24 18:27 ` [MODERATED] Re: [PATCH v7 0/5] NX 0 Ben Hutchings
2019-10-24 18:56 ` Paolo Bonzini
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=ae13119c-4f41-d8c9-e06f-217d9a8e1975@redhat.com \
--to=pbonzini@redhat.com \
--cc=speck@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).