qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2] hw/arm/sbsa-ref: Require at least 2 GiB of RAM when RME featu


From: Philippe Mathieu-Daudé
Subject: [PATCH v2] hw/arm/sbsa-ref: Require at least 2 GiB of RAM when RME feature enabled
Date: Wed, 4 Dec 2024 21:56:07 +0100

We are working on adding RME support to SBSA Reference Platform.
When RME is enabled then RMM (Realm Managment Monitor) takes 1072MB of
memory for own use. Which ends with firmware panic on 1GB machine.

Report an error so users directly start with more RAM in this case:

  $ qemu-system-aarch64 -M sbsa-ref -m 1G -cpu max,x-rme=on
  qemu-system-aarch64: sbsa-ref: RME feature requires at least 2GB of RAM

Reported-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
Suggested-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
v1: 
https://lore.kernel.org/qemu-devel/20241126084928.252067-1-marcin.juszkiewicz@linaro.org/
---
 hw/arm/sbsa-ref.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
index e3195d54497..66751d0806c 100644
--- a/hw/arm/sbsa-ref.c
+++ b/hw/arm/sbsa-ref.c
@@ -51,6 +51,7 @@
 #include "qapi/qmp/qlist.h"
 #include "qom/object.h"
 #include "target/arm/cpu-qom.h"
+#include "target/arm/cpu-features.h"
 #include "target/arm/gtimer.h"
 
 #define RAMLIMIT_GB 8192
@@ -795,6 +796,12 @@ static void sbsa_ref_init(MachineState *machine)
         object_unref(cpuobj);
     }
 
+    if (cpu_isar_feature(aa64_rme, ARM_CPU(qemu_get_cpu(0)))
+            && machine->ram_size < 2 * GiB) {
+        error_report("sbsa-ref: RME feature requires at least 2GB of RAM");
+        exit(1);
+    }
+
     memory_region_add_subregion(sysmem, sbsa_ref_memmap[SBSA_MEM].base,
                                 machine->ram);
 
-- 
2.45.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]