Re: [PATCH 06/28] KVM: x86/mmu: merge make_spte_{non,}executable

Paolo Bonzini
2026-05-01T03:51:21Z

On Thu, Apr 30, 2026 at 8:22 PM Sean Christopherson <seanjc@google.com> wrote:
>
> On Thu, Apr 30, 2026, Paolo Bonzini wrote:
> > As the logic will become more complicated with the introduction
> > of MBEC, at least write it only once.
> >
> > Tested-by: David Riley <d.riley@proxmox.com>
> > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> > ---
> > arch/x86/kvm/mmu/spte.c | 20 +++++++++++---------
> > 1 file changed, 11 insertions(+), 9 deletions(-)
> >
> > diff --git a/arch/x86/kvm/mmu/spte.c b/arch/x86/kvm/mmu/spte.c
> > index 85a0473809b0..e9dc0ae44274 100644
> > --- a/arch/x86/kvm/mmu/spte.c
> > +++ b/arch/x86/kvm/mmu/spte.c
> > @@ -317,14 +317,16 @@ static u64 modify_spte_protections(u64 spte, u64 set, u64 clear)
> > return spte;
> > }
> >
> > -static u64 make_spte_executable(u64 spte)
> > +static u64 make_spte_executable(u64 spte, u8 access)
>
> make_spte_executable() is a less-than-awesome name for the combined functionality.
> I read it as "Make an executable SPTE", but when called from make_huge_spte() it's
> obviously not making an executable SPTE.
>
> What about something like this, either as fixup or on top? (completely untested)

I'll keep my code but rename to change_spte_executable().

Paolo