Linux Confidential Computing Development
 help / color / mirror / Atom feed
From: Gavin Shan <gshan@redhat.com>
To: Kohei Enju <enju.kohei@fujitsu.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: kvm@vger.kernel.org, kvmarm@lists.linux.dev, maz@kernel.org,
	will@kernel.org, catalin.marinas@arm.com,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, steven.price@arm.com,
	aneesh.kumar@kernel.org, oupton@kernel.org, joey.gouly@arm.com,
	tabba@google.com, yuzenghui@huawei.com,
	linux-coco@lists.linux.dev, gankulkarni@os.amperecomputing.com,
	sdonthineni@nvidia.com, alpergun@google.com,
	fj0570is@fujitsu.com, WeiLin.Chang@arm.com,
	lpieralisi@kernel.org
Subject: Re: [PATCH v17 0/7] firmware: arm_rmm: Add RMM v2.0 base RMI support
Date: Wed, 9 Sep 2026 20:52:33 +1000	[thread overview]
Message-ID: <9086ca6a-5dce-493f-ac76-487dedc60758@redhat.com> (raw)
In-Reply-To: <ap-C6NLnxuWWTMzi@FCCLS0092175.localdomain>

[-- Attachment #1: Type: text/plain, Size: 1223 bytes --]

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,
Gavin

[-- Attachment #2: tf-a.patch --]
[-- Type: text/x-patch, Size: 2620 bytes --]

From c22ddc4368650550845f862fc07cb35b998fbb23 Mon Sep 17 00:00:00 2001
From: Gavin Shan <gshan@redhat.com>
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@redhat.com>
---
 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


  parent reply	other threads:[~2026-09-09 10:52 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-07  9:59 [PATCH v17 0/7] firmware: arm_rmm: Add RMM v2.0 base RMI support Suzuki K Poulose
2026-09-07  9:59 ` [PATCH v17 1/7] firmware: arm_rmm: Add SMC definitions for calling the RMM Suzuki K Poulose
2026-09-08  6:19   ` Gavin Shan
2026-09-08 10:37     ` Suzuki K Poulose
2026-09-08 22:41       ` Gavin Shan
2026-09-09  8:39         ` Suzuki K Poulose
2026-09-10  9:47           ` Gavin Shan
2026-09-10  9:54             ` Suzuki K Poulose
2026-09-07  9:59 ` [PATCH v17 2/7] firmware: arm_rmm: Check for RMI support at init Suzuki K Poulose
2026-09-08  6:46   ` Gavin Shan
2026-09-08  9:49     ` Suzuki K Poulose
2026-09-07  9:59 ` [PATCH v17 3/7] firmware: arm_rmm: Configure the RMM with the host's page size Suzuki K Poulose
2026-09-08  7:04   ` Gavin Shan
2026-09-08  8:00     ` Kohei Enju
2026-09-08 10:59       ` Gavin Shan
2026-09-09  2:01         ` Kohei Enju
2026-09-08 10:43     ` Suzuki K Poulose
2026-09-07  9:59 ` [PATCH v17 4/7] firmware: arm_rmm: Add support for SRO Suzuki K Poulose
2026-09-09  4:10   ` Gavin Shan
2026-09-10  9:51     ` Suzuki K Poulose
2026-09-07  9:59 ` [PATCH v17 5/7] firmware: arm_rmm: Activate the RMM Suzuki K Poulose
2026-09-09  4:29   ` Gavin Shan
2026-09-09  8:25     ` Suzuki K Poulose
2026-09-07  9:59 ` [PATCH v17 6/7] firmware: arm_rmm: Ensure the RMM has GPT entries for memory Suzuki K Poulose
2026-09-09  6:40   ` Gavin Shan
2026-09-09  8:33     ` Suzuki K Poulose
2026-09-07  9:59 ` [PATCH v17 7/7] firmware: arm_rmm: Add wrappers for Realm related RMI commands Suzuki K Poulose
2026-09-09  7:15   ` Gavin Shan
2026-09-09  8:55     ` Suzuki K Poulose
2026-09-08  4:09 ` [PATCH v17 0/7] firmware: arm_rmm: Add RMM v2.0 base RMI support Kohei Enju
2026-09-08  5:46   ` Suzuki K Poulose
2026-09-08  7:30     ` Kohei Enju
2026-09-09 10:52   ` Gavin Shan [this message]
2026-09-10  4:51     ` 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=9086ca6a-5dce-493f-ac76-487dedc60758@redhat.com \
    --to=gshan@redhat.com \
    --cc=WeiLin.Chang@arm.com \
    --cc=alpergun@google.com \
    --cc=aneesh.kumar@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=enju.kohei@fujitsu.com \
    --cc=fj0570is@fujitsu.com \
    --cc=gankulkarni@os.amperecomputing.com \
    --cc=joey.gouly@arm.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=maz@kernel.org \
    --cc=oupton@kernel.org \
    --cc=sdonthineni@nvidia.com \
    --cc=steven.price@arm.com \
    --cc=suzuki.poulose@arm.com \
    --cc=tabba@google.com \
    --cc=will@kernel.org \
    --cc=yuzenghui@huawei.com \
    /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