Thread (59 messages) 59 messages, 8 authors, 5d ago

Re: [PATCH v19 1/7] firmware: arm_rmm: Add SMC definitions for calling the RMM

From: Suzuki K Poulose <suzuki.poulose@arm.com>
Date: 2026-09-24 22:49:25
Also in: kvm, kvmarm, linux-coco, lkml

On 24/09/2026 18:05, Ackerley Tng wrote:
Suzuki K Poulose [off-list ref] writes:
quoted
[...snip...]

+
+/*
+ * Note many of these fields are smaller than u64 but all fields have u64
+ * alignment, so use u64 to ensure correct alignment.
+ */
+struct rmm_config {
+	union { /* 0x0 */
+		struct {
+			u64 tracking_region_size;
+			u64 rmi_granule_size;
+		};
+		u8 sizer[SZ_4K];
+	};
+};
+
+static_assert(sizeof(struct rmm_config) == SZ_4K);
...
quoted
+struct realm_params {
+	union { /* 0x0 */
+		struct {
+			u64 flags0;
+			u64 s2sz;
+			u64 sve_vl;
+			u64 num_bps;
+			u64 num_wps;
+			u64 pmu_num_ctrs;
+			u64 hash_algo;
+			u64 num_aux_planes;
+		};
+		u8 padding0[0x400];
The union + sizer concept is cool. Technically this one isn't a padding,
it's also a sizer? (same for the other structs below.
Yep, you're right. I have changed all in the file to sizer.
quoted
+	};
...
quoted
+};
+
+static_assert(sizeof(struct realm_params) == SZ_4K);
+
Does declaring this struct as packed matter? I guess the static_assert()
has the same effect.
I guess it doesn't, the fields are naturally aligned for the offset.
That said, I have added static_assert() for starting offsets for a
a group of related fields to match the spec.

e.g;

static_assert(offsetof(struct realm_params, rpv) == 0x400);
static_assert(offsetof(struct realm_params, rtt_base) == 0x808);
static_assert(offsetof(struct realm_params, aux_rtt_base) == 0xf80);



Thanks for the review !

Suzuki
quoted
[...snip...]
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help