Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

Commit

Permalink
Merge pull request #121 from merwick/microvm
Browse files Browse the repository at this point in the history
qemu: Add microvm machine type support
  • Loading branch information
Julio Montes committed Apr 24, 2020
2 parents e969afb + 787c86b commit f6f627a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
12 changes: 12 additions & 0 deletions qemu/qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 8 additions & 0 deletions qemu/qemu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit f6f627a

Please sign in to comment.