vendor: update govmm to bring iommu support

Bring support for vIOMMU. Commit:

7efaf0b1cd

https://github.com/intel/govmm/pull/127

Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
This commit is contained in:
Adrian Moreno 2020-06-09 16:16:07 +02:00 committed by Fabiano Fidêncio
parent 5c35e3e757
commit 03735fb9ee
3 changed files with 73 additions and 3 deletions

View File

@ -29,7 +29,7 @@ require (
github.com/gogo/protobuf v1.3.1
github.com/hashicorp/go-multierror v1.0.0
github.com/hashicorp/yamux v0.0.0-20190923154419-df201c70410d
github.com/intel/govmm v0.0.0-20200304142514-e969afbec52c
github.com/intel/govmm v0.0.0-20200602145448-7cc469641b7b
github.com/mdlayher/vsock v0.0.0-20191108225356-d9c65923cb8f
github.com/mitchellh/mapstructure v1.1.2
github.com/opencontainers/runc v1.0.0-rc9.0.20200102164712-2b52db75279c

View File

@ -130,6 +130,9 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/intel/govmm v0.0.0-20200304142514-e969afbec52c h1:hbbnB7xG1bSzUBqSTeNATPODx3CXM/omWUF8RMfFY5s=
github.com/intel/govmm v0.0.0-20200304142514-e969afbec52c/go.mod h1:QKGWoQtjvkvFtzP6ybiM3lxUHqf83Sv3oLqyELUKH4g=
github.com/intel/govmm v0.0.0-20200527135442-7efaf0b1cde3/go.mod h1:QKGWoQtjvkvFtzP6ybiM3lxUHqf83Sv3oLqyELUKH4g=
github.com/intel/govmm v0.0.0-20200602145448-7cc469641b7b h1:QqUb1HVk0Nb9zyzvIkMmhI7DP5gzyWPx/6md21M52U0=
github.com/intel/govmm v0.0.0-20200602145448-7cc469641b7b/go.mod h1:QKGWoQtjvkvFtzP6ybiM3lxUHqf83Sv3oLqyELUKH4g=
github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56/go.mod h1:ymszkNOg6tORTn+6F6j+Jc8TOr5osrynvN6ivFWZ2GA=
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=

View File

@ -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
@ -127,7 +132,11 @@ const (
func isDimmSupported(config *Config) bool {
switch runtime.GOARCH {
case "amd64", "386":
case "amd64", "386", "ppc64le":
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
@ -868,6 +880,9 @@ type SerialDevice struct {
// Transport is the virtio transport for this device.
Transport VirtioTransport
// MaxPorts is the maximum number of ports for this device.
MaxPorts uint
}
// Valid returns true if the SerialDevice structure is valid and complete.
@ -891,6 +906,9 @@ func (dev SerialDevice) QemuParams(config *Config) []string {
deviceParams = append(deviceParams, fmt.Sprintf(",id=%s", dev.ID))
if dev.Transport.isVirtioPCI(config) {
deviceParams = append(deviceParams, fmt.Sprintf(",romfile=%s", dev.ROMFile))
if dev.Driver == VirtioSerial && dev.MaxPorts != 0 {
deviceParams = append(deviceParams, fmt.Sprintf(",max_ports=%d", dev.MaxPorts))
}
}
if dev.Transport.isVirtioCCW(config) {
@ -1843,6 +1861,52 @@ func (b BalloonDevice) deviceName(config *Config) string {
return BalloonDeviceTransport[b.Transport]
}
// IommuDev represents a Intel IOMMU Device
type IommuDev struct {
Intremap bool
DeviceIotlb bool
CachingMode bool
}
// Valid returns true if the IommuDev is valid
func (dev IommuDev) Valid() bool {
return true
}
// deviceName the qemu device name
func (dev IommuDev) deviceName() string {
return "intel-iommu"
}
// QemuParams returns the qemu parameters built out of the IommuDev.
func (dev IommuDev) QemuParams(_ *Config) []string {
var qemuParams []string
var deviceParams []string
deviceParams = append(deviceParams, dev.deviceName())
if dev.Intremap {
deviceParams = append(deviceParams, "intremap=on")
} else {
deviceParams = append(deviceParams, "intremap=off")
}
if dev.DeviceIotlb {
deviceParams = append(deviceParams, "device-iotlb=on")
} else {
deviceParams = append(deviceParams, "device-iotlb=off")
}
if dev.CachingMode {
deviceParams = append(deviceParams, "caching-mode=on")
} else {
deviceParams = append(deviceParams, "caching-mode=off")
}
qemuParams = append(qemuParams, "-device")
qemuParams = append(qemuParams, strings.Join(deviceParams, ","))
return qemuParams
}
// RTCBaseType is the qemu RTC base time type.
type RTCBaseType string
@ -1864,6 +1928,9 @@ const (
// Host is for using the host clock as a reference.
Host RTCClock = "host"
// RT is for using the host monotonic clock as a reference.
RT RTCClock = "rt"
// VM is for using the guest clock as a reference
VM RTCClock = "vm"
)
@ -1890,7 +1957,7 @@ type RTC struct {
// Valid returns true if the RTC structure is valid and complete.
func (rtc RTC) Valid() bool {
if rtc.Clock != Host && rtc.Clock != VM {
if rtc.Clock != Host && rtc.Clock != RT && rtc.Clock != VM {
return false
}