linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Fuad Tabba <tabba@google.com>
Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	oliver.upton@linux.dev, will@kernel.org, joey.gouly@arm.com,
	suzuki.poulose@arm.com, yuzenghui@huawei.com,
	catalin.marinas@arm.com, vladimir.murzin@arm.com
Subject: Re: [PATCH v1 2/8] KVM: arm64: Trap access to ALLINT if FEAT_NMI not supported by the guest
Date: Tue, 04 Nov 2025 17:22:34 +0000	[thread overview]
Message-ID: <86ecqdvhk5.wl-maz@kernel.org> (raw)
In-Reply-To: <CA+EHjTw7KnXVKeyxd4kNysAOMZrJniuBdCNGV=NoWodc3H-rMw@mail.gmail.com>

On Tue, 04 Nov 2025 15:30:34 +0000,
Fuad Tabba <tabba@google.com> wrote:
> 
> Hi Marc,
> 
> On Tue, 4 Nov 2025 at 15:15, Marc Zyngier <maz@kernel.org> wrote:
> >
> > On Tue, 04 Nov 2025 12:59:00 +0000,
> > Fuad Tabba <tabba@google.com> wrote:
> > >
> > > Access to ALLINT is part of FEAT_NMI. If a guest does not support this
> > > feature, any access to this register must be trapped to the hypervisor
> > > (EL2).
> > >
> > > KVM didn't configure this trap, potentially allowing a guest to toggle
> > > all interrupt mask when it doesn't support FEAT_NMI. Fix this by
> > > checking if the guest has FEAT_NMI support.
> > >
> > > Signed-off-by: Fuad Tabba <tabba@google.com>
> > > ---
> > >  arch/arm64/include/asm/kvm_emulate.h | 3 +++
> > >  1 file changed, 3 insertions(+)
> > >
> > > diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h
> > > index 0f8311263edf..3fc62808c548 100644
> > > --- a/arch/arm64/include/asm/kvm_emulate.h
> > > +++ b/arch/arm64/include/asm/kvm_emulate.h
> > > @@ -688,6 +688,9 @@ static inline void vcpu_set_hcrx(struct kvm_vcpu *vcpu)
> > >               else
> > >                       vcpu->arch.hcrx_el2 |= HCRX_EL2_MCE2;
> > >
> > > +             if (!kvm_has_feat(kvm, ID_AA64PFR1_EL1, NMI, IMP))
> > > +                     vcpu->arch.hcrx_el2 |= HCRX_EL2_TALLINT;
> > > +
> > >               if (kvm_has_tcr2(kvm))
> > >                       vcpu->arch.hcrx_el2 |= HCRX_EL2_TCR2En;
> > >
> >
> > I think this is moving in the wrong direction. We have for quite some
> > time now tried to automatically derive these behaviours from the guest
> > config, as we do for FGUs.
> >
> > I would like to see a similar behaviour being introduced for non-FGT
> > bits so that we don't have to worry about these things anymore.
> 
> I agree that we should make this more like FGT, but since that will
> likely require a bit more time (and probably a couple of respins),
> should we fix the HCRX traps as they are now?

I don't think this is fixing anything. Where does the trap go? There
is no triaging, no handling. At the very least, this needs to be
defined.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.


  reply	other threads:[~2025-11-04 17:22 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-04 12:58 [PATCH v1 0/8] KVM: arm64: Fixes for guest CPU feature trapping and enabling Fuad Tabba
2025-11-04 12:58 ` [PATCH v1 1/8] KVM: arm64: Route MOPS exceptions to EL2 when guest lacks support Fuad Tabba
2025-11-04 13:44   ` Joey Gouly
2025-11-04 13:49     ` Fuad Tabba
2025-11-04 12:59 ` [PATCH v1 2/8] KVM: arm64: Trap access to ALLINT if FEAT_NMI not supported by the guest Fuad Tabba
2025-11-04 15:15   ` Marc Zyngier
2025-11-04 15:30     ` Fuad Tabba
2025-11-04 17:22       ` Marc Zyngier [this message]
2025-11-04 17:30         ` Fuad Tabba
2025-11-04 12:59 ` [PATCH v1 3/8] KVM: arm64: Enable LS64 instructions when supported by guest Fuad Tabba
2025-11-04 15:26   ` Marc Zyngier
2025-11-04 15:31     ` Fuad Tabba
2025-11-04 12:59 ` [PATCH v1 4/8] KVM: arm64: Refactor vcpu_set_hcrx() to reduce indentation Fuad Tabba
2025-11-04 12:59 ` [PATCH v1 5/8] KVM: arm64: Fix Trace Buffer trap polarity for protected VMs Fuad Tabba
2025-11-04 17:50   ` Suzuki K Poulose
2025-11-04 17:56     ` Fuad Tabba
2025-11-04 18:03       ` Suzuki K Poulose
2025-11-04 19:04         ` Fuad Tabba
2025-11-04 12:59 ` [PATCH v1 6/8] KVM: arm64: Fix MTE flag initialization " Fuad Tabba
2025-11-04 12:59 ` [PATCH v1 7/8] KVM: arm64: Prevent host from managing timer offsets " Fuad Tabba
2025-11-04 12:59 ` [PATCH v1 8/8] KVM: arm64: Define FAR_MASK for faulting IPA offset Fuad Tabba

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=86ecqdvhk5.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=joey.gouly@arm.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=oliver.upton@linux.dev \
    --cc=suzuki.poulose@arm.com \
    --cc=tabba@google.com \
    --cc=vladimir.murzin@arm.com \
    --cc=will@kernel.org \
    --cc=yuzenghui@huawei.com \
    /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).