diff --git a/src/runtime/go.mod b/src/runtime/go.mod index 22d69514c5..df9c2d2228 100644 --- a/src/runtime/go.mod +++ b/src/runtime/go.mod @@ -31,7 +31,7 @@ require ( github.com/gogo/googleapis v1.4.0 // indirect github.com/gogo/protobuf v1.3.1 github.com/hashicorp/go-multierror v1.0.0 - github.com/kata-containers/govmm v0.0.0-20210112013750-7d320e8f5dca + github.com/kata-containers/govmm v0.0.0-20210329205824-7fbc685865d2 github.com/mdlayher/vsock v0.0.0-20191108225356-d9c65923cb8f github.com/opencontainers/image-spec v1.0.1 // indirect github.com/opencontainers/runc v1.0.0-rc9.0.20200102164712-2b52db75279c diff --git a/src/runtime/go.sum b/src/runtime/go.sum index 1937048b4e..46e7d2b003 100644 --- a/src/runtime/go.sum +++ b/src/runtime/go.sum @@ -276,6 +276,8 @@ github.com/juju/testing v0.0.0-20190613124551-e81189438503/go.mod h1:63prj8cnj0t github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kata-containers/govmm v0.0.0-20210112013750-7d320e8f5dca h1:UdXFthwasAPnmv37gLJUEFsW9FaabYA+mM6FoSi8kzU= github.com/kata-containers/govmm v0.0.0-20210112013750-7d320e8f5dca/go.mod h1:VmAHbsL5lLfzHW/MNL96NVLF840DNEV5i683kISgFKk= +github.com/kata-containers/govmm v0.0.0-20210329205824-7fbc685865d2 h1:oDJsQ5avmW8PFUkSJdsuaGL3SR4/YQRno51GNGl+IDU= +github.com/kata-containers/govmm v0.0.0-20210329205824-7fbc685865d2/go.mod h1:VmAHbsL5lLfzHW/MNL96NVLF840DNEV5i683kISgFKk= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= diff --git a/src/runtime/vendor/github.com/kata-containers/govmm/qemu/qemu.go b/src/runtime/vendor/github.com/kata-containers/govmm/qemu/qemu.go index 9cfe39cbd1..53ac898407 100644 --- a/src/runtime/vendor/github.com/kata-containers/govmm/qemu/qemu.go +++ b/src/runtime/vendor/github.com/kata-containers/govmm/qemu/qemu.go @@ -131,6 +131,9 @@ const ( // PCIeRootPort is a PCIe Root Port, the PCIe device should be hotplugged to this port. PCIeRootPort DeviceDriver = "pcie-root-port" + + // Loader is the Loader device driver. + Loader DeviceDriver = "loader" ) func isDimmSupported(config *Config) bool { @@ -552,7 +555,7 @@ func (cdev CharDevice) QemuParams(config *Config) []string { cdevParams = append(cdevParams, string(cdev.Backend)) cdevParams = append(cdevParams, fmt.Sprintf(",id=%s", cdev.ID)) if cdev.Backend == Socket { - cdevParams = append(cdevParams, fmt.Sprintf(",path=%s,server,nowait", cdev.Path)) + cdevParams = append(cdevParams, fmt.Sprintf(",path=%s,server=on,wait=off", cdev.Path)) } else { cdevParams = append(cdevParams, fmt.Sprintf(",path=%s", cdev.Path)) } @@ -1138,6 +1141,40 @@ func (dev PVPanicDevice) QemuParams(config *Config) []string { return []string{"-device", "pvpanic"} } +// LoaderDevice represents a qemu loader device. +type LoaderDevice struct { + File string + ID string +} + +// Valid returns true if there is a valid structure defined for LoaderDevice +func (dev LoaderDevice) Valid() bool { + if dev.File == "" { + return false + } + + if dev.ID == "" { + return false + } + + return true +} + +// QemuParams returns the qemu parameters built out of this loader device. +func (dev LoaderDevice) QemuParams(config *Config) []string { + var qemuParams []string + var devParams []string + + devParams = append(devParams, "loader") + devParams = append(devParams, fmt.Sprintf("file=%s", dev.File)) + devParams = append(devParams, fmt.Sprintf("id=%s", dev.ID)) + + qemuParams = append(qemuParams, "-device") + qemuParams = append(qemuParams, strings.Join(devParams, ",")) + + return qemuParams +} + // VhostUserDevice represents a qemu vhost-user device meant to be passed // in to the guest type VhostUserDevice struct { @@ -2385,9 +2422,9 @@ func (config *Config) appendQMPSockets() { qmpParams := append([]string{}, fmt.Sprintf("%s:", q.Type)) qmpParams = append(qmpParams, q.Name) if q.Server { - qmpParams = append(qmpParams, ",server") + qmpParams = append(qmpParams, ",server=on") if q.NoWait { - qmpParams = append(qmpParams, ",nowait") + qmpParams = append(qmpParams, ",wait=off") } } @@ -2528,9 +2565,6 @@ func (config *Config) appendMemoryKnobs() { if config.Memory.Size == "" { return } - if !isDimmSupported(config) { - return - } var objMemParam, numaMemParam string dimmName := "dimm1" if config.Knobs.HugePages { @@ -2553,8 +2587,13 @@ func (config *Config) appendMemoryKnobs() { config.qemuParams = append(config.qemuParams, "-object") config.qemuParams = append(config.qemuParams, objMemParam) - config.qemuParams = append(config.qemuParams, "-numa") - config.qemuParams = append(config.qemuParams, numaMemParam) + if isDimmSupported(config) { + config.qemuParams = append(config.qemuParams, "-numa") + config.qemuParams = append(config.qemuParams, numaMemParam) + } else { + config.qemuParams = append(config.qemuParams, "-machine") + config.qemuParams = append(config.qemuParams, "memory-backend="+dimmName) + } } func (config *Config) appendKnobs() { diff --git a/src/runtime/vendor/modules.txt b/src/runtime/vendor/modules.txt index 8bdde57b7e..aceaac2a95 100644 --- a/src/runtime/vendor/modules.txt +++ b/src/runtime/vendor/modules.txt @@ -222,7 +222,7 @@ github.com/hashicorp/errwrap # github.com/hashicorp/go-multierror v1.0.0 ## explicit github.com/hashicorp/go-multierror -# github.com/kata-containers/govmm v0.0.0-20210112013750-7d320e8f5dca +# github.com/kata-containers/govmm v0.0.0-20210329205824-7fbc685865d2 ## explicit github.com/kata-containers/govmm/qemu # github.com/konsorten/go-windows-terminal-sequences v1.0.1