mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Xi Ruoyao <xry111@xry111.site>
To: Marc Zyngier <maz@kernel.org>
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 20:34:43 +0800	[thread overview]
Message-ID: <92d0a120d3303243d7bd72188c4f5974f525975a.camel@xry111.site> (raw)
In-Reply-To: <87plhwytgf.wl-maz@kernel.org>

On Tue, 2025-04-01 at 13:09 +0100, Marc Zyngier wrote:
> 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.

Ok I'll try it.

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

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

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-01  5:56 Xi Ruoyao
2025-04-01  8:34 ` Anshuman Khandual
2025-04-01 11:47   ` Xi Ruoyao
2025-04-01 12:09     ` Marc Zyngier
2025-04-01 12:34       ` Xi Ruoyao [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=92d0a120d3303243d7bd72188c4f5974f525975a.camel@xry111.site \
    --to=xry111@xry111.site \
    --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=maz@kernel.org \
    --cc=shameerali.kolothum.thodi@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

all inboxes | Powered by JetHome®