From 2e88901b2843afa2bea9e4dad110324b3fc39982 Mon Sep 17 00:00:00 2001 From: Luigi Leonardi Date: Wed, 3 Jun 2026 10:20:34 +0200 Subject: [PATCH 1/2] scripts/launch_guest: use `memory-backend-ram` for nocc mode `memory-backend-memfd` is required for `guest_memfd`. Since `nocc` mode does not boot a confidential guest, `guest_memfd` is not needed, and a portable memory backend can be used instead. Being a linux-specific backend, this prevents booting SVSM on a different operating system. Also, remove `reserve` from the backend parameters, that is linux-specific and not needed in nocc mode. This is preliminary work to allow SVSM to boot on macOS using tcg. Suggested-by: Stefano Garzarella Signed-off-by: Luigi Leonardi --- scripts/launch_guest.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/launch_guest.sh b/scripts/launch_guest.sh index ab9ded3fe8..18178516db 100755 --- a/scripts/launch_guest.sh +++ b/scripts/launch_guest.sh @@ -29,6 +29,7 @@ CPU=EPYC-v4 ACCEL=kvm IGVM_OBJ="" SNAPSHOT="on" +MEMORY_SIZE="8G" STATE_DEVICE="" VSOCK_DEVICE="" @@ -138,6 +139,7 @@ case "$CGS" in nocc) SNP_GUEST="" CPU=max,smep=on + MEMORY=memory-backend-ram,size=$MEMORY_SIZE,id=mem0,prealloc=false if (( QEMU_MAJOR < 11 )); then ACCEL=tcg SNP_GUEST="-object nocc,id=cgs0" @@ -145,6 +147,7 @@ case "$CGS" in ;; sev) SNP_GUEST="-object sev-snp-guest,id=cgs0,cbitpos=$C_BIT_POS,reduced-phys-bits=$REDUCED_PHYS_BITS" + MEMORY=memory-backend-memfd,size=$MEMORY_SIZE,id=mem0,share=true,prealloc=false,reserve=false ;; *) echo "Error: Unexpected CGS value '$CGS'" @@ -154,7 +157,6 @@ MACHINE=q35,memory-backend=mem0,igvm-cfg=igvm0,accel=$ACCEL [ -n "$SNP_GUEST" ] && MACHINE+=",confidential-guest-support=cgs0" [ -n "$VIRTIO_ENABLE" ] && MACHINE+=",${VIRTIO_ENABLE}" -MEMORY=memory-backend-memfd,size=8G,id=mem0,share=true,prealloc=false,reserve=false IGVM_OBJ="-object igvm-cfg,id=igvm0,file=$IGVM" # Setup a disk if an image has been specified From 9820192d4507a47fdd3fee904e4fcc5c0ad7df32 Mon Sep 17 00:00:00 2001 From: Luigi Leonardi Date: Wed, 3 Jun 2026 10:58:46 +0200 Subject: [PATCH 2/2] scripts/launch_guest: replace grep -P with portable sed `grep -P` is a GNU grep extension not available on macOS and *BSD, where the system grep is BSD grep. Replace it with an equivalent `sed` expression to extract the QEMU version string. Signed-off-by: Luigi Leonardi --- scripts/launch_guest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/launch_guest.sh b/scripts/launch_guest.sh index 18178516db..0d4be91e76 100755 --- a/scripts/launch_guest.sh +++ b/scripts/launch_guest.sh @@ -124,7 +124,7 @@ fi KERNEL_VERSION=$(uname -r) # Split the QEMU version number so we can specify the correct parameters -QEMU_VERSION=$($QEMU --version | grep -Po '(?<=version )[^ ]+') +QEMU_VERSION=$($QEMU --version | sed -n 's/.*version \([^ ]*\).*/\1/p') QEMU_MAJOR=${QEMU_VERSION%%.*} QEMU_BUILD=${QEMU_VERSION##*.} QEMU_MINOR=${QEMU_VERSION##"$QEMU_MAJOR".}