Linux KVM/arm64 development list
 help / color / mirror / Atom feed
From: Steven Price <steven.price@arm.com>
To: sashiko-reviews@lists.linux.dev
Cc: Marc Zyngier <maz@kernel.org>, Oliver Upton <oupton@kernel.org>,
	kvmarm@lists.linux.dev, kvm@vger.kernel.org
Subject: Re: [PATCH 1/6] firmware: arm_rmm: Add SMC definitions for calling the RMM
Date: Thu, 16 Jul 2026 11:59:00 +0100	[thread overview]
Message-ID: <6ec5f7d4-df0d-42b5-a882-824e2df017ec@arm.com> (raw)
In-Reply-To: <20260715143804.ADDF41F000E9@smtp.kernel.org>

On 15/07/2026 15:38, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
> - [Low] `struct rec_exit` contains 4 bytes of implicit compiler padding between `padding9` and `plane`.
> - [Low] Discrepancy between the `PROT_MAP` macro prefix and the `DATA_MAP` comment and SMC command name.
> --
> 
> --- Patch [1]: [PATCH 1/6] firmware: arm_rmm: Add SMC definitions for calling the RMM ---
> commit c161f24da1669945cb4dc961f3a3c4ef452450b6
> Author: Steven Price <steven.price@arm.com>
> firmware: arm_rmm: Add SMC definitions for calling the RMM
> 
> The RMM (Realm Management Monitor) provides functionality that can be
> accessed by SMC calls from the host.
> 
>> diff --git a/include/linux/arm-smccc-rmi.h b/include/linux/arm-smccc-rmi.h
>> new file mode 100644
>> index 0000000000000..c965e8867518f
>> --- /dev/null
>> +++ b/include/linux/arm-smccc-rmi.h
> 
> [ ... ]
> 
>> +	union { /* 0x600 */
>> +		struct {
>> +			u16 imm;
>> +			u16 padding9;
>> +			u64 plane;
> 
> [Severity: Low]
> Does this struct layout contain implicit padding? The sequence of two u16
> fields followed by a u64 field forces the compiler to inject 4 bytes of
> padding to align the plane field to an 8-byte boundary. While deterministic
> on ARM64, implicit padding in ABI structures shared with firmware is usually
> avoided. Should an explicit 32-bit padding field be added here?

Indeed this padding is broken. Amusingly I'd actually asked AI to write
a script to generate this file from the specification source (which had
identified a few minor issues that I'd already fix), but it managed to
preserve this bug :(

I've fixed the script and this now produces:

                struct {
                        u16 imm;
                        u8 padding9[6];
                        u64 plane;
                };

>> +		};
>> +		u8 padding6[0x100];
>> +	};
> 
> [ ... ]
> 
>> +/* RMI_RTT_DATA_MAP_FLAGS definitions */
>> +#define RMI_RTT_PROT_MAP_FLAGS_OADDR_TYPE	GENMASK(1, 0)
>> +#define RMI_RTT_PROT_MAP_FLAGS_LIST_COUNT	GENMASK(15, 2)
> 
> [Severity: Low]
> This isn't a bug, but there seems to be a naming discrepancy. The comment
> mentions RMI_RTT_DATA_MAP_FLAGS, which corresponds to the
> SMC_RMI_RTT_DATA_MAP command, but the macros are prefixed with
> RMI_RTT_PROT_MAP_FLAGS. Should these macros use the DATA_MAP prefix instead?

These comments were manually generated - again I've fixed the script to
generate the comments automatically to avoid this mismatch in the future.

Thanks,
Steve

>> +
>> +/* S2AP Direct Encodings, used in RMI_RTT_UNPROT_MAP_FLAGS_S2AP */
>> +#define RMI_S2AP_DIRECT_WRITE			BIT(0)
>> +#define RMI_S2AP_DIRECT_READ			BIT(1)
>> +
>> +#endif /* __LINUX_ARM_SMCCC_RMI_H_ */
> 


  reply	other threads:[~2026-07-16 10:59 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-15 14:27 [PATCH 0/6] firmware: arm_rmm: Add RMM v2.0 support Steven Price
2026-07-15 14:27 ` [PATCH 1/6] firmware: arm_rmm: Add SMC definitions for calling the RMM Steven Price
2026-07-15 14:38   ` sashiko-bot
2026-07-16 10:59     ` Steven Price [this message]
2026-07-23  7:11   ` Kohei Enju
2026-07-29 16:02     ` Steven Price
2026-07-15 14:27 ` [PATCH 2/6] firmware: arm_rmm: Add wrappers for direct RMI calls Steven Price
2026-07-15 14:49   ` sashiko-bot
2026-07-16 14:28     ` Steven Price
2026-08-06 11:53   ` Will Deacon
2026-08-17 14:56     ` Steven Price
2026-07-15 14:27 ` [PATCH 3/6] firmware: arm_rmm: Check for RMI support at init Steven Price
2026-07-15 15:06   ` sashiko-bot
2026-07-16 14:28     ` Steven Price
2026-07-31 10:46   ` Suzuki K Poulose
2026-07-15 14:27 ` [PATCH 4/6] firmware: arm_rmm: Configure the RMM with the host's page size Steven Price
2026-07-15 15:18   ` sashiko-bot
2026-07-16 15:41     ` Steven Price
2026-07-31 13:21   ` Suzuki K Poulose
2026-07-15 14:27 ` [PATCH 5/6] firmware: arm_rmm: Add support for SRO Steven Price
2026-07-15 15:29   ` sashiko-bot
2026-07-16 16:04     ` Steven Price
2026-07-31 18:25   ` Suzuki K Poulose
2026-07-15 14:27 ` [PATCH 6/6] firmware: arm_rmm: Ensure the RMM has GPT entries for memory Steven Price
2026-07-15 15:47   ` sashiko-bot
2026-07-20 15:03     ` Steven Price

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=6ec5f7d4-df0d-42b5-a882-824e2df017ec@arm.com \
    --to=steven.price@arm.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=maz@kernel.org \
    --cc=oupton@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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