public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Conor Dooley <conor.dooley@microchip.com>
To: Andrew Jones <ajones@ventanamicro.com>
Cc: "Evan Green" <evan@rivosinc.com>,
	"Samuel Ortiz" <sameo@rivosinc.com>,
	"Paul Walmsley" <paul.walmsley@sifive.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Albert Ou" <aou@eecs.berkeley.edu>,
	linux-riscv@lists.infradead.org,
	"Hongren (Zenithal) Zheng" <i@zenithal.me>,
	linux@rivosinc.com, "Heiko Stuebner" <heiko.stuebner@vrull.eu>,
	"Anup Patel" <apatel@ventanamicro.com>,
	linux-kernel@vger.kernel.org, "Guo Ren" <guoren@kernel.org>,
	"Atish Patra" <atishp@rivosinc.com>,
	"Björn Töpel" <bjorn@rivosinc.com>,
	devicetree@vger.kernel.org, sorear@fastmail.com,
	"Jiatai He" <jiatai2021@iscas.ac.cn>
Subject: Re: [PATCH v4 1/4] RISC-V: Add Bitmanip/Scalar Crypto parsing from DT
Date: Thu, 13 Jul 2023 14:16:43 +0100	[thread overview]
Message-ID: <20230713-bootleg-tray-c5bfe58b5673@wendy> (raw)
In-Reply-To: <20230713-692c967c7a08c15dacbcab10@orel>

[-- Attachment #1: Type: text/plain, Size: 2774 bytes --]

On Thu, Jul 13, 2023 at 02:45:57PM +0200, Andrew Jones wrote:
> On Thu, Jul 13, 2023 at 12:27:24PM +0100, Conor Dooley wrote:

> > +#define __RISCV_ISA_EXT_BUNDLE(_name, _bundled_exts) {	\
> > +	.name = #_name,					\
> > +	.property = #_name,				\
> > +	.bundle_ids = _bundled_exts,			\
> > +	.bundle_size = ARRAY_SIZE(_bundled_exts)	\
> > +}
> > +
> > +static const unsigned int riscv_zk_bundled_exts[] = {
> > +	RISCV_ISA_EXT_ZBKB,
> > +	RISCV_ISA_EXT_ZBKC,
> > +	RISCV_ISA_EXT_ZBKX,
> > +	RISCV_ISA_EXT_ZKND,
> > +	RISCV_ISA_EXT_ZKNE,
> > +	RISCV_ISA_EXT_ZKR,
> > +	RISCV_ISA_EXT_ZKT,
> 
> I think RISCV_ISA_EXT_ZKNH also belongs in this bundle,
> since the spec says zk is the zkn bundle plus zkr and zkt.
> 
> > +};
> > +
> > +static const unsigned int riscv_zkn_bundled_exts[] = {
> > +	RISCV_ISA_EXT_ZBKB,
> > +	RISCV_ISA_EXT_ZBKC,
> > +	RISCV_ISA_EXT_ZBKX,
> > +	RISCV_ISA_EXT_ZKND,
> > +	RISCV_ISA_EXT_ZKNE,
> > +	RISCV_ISA_EXT_ZKNH,
> > +};
> > +
> > +static const unsigned int riscv_zks_bundled_exts[] = {
> > +	RISCV_ISA_EXT_ZBKB,
> > +	RISCV_ISA_EXT_ZBKC,
> > +	RISCV_ISA_EXT_ZKSED,
> > +	RISCV_ISA_EXT_ZKSH
> 
> And, per the spec, this one appears to be missing RISCV_ISA_EXT_ZBKX.

Yeah, these do look wrong. I should've cross-checked it.

> I found [1] which calls these shorthands "group names", so maybe we should
> use the term "group" instead of "bundle"?

WFM at least.

> I'm tempted to try to directly
> code that graphic in [1] with something like...
> 
> #define Zks_group1 \
> 	RISCV_ISA_EXT_ZKSED, \
> 	RISCV_ISA_EXT_ZKSH
> 
> #define Zks_group2 \
> 	RISCV_ISA_EXT_ZBKB, \
> 	RISCV_ISA_EXT_ZBKC, \
> 	RISCV_ISA_EXT_ZBKX
> 
> #define Zks_group \
> 	Zks_group1, \
> 	Zks_group2
> 
> #define Zkn_group1 \
> 	RISCV_ISA_EXT_ZKND, \
> 	RISCV_ISA_EXT_ZKNE, \
> 	RISCV_ISA_EXT_ZKNH
> 
> #define Zkn_group2 \
> 	Zks_group2
> 
> #define Zkn_group \
> 	Zkn_group1, \
> 	Zkn_group2
> 
> static const unsigned int riscv_zks_group[] = {
> 	Zks_group,
> };
> 
> static const unsigned int riscv_zkn_group[] = {
> 	Zkn_group,
> };
> 
> static const unsigned int riscv_zk_group[] = {
> 	Zks_group,
> 	Zkn_group,
> 	RISCV_ISA_EXT_ZKR,
> 	RISCV_ISA_EXT_ZKT,
> };
> 
> ...but now that I have, I'm not sure I like the looks of it...

If you called them RISCV_ISA_EXT_GROUP_ZKN (or similar) it would look a
lot less out of place IMO. I'd probably drop the "group2" dance & pick a
better name for "Zks_group2", maybe just do something like
RISCV_ISA_EXT_GROUP_SCALAR_CRYPTO_BITMANIP? Mouthful, but seemed better
than trying to be clever with ZBK or something.

> [1] https://wiki.riscv.org/display/HOME/Scalar+Cryptography+Instruction+Set+Extension+Group+Names+Diagram


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2023-07-13 13:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-12  8:41 [PATCH v4 0/4] RISC-V: archrandom support Samuel Ortiz
2023-07-12  8:41 ` [PATCH v4 1/4] RISC-V: Add Bitmanip/Scalar Crypto parsing from DT Samuel Ortiz
2023-07-12 10:39   ` Conor Dooley
2023-07-12 10:46     ` Conor Dooley
2023-07-12 11:17       ` Conor Dooley
2023-07-12 17:43     ` Evan Green
2023-07-12 17:51       ` Conor Dooley
2023-07-13  8:46       ` Andrew Jones
2023-07-13 11:27         ` Conor Dooley
2023-07-13 12:45           ` Andrew Jones
2023-07-13 13:16             ` Conor Dooley [this message]
2023-10-12 16:27           ` Evan Green
2023-07-12  8:41 ` [PATCH v4 2/4] dt-bindings: riscv: Document the 1.0 scalar cryptography extensions Samuel Ortiz
2023-07-12  8:41 ` [PATCH v4 3/4] RISC-V: hwprobe: Expose Zbc and the scalar crypto extensions Samuel Ortiz
2023-07-12  8:41 ` [PATCH v4 4/4] RISC-V: Implement archrandom when Zkr is available Samuel Ortiz

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=20230713-bootleg-tray-c5bfe58b5673@wendy \
    --to=conor.dooley@microchip.com \
    --cc=ajones@ventanamicro.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=apatel@ventanamicro.com \
    --cc=atishp@rivosinc.com \
    --cc=bjorn@rivosinc.com \
    --cc=devicetree@vger.kernel.org \
    --cc=evan@rivosinc.com \
    --cc=guoren@kernel.org \
    --cc=heiko.stuebner@vrull.eu \
    --cc=i@zenithal.me \
    --cc=jiatai2021@iscas.ac.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux@rivosinc.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=sameo@rivosinc.com \
    --cc=sorear@fastmail.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