summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMark Cave-Ayland <mark.caveayland@nutanix.com>2025-08-28 12:09:45 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2025-08-29 11:20:47 +0200
commit483a232e0431f19a4d6596be59c1d51370407249 (patch)
tree20ab43ac30f90df4a3373b8e56d38220409e1d37
parente1e2909f8e74051a34a044940f90d4650b6e784a (diff)
downloadfocaccia-qemu-483a232e0431f19a4d6596be59c1d51370407249.tar.gz
focaccia-qemu-483a232e0431f19a4d6596be59c1d51370407249.zip
hw/i386/pc_piix.c: restrict isapc machine to 3.5G memory
Since the isapc machine is now limited to using 32-bit CPUs, add a hard restriction
so that the machine cannot be started with more than 3.5G memory. This matches the
default value for max_ram_below_4g if not specified and provides consistent
behaviour betweem TCG and KVM accelerators.

Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
Link: https://lore.kernel.org/r/20250828111057.468712-3-mark.caveayland@nutanix.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--hw/i386/pc_piix.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 8f5fb3cf90..9a3b5d88f0 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -461,6 +461,12 @@ static void pc_init_isa(MachineState *machine)
         warn_report("-cpu host is invalid for isapc machine, using pentium3");
     }
 
+    if (machine->ram_size > 3.5 * GiB) {
+        error_report("Too much memory for this machine: %" PRId64 " MiB, "
+                     "maximum 3584 MiB", machine->ram_size / MiB);
+        exit(1);
+    }
+
     pc_init1(machine, NULL);
 }
 #endif