Re: [PATCH v17 0/7] firmware: arm_rmm: Add RMM v2.0 base RMI support

From: Gavin Shan

Date: Wed Sep 09 2026 - 07:10:39 EST


Hi Kohei,

On 9/8/26 2:09 PM, Kohei Enju wrote:

[...]


[1] RMM spec : https://support.arm.com/documentation/den0137/2-0bet3/
[2] This series: https://gitlab.arm.com/linux-arm/linux-cca.git cca/cca-host/fw_rmm/v17
[3] KVM CCA v17 integration branch: https://gitlab.arm.com/linux-arm/linux-cca.git cca/cca-host/kvm-integration/v17
[4] Gmem inplace conversion https://github.com/googleprodkernel/linux-cc/tree/guest_memfd-inplace-conversion-v12
[5] TF-RMM https://git.trustedfirmware.org/TF-RMM/tf-rmm.git main (commit: 134266ae)

I understand that QEMU-virt is not intended to model a realistic
production platform and that QEMU-SBSA is generally preferred. However,
I sometimes use QEMU-virt to test functionality quickly because it runs
slightly faster than QEMU-SBSA.

I tested this series with QEMU-virt and found that RMM initialization
failed during boot:

[...]
INFO: BL31: Initializing RMM
INFO: RMM init start.
ERROR: RMM init failed: -8
WARNING: BL31: RMM initialization failed

I also ran into same issue and attached TF-A patch leads to a successful
RMM initialization, please have a try to see if it can resolve your issue.


Thanks,
GavinFrom c22ddc4368650550845f862fc07cb35b998fbb23 Mon Sep 17 00:00:00 2001
From: Gavin Shan <gshan@xxxxxxxxxx>
Date: Wed, 9 Sep 2026 19:58:37 +1000
Subject: [PATCH] plat/qemu: add plat_rmmd_reserve_memory() for VIRT platform
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Gavin Shan <gshan@xxxxxxxxxx>
---
plat/qemu/qemu/include/platform_def.h | 3 +++
plat/qemu/qemu/plat_rmm_mem_carveout.c | 28 ++++++++++++++++++++++++++
plat/qemu/qemu/platform.mk | 4 ++++
3 files changed, 35 insertions(+)
create mode 100644 plat/qemu/qemu/plat_rmm_mem_carveout.c

diff --git a/plat/qemu/qemu/include/platform_def.h b/plat/qemu/qemu/include/platform_def.h
index 06018e7b2..c3ed986cf 100644
--- a/plat/qemu/qemu/include/platform_def.h
+++ b/plat/qemu/qemu/include/platform_def.h
@@ -368,6 +368,9 @@ CASSERT((PLAT_QEMU_L0_GPT_BASE & (PLAT_QEMU_L0_GPT_SIZE - 1)) == 0,
#define RMM_SHARED_BASE (RMM_LIMIT)
#define RMM_SHARED_SIZE PLAT_QEMU_RMM_SHARED_SIZE

+#define PLAT_ARM_RMM_PAYLOAD_SIZE UL(0x600000) /* 2 * 3MB */
+#define RMM_PAYLOAD_LIMIT (RMM_BASE + PLAT_ARM_RMM_PAYLOAD_SIZE)
+
/*
* We add the RMM_SHARED size to RMM mapping to map the region as a block.
* Else we end up requiring more pagetables in BL2 for ROMLIB build.
diff --git a/plat/qemu/qemu/plat_rmm_mem_carveout.c b/plat/qemu/qemu/plat_rmm_mem_carveout.c
new file mode 100644
index 000000000..c68ca243d
--- /dev/null
+++ b/plat/qemu/qemu/plat_rmm_mem_carveout.c
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2026, Arm Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <lib/spinlock.h>
+#include <plat/common/platform.h>
+
+static spinlock_t mem_reserve_lock;
+static uintptr_t top_mem = RMM_LIMIT;
+
+uintptr_t plat_rmmd_reserve_memory(size_t size, unsigned long alignment)
+{
+ uint64_t align_mask = alignment - 1;
+ uintptr_t addr;
+
+ spin_lock(&mem_reserve_lock);
+ addr = (top_mem - size) & ~align_mask;
+ if (addr >= RMM_PAYLOAD_LIMIT) {
+ top_mem = addr;
+ } else {
+ addr = 0;
+ }
+ spin_unlock(&mem_reserve_lock);
+
+ return addr;
+}
diff --git a/plat/qemu/qemu/platform.mk b/plat/qemu/qemu/platform.mk
index 2e12f6bca..655cc683a 100644
--- a/plat/qemu/qemu/platform.mk
+++ b/plat/qemu/qemu/platform.mk
@@ -175,6 +175,10 @@ BL31_SOURCES += plat/common/plat_spmd_manifest.c \
${FDT_WRAPPERS_SOURCES}
endif

+ifeq (${ENABLE_RMM},1)
+BL31_SOURCES += ${PLAT_QEMU_PATH}/plat_rmm_mem_carveout.c
+endif
+
ifneq (${ENABLE_FEAT_RNG_TRAP},0)
BL31_SOURCES += plat/qemu/qemu/qemu_sync_traps.c
endif
--
2.55.0