diff --git a/qemu/qemu.go b/qemu/qemu.go index a5e5dfaf9..ed211d3cc 100644 --- a/qemu/qemu.go +++ b/qemu/qemu.go @@ -51,6 +51,11 @@ type Machine struct { Options string } +const ( + // MachineTypeMicrovm is the QEMU microvm machine type for amd64 + MachineTypeMicrovm string = "microvm" +) + // Device is the qemu device interface. type Device interface { Valid() bool @@ -128,6 +133,10 @@ const ( func isDimmSupported(config *Config) bool { switch runtime.GOARCH { case "amd64", "386": + if config != nil && config.Machine.Type == MachineTypeMicrovm { + // microvm does not support NUMA + return false + } return true default: return false @@ -153,6 +162,9 @@ const ( func (transport VirtioTransport) defaultTransport(config *Config) VirtioTransport { switch runtime.GOARCH { case "amd64", "386": + if config != nil && config.Machine.Type == MachineTypeMicrovm { + return TransportMMIO + } return TransportPCI case "s390x": return TransportCCW diff --git a/qemu/qemu_test.go b/qemu/qemu_test.go index 02f9bd88c..f1de632c8 100644 --- a/qemu/qemu_test.go +++ b/qemu/qemu_test.go @@ -108,6 +108,14 @@ func TestAppendMachine(t *testing.T) { Options: "gic-version=host,usb=off", } testAppend(machine, machineString, t) + + machineString = "-machine microvm,accel=kvm,pic=off,pit=off" + machine = Machine{ + Type: "microvm", + Acceleration: "kvm", + Options: "pic=off,pit=off", + } + testAppend(machine, machineString, t) } func TestAppendEmptyMachine(t *testing.T) {