patches and low-level development discussion
 help / color / mirror / code / Atom feed
From: Demi Marie Obenour <demiobenour@gmail.com>
To: Spectrum OS Development <devel@spectrum-os.org>
Cc: Alyssa Ross <hi@alyssa.is>, Demi Marie Obenour <demiobenour@gmail.com>
Subject: [PATCH] vm: do not require KVM to run QEMU
Date: Thu, 07 Aug 2025 14:21:37 -0400	[thread overview]
Message-ID: <20250807-no-require-kvm-v1-1-5dec3fbaef7b@gmail.com> (raw)

This prevented running QEMU on Qubes OS.

Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
---
 img/app/Makefile    | 2 +-
 scripts/run-qemu.sh | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/img/app/Makefile b/img/app/Makefile
index 5380ffb76e7bdf8867dcb61560d77028bf910fa3..e458ffebb7db0718007dd15af6a17dda74d36d0a 100644
--- a/img/app/Makefile
+++ b/img/app/Makefile
@@ -148,7 +148,7 @@ start-virtiofsd: scripts/start-virtiofsd.elb
 .PHONY: start-virtiofsd
 
 run-qemu: $(imgdir)/appvm/blk/root.img start-vhost-user-net start-virtiofsd
-	@../../scripts/run-qemu.sh -m 256 -cpu host -kernel $(KERNEL) -vga none \
+	@../../scripts/run-qemu.sh -m 256 -kernel $(KERNEL) -vga none \
 	    -drive file=$(imgdir)/appvm/blk/root.img,if=virtio,format=raw,readonly=on \
 	    -append "root=PARTLABEL=root nokaslr" \
 	    -gdb unix:build/gdb.sock,server,nowait \
diff --git a/scripts/run-qemu.sh b/scripts/run-qemu.sh
index 64fd29259ab108bc547cb7c74623ae9dc288b3b7..9fa240aed44822a0aff295d246cb23a0e1cf7b8a 100755
--- a/scripts/run-qemu.sh
+++ b/scripts/run-qemu.sh
@@ -5,6 +5,8 @@
 # This script wraps around QEMU to paper over platform differences,
 # which can't be handled portably in Make language.
 
+cpu='-cpu host'
+if [ ! -f /dev/kvm ]; then cpu=; fi
 case "${ARCH:="$(uname -m)"}" in
 	aarch64)
 		machine=virt,accel=kvm:tcg,gic-version=3,iommu=smmuv3
@@ -51,7 +53,7 @@ while [ $i -lt $# ]; do
 					virtualization=on)
 						case "$ARCH" in
 							aarch64)
-								opt="$opt,accel=tcg"
+								opt="$opt,accel=tcg" cpu=
 								;;
 							*)
 								continue
@@ -88,4 +90,5 @@ exec ${QEMU_SYSTEM:-qemu-system-$ARCH} \
 	-machine "$machine" \
 	${kernel:+${append:+-append "$append"}} \
 	${iommu:+-device "$iommu"} \
+	$cpu \
 	"$@"

---
base-commit: 39baa378367d95fac6ce4d0140b25203b2ee9b53
change-id: 20250807-no-require-kvm-c6755f4ade76
-- 
Sincerely,
Demi Marie Obenour (she/her/hers)


             reply	other threads:[~2025-08-07 18:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-07 18:21 Demi Marie Obenour [this message]
2025-08-14 12:50 ` [PATCH] Use -cpu max instead of -cpu host Alyssa Ross
2025-08-14 21:20   ` Demi Marie Obenour
2025-08-15  7:13     ` Alyssa Ross
2025-08-15  7:12   ` Alyssa Ross

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=20250807-no-require-kvm-v1-1-5dec3fbaef7b@gmail.com \
    --to=demiobenour@gmail.com \
    --cc=devel@spectrum-os.org \
    --cc=hi@alyssa.is \
    /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.
Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).