linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Xi Ruoyao <xry111@xry111.site>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>,
	James Morse <james.morse@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>,
	Mingcong Bai <jeffbai@aosc.io>
Subject: Re: [PATCH] arm64: Add overrride for MPAM
Date: Tue, 01 Apr 2025 13:09:04 +0100	[thread overview]
Message-ID: <87plhwytgf.wl-maz@kernel.org> (raw)
In-Reply-To: <46ed31b37b4b92720b26be66f3e6366a714024cf.camel@xry111.site>

On Tue, 01 Apr 2025 12:47:03 +0100,
Xi Ruoyao <xry111@xry111.site> wrote:
> 
> On Tue, 2025-04-01 at 14:04 +0530, Anshuman Khandual wrote:
> > On 4/1/25 11:26, Xi Ruoyao wrote:
> > > As the message of the commit 09e6b306f3ba ("arm64: cpufeature: discover
> > > CPU support for MPAM") already states, if a buggy firmware fails to
> > > either enable MPAM or emulate the trap as if it were disabled, the
> > > kernel will just fail to boot.  While upgrading the firmware should be
> > > the best solution, we have some hardware of which the vender have made
> > > no response 2 months after we requested a firmware update.  Allow
> > > overriding it so our devices don't become some e-waste.
> >
> > There could be similar problems, where firmware might not enable arch
> > features as required. Just wondering if there is a platform policy in
> > place for enabling id-reg overrides for working around such scenarios
> > to prevent a kernel crash etc ?
> 
> In https://lore.kernel.org/all/87jzcfsuep.wl-maz@kernel.org/:
> 
>    > For such cases, when MPAM is incorrectly advertised, can we have kernel
>    > command line parameter like mpam=0 to override it's detection?
>    
>    We could, but only when we can confirm what the problem is.
> 
> And there was prior arts like:
> 
> commit 892f7237b3ffb090f1b1f1e55fe7c50664405aed
> Author: Marc Zyngier <maz@kernel.org>
> Date:   Wed Jul 20 11:52:19 2022 +0100
> 
>     arm64: Delay initialisation of cpuinfo_arm64::reg_{zcr,smcr}
>     
>     Even if we are now able to tell the kernel to avoid exposing SVE/SME
>     from the command line, we still have a couple of places where we
>     unconditionally access the ZCR_EL1 (resp. SMCR_EL1) registers.
>     
>     On systems with broken firmwares, this results in a crash even if
>     arm64.nosve (resp. arm64.nosme) was passed on the command-line.
>     
>     To avoid this, only update cpuinfo_arm64::reg_{zcr,smcr} once
>     we have computed the sanitised version for the corresponding
>     feature registers (ID_AA64PFR0 for SVE, and ID_AA64PFR1 for
>     SME). This results in some minor refactoring.

That particular patch has caused quite a few issues, see d3c7c48d004f.
So don't use it as a reference.

Now, while I think an option is probably acceptable in the face of an
unresponsive vendor, I don't think the way you implement it is the
correct approach.

It should be possible to handle the override in the assembly code,
like we do for other bits and pieces, and deal with MPAMIDR_EL1 later
down the line, once the sanitised ID registers are known to be valid.

Overall, we don't have a great story with feature-specific ID
registers that can undef when the feature isn't present (such as
MPAMIDR_EL1, SMIDR_EL1, PMSIDR_EL1), and we should adopt a common
behaviour for those.

Thanks,

	M.

-- 
Jazz isn't dead. It just smells funny.


  reply	other threads:[~2025-04-01 12:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-01  5:56 [PATCH] arm64: Add overrride for MPAM Xi Ruoyao
2025-04-01  8:34 ` Anshuman Khandual
2025-04-01 11:47   ` Xi Ruoyao
2025-04-01 12:09     ` Marc Zyngier [this message]
2025-04-01 12:34       ` Xi Ruoyao

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=87plhwytgf.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=anshuman.khandual@arm.com \
    --cc=james.morse@arm.com \
    --cc=jeffbai@aosc.io \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shameerali.kolothum.thodi@huawei.com \
    --cc=xry111@xry111.site \
    /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).