runtime: update GoVMM for memory backend support

Update GoVMM to get memory backend support for non-DIMM setups. This is
necessary for virtio-fs on s390x.

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
This commit is contained in:
Jakob Naucke
2021-03-31 13:22:25 +02:00
parent 34becbf289
commit 67ac4f4585
4 changed files with 51 additions and 10 deletions

View File

@@ -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() {