From: Paolo Bonzini <pbonzini@redhat.com>
To: Lai Jiangshan <jiangshanlai@gmail.com>,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
Sean Christopherson <seanjc@google.com>
Cc: Lai Jiangshan <jiangshan.ljs@antgroup.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH V2 4/5] KVM: X86: Handle implicit supervisor access with SMAP
Date: Tue, 15 Mar 2022 22:04:46 +0100 [thread overview]
Message-ID: <87fe8fef-ab3c-6459-6494-06d3d74308a6@redhat.com> (raw)
In-Reply-To: <20220311070346.45023-5-jiangshanlai@gmail.com>
On 3/11/22 08:03, Lai Jiangshan wrote:
> - unsigned long not_smap = (cpl - 3) & (rflags & X86_EFLAGS_AC);
> - int index = (pfec >> 1) +
> - (not_smap >> (X86_EFLAGS_AC_BIT - PFERR_RSVD_BIT + 1));
> + bool explicit_access = !(access & PFERR_IMPLICIT_ACCESS);
> + bool not_smap = (rflags & X86_EFLAGS_AC) && explicit_access;
> + int index = (pfec + (!!not_smap << PFERR_RSVD_BIT)) >> 1;
Also possible:
u64 implicit_access = access & PFERR_IMPLICIT_ACCESS;
bool not_smap = ((rflags & X86_EFLAGS_AC) | implicit_access) == X86_EFLAGS_AC;
int index = (pfec + (not_smap << PFERR_RSVD_BIT)) >> 1;
Paolo
next prev parent reply other threads:[~2022-03-15 21:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-11 7:03 [PATCH V2 0/5] KVM: X86: permission_fault() for SMAP Lai Jiangshan
2022-03-11 7:03 ` [PATCH V2 1/5] KVM: X86: Change the type of access u32 to u64 Lai Jiangshan
2022-03-11 7:03 ` [PATCH V2 2/5] KVM: X86: Fix comments in update_permission_bitmask Lai Jiangshan
2022-03-11 7:03 ` [PATCH V2 3/5] KVM: X86: Rename variable smap to not_smap in permission_fault() Lai Jiangshan
2022-03-11 7:03 ` [PATCH V2 4/5] KVM: X86: Handle implicit supervisor access with SMAP Lai Jiangshan
2022-03-15 21:04 ` Paolo Bonzini [this message]
2022-03-11 7:03 ` [PATCH V2 5/5] KVM: X86: Only get rflags when needed in permission_fault() Lai Jiangshan
2022-03-11 7:03 ` [RFC PATCH V2 6/5] KVM: X86: Propagate the nested page fault info to the guest Lai Jiangshan
2022-03-15 21:06 ` [PATCH V2 0/5] KVM: X86: permission_fault() for SMAP Paolo Bonzini
2022-03-16 2:38 ` Lai Jiangshan
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=87fe8fef-ab3c-6459-6494-06d3d74308a6@redhat.com \
--to=pbonzini@redhat.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jiangshan.ljs@antgroup.com \
--cc=jiangshanlai@gmail.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=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.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®