From 1c20ed12c1126568534e9ff702a0146dbe0fa7b5 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Tue, 11 May 2021 13:56:44 +0200 Subject: [PATCH] qemu: sanity check misconfigured memory for okl4 Issue #4095 --- repos/gems/run/depot_autopilot.run | 2 +- repos/gems/run/driver_manager.run | 1 - repos/gems/run/sculpt_test.run | 2 +- repos/gems/run/ssh_terminal.run | 2 +- repos/libports/run/mupdf.run | 2 +- repos/os/run/block_request_stream.run | 2 +- repos/os/run/block_tester.run | 2 +- repos/os/run/nvme.run | 2 +- repos/ports/run/tool_chain_auto.run | 2 +- repos/ports/run/virtualbox.run | 2 +- tool/run/power_on/qemu | 26 ++++++++++++++++++++------ 11 files changed, 29 insertions(+), 16 deletions(-) diff --git a/repos/gems/run/depot_autopilot.run b/repos/gems/run/depot_autopilot.run index bd49ead80b..060a31fe4e 100644 --- a/repos/gems/run/depot_autopilot.run +++ b/repos/gems/run/depot_autopilot.run @@ -456,7 +456,7 @@ proc prepare_to_run_genode { } { set serial_id -1 set timeout 40 - append qemu_args "-m 768 -nographic " + append qemu_args "-m 800 -nographic " } diff --git a/repos/gems/run/driver_manager.run b/repos/gems/run/driver_manager.run index de875dd367..8efad0b9a0 100644 --- a/repos/gems/run/driver_manager.run +++ b/repos/gems/run/driver_manager.run @@ -164,7 +164,6 @@ if {[have_include "power_on/qemu"]} { # # Qemu opts for supplying hdd_disk.raw as AHCI disk # -append qemu_args " -m 128 " append qemu_args " -nographic " append qemu_args " -device ahci,id=ahci " append qemu_args " -drive id=hdd,file=bin/hdd_disk.raw,format=raw,if=none -device ide-hd,drive=hdd,bus=ahci.1 " diff --git a/repos/gems/run/sculpt_test.run b/repos/gems/run/sculpt_test.run index 7e58e2e4d3..b3e3268516 100644 --- a/repos/gems/run/sculpt_test.run +++ b/repos/gems/run/sculpt_test.run @@ -4,7 +4,7 @@ source ${genode_dir}/repos/gems/run/sculpt.run # enable Qemu networking, usable via the nic_drv append_qemu_nic_args -append qemu_args " -m 768 " +append qemu_args " -m 1024 " # attach small SATA disk to Qemu to experiment with file-system access set disk_image "bin/sculpt-ahci.raw" diff --git a/repos/gems/run/ssh_terminal.run b/repos/gems/run/ssh_terminal.run index 2679461077..6d32e99195 100644 --- a/repos/gems/run/ssh_terminal.run +++ b/repos/gems/run/ssh_terminal.run @@ -240,7 +240,7 @@ build_boot_image $boot_modules # Execute test # -append qemu_args " -m 512 -nographic " +append qemu_args " -nographic " append_qemu_nic_args "hostfwd=tcp::5555-:22" set lxip_match_string "ipaddr=(\[0-9\]+\.\[0-9\]+\.\[0-9\]+\.\[0-9\]+).*\n" diff --git a/repos/libports/run/mupdf.run b/repos/libports/run/mupdf.run index 7a385922e4..32be5c1764 100644 --- a/repos/libports/run/mupdf.run +++ b/repos/libports/run/mupdf.run @@ -128,7 +128,7 @@ append boot_modules { build_boot_image $boot_modules -append qemu_args " -m 768" +append qemu_args " -m 800" run_genode_until forever diff --git a/repos/os/run/block_request_stream.run b/repos/os/run/block_request_stream.run index 673de36b7d..a8d0d0d4a2 100644 --- a/repos/os/run/block_request_stream.run +++ b/repos/os/run/block_request_stream.run @@ -62,6 +62,6 @@ install_config { build_boot_image { core init timer block_tester test-block_request_stream ld.lib.so } -append qemu_args " -nographic -m 512 " +append qemu_args " -nographic " run_genode_until {.*child "block_tester" exited with exit value 0.*\n} 360 diff --git a/repos/os/run/block_tester.run b/repos/os/run/block_tester.run index a8a6defb8c..5a9a401491 100644 --- a/repos/os/run/block_tester.run +++ b/repos/os/run/block_tester.run @@ -355,7 +355,7 @@ append_platform_drv_boot_modules build_boot_image $boot_modules -append qemu_args " -nographic -m 512 -nographic" +append qemu_args " -nographic -nographic" append qemu_args " -drive id=disk,file=bin/block0.raw,format=raw,if=none \ -drive id=disk2,file=bin/block1.raw,format=raw,if=none \ -device ahci,id=ahci -device ide-hd,drive=disk,bus=ahci.0 \ diff --git a/repos/os/run/nvme.run b/repos/os/run/nvme.run index 3029789348..a3a7aa0f86 100644 --- a/repos/os/run/nvme.run +++ b/repos/os/run/nvme.run @@ -194,7 +194,7 @@ append_platform_drv_boot_modules build_boot_image $boot_modules -append qemu_args " -nographic -m 512 " +append qemu_args " -nographic " append qemu_args " -drive id=nvme0,file=bin/nvme.raw,format=raw,if=none " append qemu_args " -device nvme,drive=nvme0,serial=fnord,id=nvme0n1 " diff --git a/repos/ports/run/tool_chain_auto.run b/repos/ports/run/tool_chain_auto.run index 4c2d662b84..7dac23e4eb 100644 --- a/repos/ports/run/tool_chain_auto.run +++ b/repos/ports/run/tool_chain_auto.run @@ -251,7 +251,7 @@ lappend boot_modules libc.lib.so vfs.lib.so vfs_pipe.lib.so vfs build_boot_image $boot_modules -append qemu_args " -nographic -m 768 " +append qemu_args " -nographic -m 800 " # wait until Noux started run_genode_until {.*\[init -> vfs\] creating build directory\.\.\..*\n} $boot_timeout diff --git a/repos/ports/run/virtualbox.run b/repos/ports/run/virtualbox.run index c963e817da..bc04c5c1a4 100644 --- a/repos/ports/run/virtualbox.run +++ b/repos/ports/run/virtualbox.run @@ -309,7 +309,7 @@ if {[have_include "power_on/qemu"]} { if {[expr $use_gui]} { append qemu_args " -m 2048 " } else { - append qemu_args " -m 768 " + append qemu_args " -m 1024 " } append qemu_args " -cpu phenom " diff --git a/tool/run/power_on/qemu b/tool/run/power_on/qemu index 880c5f21e9..1d328badad 100644 --- a/tool/run/power_on/qemu +++ b/tool/run/power_on/qemu @@ -121,14 +121,28 @@ proc run_power_on { } { # on x86, we support booting via pxe or iso/disk image if {[have_board pc]} { - if {![regexp -- {-m} $qemu_args dummy]} { - if {[have_spec okl4]} { - # okl4 system integration specifies RAM from 32 to 800 MiB - append qemu_args " -m 800 " - } else { - append qemu_args " -m 512 " + if {[have_spec okl4]} { + # okl4 system integration specifies RAM from 32 to 800 MiB + set qemu_ram 800 + } else { + set qemu_ram 512 + } + + if {[regexp -- {-m} $qemu_args dummy]} { + set qemu_ram [regexp -inline {\-m.[0-9]+} $qemu_args] + set qemu_ram [regexp -inline {[0-9]+} $qemu_ram] + } + + if {[have_spec okl4]} { + if {$qemu_ram < 800} { + puts "Configured memory ($qemu_ram) for OKL4 on Qemu must be at least 800M\n" + exit 1 } } + + append qemu_args " -m $qemu_ram " + + if {[have_include "load/tftp"]} { append qemu_args " -boot n -tftp [run_dir] -bootp boot/pulsar -no-reboot -no-shutdown " } else {