Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Kohei Enju <enju.kohei@fujitsu.com>
Cc: Will Deacon <will@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Suzuki K Poulose <Suzuki.Poulose@arm.com>,
	Sami Mujawar <sami.mujawar@arm.com>,
	Steven Price <steven.price@arm.com>,
	"Aneesh Kumar K.V (Arm)" <aneesh.kumar@kernel.org>
Subject: Re: [PATCH] arm64: rsi: Correct type of realm_config::hash_algo
Date: Tue, 13 Oct 2026 18:08:28 +0100	[thread overview]
Message-ID: <as5ljILkGNxH0TTd@arm.com> (raw)
In-Reply-To: <20260929-cca-b4-rsi-fix-hash_algo-type-rebase-v1-1-6932cf0aa605@fujitsu.com>

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


  reply	other threads:[~2026-10-13 17:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29 11:36 [PATCH] arm64: rsi: Correct type of realm_config::hash_algo Kohei Enju
2026-10-13 17:08 ` Catalin Marinas [this message]
2026-10-14  2:16   ` Kohei Enju

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=as5ljILkGNxH0TTd@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=Suzuki.Poulose@arm.com \
    --cc=aneesh.kumar@kernel.org \
    --cc=enju.kohei@fujitsu.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=sami.mujawar@arm.com \
    --cc=steven.price@arm.com \
    --cc=will@kernel.org \
    /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