linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: D Scott Phillips <scott@os.amperecomputing.com>
Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
	Joey Gouly <joey.gouly@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Oliver Upton <oliver.upton@linux.dev>,
	Zenghui Yu <yuzenghui@huawei.com>,
	Mark Rutland <mark.rutland@arm.com>
Subject: Re: [PATCH] KVM: arm64: Force HCR_EL2.xMO to 1 at all times in VHE mode
Date: Sat, 26 Apr 2025 19:13:29 +0100	[thread overview]
Message-ID: <86h62akcza.wl-maz@kernel.org> (raw)
In-Reply-To: <86jz799ozo.fsf@scott-ph-mail.amperecomputing.com>

On Thu, 24 Apr 2025 23:24:59 +0100,
D Scott Phillips <scott@os.amperecomputing.com> wrote:
> 
> Marc Zyngier <maz@kernel.org> writes:
> 
> > We keep setting and clearing these bits depending on the role of
> > the host kernel, mimicking what we do for nVHE. But that's actually
> > pretty pointless, as we always want physical interrupts to make it
> > to the host, at EL2.
> >
> > This has also two problems:
> >
> > - it prevents IRQs from being taken when these bits are cleared
> >   if the implementation has chosen to implement these bits as
> >   masks when HCR_EL2.{TGE,xMO}=={0,0}
> >
> > - it triggers a bad erratum on the AmpereOne HW, which catches
> >   fire on clearing these bits while an interrupt is being taken
> >   (AC03_CPU_36).
> >
> > Let's kill these two birds with a single stone.
> >
> > Reported-by: D Scott Phillips <scott@os.amperecomputing.com>
> > Signed-off-by: Marc Zyngier <maz@kernel.org>
> > ---
> >  arch/arm64/include/asm/kvm_arm.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h
> > index 974d72b5905b8..bba4b0e930915 100644
> > --- a/arch/arm64/include/asm/kvm_arm.h
> > +++ b/arch/arm64/include/asm/kvm_arm.h
> > @@ -100,7 +100,7 @@
> >  			 HCR_FMO | HCR_IMO | HCR_PTW | HCR_TID3 | HCR_TID1)
> >  #define HCR_HOST_NVHE_FLAGS (HCR_RW | HCR_API | HCR_APK | HCR_ATA)
> >  #define HCR_HOST_NVHE_PROTECTED_FLAGS (HCR_HOST_NVHE_FLAGS | HCR_TSC)
> > -#define HCR_HOST_VHE_FLAGS (HCR_RW | HCR_TGE | HCR_E2H)
> > +#define HCR_HOST_VHE_FLAGS (HCR_RW | HCR_TGE | HCR_E2H | HCR_AMO | HCR_IMO | HCR_FMO)
> >  
> >  #define HCRX_HOST_FLAGS (HCRX_EL2_MSCEn | HCRX_EL2_TCR2En | HCRX_EL2_EnFPM)
> >  #define MPAMHCR_HOST_FLAGS	0
> 
> Should the xMO twiddling in __vgic_v3_get_gic_config() also get dropped
> here?

Ah, that old chestnut. Yeah, well spotted. It could do with some
TLC. I'll do some surgery on it and post a v2.

Thanks,

	M.

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


      reply	other threads:[~2025-04-26 18:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-22 12:39 [PATCH] KVM: arm64: Force HCR_EL2.xMO to 1 at all times in VHE mode Marc Zyngier
2025-04-24 22:24 ` D Scott Phillips
2025-04-26 18:13   ` Marc Zyngier [this message]

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=86h62akcza.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=joey.gouly@arm.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=oliver.upton@linux.dev \
    --cc=scott@os.amperecomputing.com \
    --cc=suzuki.poulose@arm.com \
    --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).