linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Mark Brown <broonie@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org, andre.przywara@arm.com,
	jaxson.han@arm.com, robin.murphy@arm.com,
	vladimir.murzin@arm.com, wei.chen@arm.com
Subject: Re: [bootwrapper PATCH v3 01/15] aarch64: correct ZCR_EL3.LEN initialization
Date: Thu, 27 Jan 2022 16:08:50 +0000	[thread overview]
Message-ID: <YfLDkoihLFnixAaQ@FVFF77S0Q05N> (raw)
In-Reply-To: <YfA3D3c+lOyybNT3@sirena.org.uk>

On Tue, Jan 25, 2022 at 05:44:47PM +0000, Mark Brown wrote:
> On Tue, Jan 25, 2022 at 04:33:39PM +0000, Mark Rutland wrote:
> > On Tue, Jan 25, 2022 at 03:59:38PM +0000, Mark Brown wrote:
> > > On Tue, Jan 25, 2022 at 03:00:43PM +0000, Mark Rutland wrote:
> 
> > > > As the same time, rename ZCR_EL3_LEN_MASK to ZCR_EL3_LEN_MAX, as it is
> > > > used as a value rather than as a bit mask.
> 
> > > Well, it's both and we do call it a mask in both the kernel and TF-A
> > > too...
> 
> > Here specifically in the boot-wrapper I'm just using it as a value, so I don't
> > see that those are relevant?
> 
> That's also a bunch of the other usage - the kernel uses it to set the
> maximum available value by virtue of setting every possible bit in the
> bitfield, though it does also use it as a mask in places.
> 
> > The idea was to be consistent with the <register>_<field>_<valuename> naming,
> > and avoiding the "why are you programming a mask as the value" questions from
> > last time around, where the unambiguous options are:
> 
> I've not seen that - I did see that there had been some discussion as to
> why the code had been including the reserved bits but hadn't seen any
> discussion of confusion between mask and max.

In:

  https://lore.kernel.org/all/20220117143104.28db5001@donnerap.cambridge.arm.com/#t

w.r.t. the use of ZCR_EL3_LEN, Andre said:

| So when comparing this to the other uses of XXX_EL3_YYY, they typically
| describe a mask, but here we seems to abuse this as a value?
 
... which begat the rename. In this cleanup I've tried to use
<register>_<field> for masks, and <register>_<field>_<valuename> for specific
values to program in, and hence I added ZCR_EL3_LEN_MAX.

I'm going to stick with ZCR_EL3_LEN_MAX.

In that same paragraph he said:

| the existing code writes 0x1ff into that register, presumable to cover future
| vector length extensions 

... which begat the conversation of which length to use.

I later noted that TF-A currently uses 0xf, and so I aligned with that and plan
to stick with it in the absence of any published architectural guidance that we
*should* set the RAZ/WI bits. We can always add that in future when necessary
if/when the field grows, and until then it's less surprising to only be setting
the bits that are documented as needing to be set in this manner.

> > a) Use <register>_<field>_<valuename> definition, as here.
> 
> > b) Use <register>_<field>_MASK, and add comments at each usage as to why we use
> >    a mask as a value, to explain why that isn't a bug.
> 
> > c) Have both <register>_<field>_MASK and some value definition, and use some
> >    insertion helper to insert the value.
> 
> > ... and I went with (a) because it was the simplest.
> 
> > Is there a problem with this?
> 
> My concern is continuity of the enumeration algorithm between the
> various implementations we have, it's something we're not currently
> great with and this creates a separation between the kernel and the boot
> wrapper implementations.  There's no change in what's actually being
> done but it creates some additional effort to figure out why we're
> setting a maximum here and not trying to set all the bits as we do in
> the kernel.

TBH, I'd argue if we're setting those bits in the kernel it's probably a bug,
because we don't know *exactly* what effect they'll have when allocated in the
future.

Thanks,
Mark.

