From 13287c752e81e31b9cd28faa07ebdbf84c947394 Mon Sep 17 00:00:00 2001 From: jiangjianfeng Date: Fri, 11 Apr 2025 03:45:36 +0000 Subject: [PATCH] Make TDX accept the same virtio-net parameters as the normal setting --- OSDK.toml | 25 +------------------------ tools/qemu_args.sh | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 24 deletions(-) diff --git a/OSDK.toml b/OSDK.toml index 26783a1f..5915537c 100644 --- a/OSDK.toml +++ b/OSDK.toml @@ -47,30 +47,7 @@ supported_archs = ["x86_64"] build.features = ["cvm_guest"] boot.method = "grub-qcow2" grub.boot_protocol = "linux" -qemu.args = """\ - -name process=tdxvm,debug-threads=on \ - -m ${MEM:-8G} \ - -smp ${SMP:-1} \ - -vga none \ - -nographic \ - -monitor pty \ - -no-hpet \ - -nodefaults \ - -bios /usr/share/qemu/OVMF.fd \ - -object tdx-guest,sept-ve-disable=on,id=tdx,quote-generation-service=vsock:2:4050 \ - -cpu host,-kvm-steal-time,pmu=off \ - -machine q35,kernel_irqchip=split,confidential-guest-support=tdx,memory-backend=ram1 \ - -object memory-backend-memfd-private,id=ram1,size=${MEM:-8G} \ - -device virtio-net-pci,netdev=mynet0 \ - -device virtio-keyboard-pci,disable-legacy=on,disable-modern=off \ - -netdev user,id=mynet0,hostfwd=tcp::10027-:22 \ - -chardev stdio,id=mux,mux=on,logfile=qemu.log \ - -device virtio-serial,romfile= \ - -device virtconsole,chardev=mux \ - -device isa-debug-exit,iobase=0xf4,iosize=0x04 \ - -monitor chardev:mux \ - -serial chardev:mux \ -""" +qemu.args = "$(./tools/qemu_args.sh tdx)" [scheme."riscv"] boot.method = "qemu-direct" diff --git a/tools/qemu_args.sh b/tools/qemu_args.sh index 799b843a..4d893722 100755 --- a/tools/qemu_args.sh +++ b/tools/qemu_args.sh @@ -44,6 +44,36 @@ else NETDEV_ARGS="-nic none" fi +if [ "$1" = "tdx" ]; then + QEMU_ARGS="\ + -name process=tdxvm,debug-threads=on \ + -m ${MEM:-8G} \ + -smp ${SMP:-1} \ + -vga none \ + -nographic \ + -monitor pty \ + -no-hpet \ + -nodefaults \ + -bios /usr/share/qemu/OVMF.fd \ + -object tdx-guest,sept-ve-disable=on,id=tdx,quote-generation-service=vsock:2:4050 \ + -cpu host,-kvm-steal-time,pmu=off \ + -machine q35,kernel_irqchip=split,confidential-guest-support=tdx,memory-backend=ram1 \ + -object memory-backend-memfd-private,id=ram1,size=${MEM:-8G} \ + -device virtio-net-pci,netdev=net01,disable-legacy=on,disable-modern=off$VIRTIO_NET_FEATURES \ + -device virtio-keyboard-pci,disable-legacy=on,disable-modern=off \ + $NETDEV_ARGS \ + $QEMU_OPT_ARG_DUMP_PACKETS \ + -chardev stdio,id=mux,mux=on,logfile=qemu.log \ + -device virtio-serial,romfile= \ + -device virtconsole,chardev=mux \ + -device isa-debug-exit,iobase=0xf4,iosize=0x04 \ + -monitor chardev:mux \ + -serial chardev:mux \ + " + echo $QEMU_ARGS + exit 0 +fi + COMMON_QEMU_ARGS="\ -cpu Icelake-Server,+x2apic \ -smp ${SMP:-1} \