* [PATCH] arm64: rsi: Correct type of realm_config::hash_algo
@ 2026-09-29 11:36 Kohei Enju
2026-10-13 17:08 ` Catalin Marinas
0 siblings, 1 reply; 3+ messages in thread
From: Kohei Enju @ 2026-09-29 11:36 UTC (permalink / raw)
To: Catalin Marinas, Will Deacon, Mark Rutland
Cc: linux-arm-kernel, linux-kernel, Suzuki K Poulose, Sami Mujawar,
Steven Price, Aneesh Kumar K.V (Arm), Kohei Enju
The RMM specification defines RsiHashAlgorithm as an 8-bit type, but
realm_config::hash_algo is currently declared as unsigned long.
There are currently no upstream users of this field, so the mismatch
does not cause an observable issue today. However, a proposed series
adding support for Realm measurement registers uses this field and
exposes a bug caused by the incorrect type.
Change hash_algo to u8 to match the RMM specification while preserving
the size and layout of struct realm_config.
Link: https://lore.kernel.org/all/20260413084957.327661-4-sami.mujawar@arm.com/
Signed-off-by: Kohei Enju <enju.kohei@fujitsu.com>
---
include/linux/arm-smccc-rsi.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/include/linux/arm-smccc-rsi.h b/include/linux/arm-smccc-rsi.h
index fddb77986f70..2fb6ec5e0298 100644
--- a/include/linux/arm-smccc-rsi.h
+++ b/include/linux/arm-smccc-rsi.h
@@ -128,7 +128,10 @@ struct realm_config {
union {
struct {
unsigned long ipa_bits; /* Width of IPA in bits */
- unsigned long hash_algo; /* Hash algorithm */
+ union {
+ u8 hash_algo; /* Hash algorithm */
+ u8 pad_hash_algo[8];
+ };
};
u8 pad[0x200];
};
---
base-commit: 6c360697fd4d17a53ed977a1341add3520a19269
change-id: 20260929-cca-b4-rsi-fix-hash_algo-type-rebase-e341cd50d600
Best regards,
--
Kohei Enju <enju.kohei@fujitsu.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] arm64: rsi: Correct type of realm_config::hash_algo
2026-09-29 11:36 [PATCH] arm64: rsi: Correct type of realm_config::hash_algo Kohei Enju
@ 2026-10-13 17:08 ` Catalin Marinas
2026-10-14 2:16 ` Kohei Enju
0 siblings, 1 reply; 3+ messages in thread
From: Catalin Marinas @ 2026-10-13 17:08 UTC (permalink / raw)
To: Kohei Enju
Cc: Will Deacon, Mark Rutland, linux-arm-kernel, linux-kernel,
Suzuki K Poulose, Sami Mujawar, Steven Price,
Aneesh Kumar K.V (Arm)
On Tue, Sep 29, 2026 at 08:36:00PM +0900, Kohei Enju wrote:
> The RMM specification defines RsiHashAlgorithm as an 8-bit type, but
> realm_config::hash_algo is currently declared as unsigned long.
>
> There are currently no upstream users of this field, so the mismatch
> does not cause an observable issue today. However, a proposed series
> adding support for Realm measurement registers uses this field and
> exposes a bug caused by the incorrect type.
>
> Change hash_algo to u8 to match the RMM specification while preserving
> the size and layout of struct realm_config.
Doesn't the RMM spec say that the unused bits must be zero? B5.5.19.
That said, I'm ok with the explicit u8 here.
> Link: https://lore.kernel.org/all/20260413084957.327661-4-sami.mujawar@arm.com/
> Signed-off-by: Kohei Enju <enju.kohei@fujitsu.com>
> ---
> include/linux/arm-smccc-rsi.h | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/arm-smccc-rsi.h b/include/linux/arm-smccc-rsi.h
> index fddb77986f70..2fb6ec5e0298 100644
> --- a/include/linux/arm-smccc-rsi.h
> +++ b/include/linux/arm-smccc-rsi.h
> @@ -128,7 +128,10 @@ struct realm_config {
> union {
> struct {
> unsigned long ipa_bits; /* Width of IPA in bits */
> - unsigned long hash_algo; /* Hash algorithm */
> + union {
> + u8 hash_algo; /* Hash algorithm */
> + u8 pad_hash_algo[8];
> + };
I would skip the padding for now, we have one already. If we later add
the next fields, I have a slight preference for a u8 reserved[7] field
than another union.
> };
> u8 pad[0x200];
> };
--
Catalin
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] arm64: rsi: Correct type of realm_config::hash_algo
2026-10-13 17:08 ` Catalin Marinas
@ 2026-10-14 2:16 ` Kohei Enju
0 siblings, 0 replies; 3+ messages in thread
From: Kohei Enju @ 2026-10-14 2:16 UTC (permalink / raw)
To: Catalin Marinas
Cc: Will Deacon, Mark Rutland, linux-arm-kernel, linux-kernel,
Suzuki K Poulose, Sami Mujawar, Steven Price,
Aneesh Kumar K.V (Arm)
On 10/13 18:08, Catalin Marinas wrote:
> On Tue, Sep 29, 2026 at 08:36:00PM +0900, Kohei Enju wrote:
> > The RMM specification defines RsiHashAlgorithm as an 8-bit type, but
> > realm_config::hash_algo is currently declared as unsigned long.
> >
> > There are currently no upstream users of this field, so the mismatch
> > does not cause an observable issue today. However, a proposed series
> > adding support for Realm measurement registers uses this field and
> > exposes a bug caused by the incorrect type.
> >
> > Change hash_algo to u8 to match the RMM specification while preserving
> > the size and layout of struct realm_config.
>
> Doesn't the RMM spec say that the unused bits must be zero? B5.5.19.
You're right. The RMM must zero the unused bits, but TF-RMM does not
appear to do so. I agree that this should be fixed in TF-RMM as well.
> That said, I'm ok with the explicit u8 here.
Thanks.
>
> > Link: https://lore.kernel.org/all/20260413084957.327661-4-sami.mujawar@arm.com/
> > Signed-off-by: Kohei Enju <enju.kohei@fujitsu.com>
> > ---
> > include/linux/arm-smccc-rsi.h | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/include/linux/arm-smccc-rsi.h b/include/linux/arm-smccc-rsi.h
> > index fddb77986f70..2fb6ec5e0298 100644
> > --- a/include/linux/arm-smccc-rsi.h
> > +++ b/include/linux/arm-smccc-rsi.h
> > @@ -128,7 +128,10 @@ struct realm_config {
> > union {
> > struct {
> > unsigned long ipa_bits; /* Width of IPA in bits */
> > - unsigned long hash_algo; /* Hash algorithm */
> > + union {
> > + u8 hash_algo; /* Hash algorithm */
> > + u8 pad_hash_algo[8];
> > + };
>
> I would skip the padding for now, we have one already. If we later add
> the next fields, I have a slight preference for a u8 reserved[7] field
> than another union.
Ack. I'll drop the inner union in v2.
Thanks,
Kohei
>
> > };
> > u8 pad[0x200];
> > };
>
> --
> Catalin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-14 2:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-29 11:36 [PATCH] arm64: rsi: Correct type of realm_config::hash_algo Kohei Enju
2026-10-13 17:08 ` Catalin Marinas
2026-10-14 2:16 ` Kohei Enju
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.