> TF-A is doing something else again (actually two different
> things if you include SME which uses the same algorithm for the
> streaming vector length), for SVE it uses a maximum length too but it
> uses a lower length than the maximum representable one that's used here.
> 
> It may be that the best thing to do is to make this change but also
> update the kernel to have separate but identical mask and maximum
> definitions, though TBH I'd rather not actually have that update happen
> while the SME series is pending.


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-01-27 16:10 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-25 15:00 [bootwrapper PATCH v3 00/15] Cleanups and improvements Mark Rutland
2022-01-25 15:00 ` [bootwrapper PATCH v3 01/15] aarch64: correct ZCR_EL3.LEN initialization Mark Rutland
2022-01-25 15:59   ` Mark Brown
2022-01-25 16:33     ` Mark Rutland
2022-01-25 17:44       ` Mark Brown
2022-01-27 16:08         ` Mark Rutland [this message]
2022-01-27 18:55           ` Mark Brown
2022-01-28 10:03             ` Mark Rutland
2022-01-28 12:41               ` Mark Brown
2022-01-26 15:02   ` Andre Przywara
2022-01-25 15:00 ` [bootwrapper PATCH v3 02/15] aarch64: correct SCTLR_EL1_KERNEL for AA32 kernels Mark Rutland
2022-01-26 15:03   ` Andre Przywara
2022-01-27 15:52     ` Mark Rutland
2022-01-25 15:00 ` [bootwrapper PATCH v3 03/15] Document entry requirements Mark Rutland
2022-01-26 15:03   ` Andre Przywara
2022-01-25 15:00 ` [bootwrapper PATCH v3 04/15] Add bit-field macros Mark Rutland
2022-01-26 15:03   ` Andre Przywara
2022-01-27 16:11     ` Mark Rutland
2022-01-25 15:00 ` [bootwrapper PATCH v3 05/15] aarch64: add system register accessors Mark Rutland
2022-01-25 15:00 ` [bootwrapper PATCH v3 06/15] aarch32: add coprocessor accessors Mark Rutland
2022-01-26 16:35   ` Andre Przywara
2022-01-25 15:00 ` [bootwrapper PATCH v3 07/15] aarch64: add mov_64 macro Mark Rutland
2022-01-25 15:00 ` [bootwrapper PATCH v3 08/15] aarch64: initialize SCTLR_ELx for the boot-wrapper Mark Rutland
2022-01-26 16:35   ` Andre Przywara
2022-01-25 15:00 ` [bootwrapper PATCH v3 09/15] Rework common init C code Mark Rutland
2022-01-25 15:00 ` [bootwrapper PATCH v3 10/15] Announce boot-wrapper mode / exception level Mark Rutland
2022-01-25 15:00 ` [bootwrapper PATCH v3 11/15] aarch64: move the bulk of EL3 initialization to C Mark Rutland
2022-01-26 16:36   ` Andre Przywara
2022-01-25 15:00 ` [bootwrapper PATCH v3 12/15] aarch32: move the bulk of Secure PL1 " Mark Rutland
2022-01-25 15:00 ` [bootwrapper PATCH v3 13/15] Announce locations of memory objects Mark Rutland
2022-01-25 15:00 ` [bootwrapper PATCH v3 14/15] Rework bootmethod initialization Mark Rutland
2022-01-26 16:36   ` Andre Przywara
2022-01-25 15:00 ` [bootwrapper PATCH v3 15/15] Unify start_el3 & start_no_el3 Mark Rutland
2022-01-28 15:50 ` [bootwrapper PATCH v3 00/15] Cleanups and improvements Mark Rutland

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=YfLDkoihLFnixAaQ@FVFF77S0Q05N \
    --to=mark.rutland@arm.com \
    --cc=andre.przywara@arm.com \
    --cc=broonie@kernel.org \
    --cc=jaxson.han@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=robin.murphy@arm.com \
    --cc=vladimir.murzin@arm.com \
    --cc=wei.chen@arm.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).