runtime: Re-vendor GoVMM for VFIO-AP support

This is a re-vendor of intel/govmm, with support for hot-plugging IBM
Adjunct Processor (AP) devices over VFIO. This is necessary for
enabling AP device pass-through in Kata (see #491).

    39c372a Add support for hot-plugging IBM VFIO-AP devices
    f5bdd53 travis: disable amd64 jobs
    1af1c0d github: enable github actions
    4831c6e travis: Run coveralls after success
    cf0f05d qemu: add iommu_platform knob for qemuParams
    175ac49 typo fix

Fixes: #565

Signed-off-by: Jakob-Naucke <jakob.naucke@ibm.com>
This commit is contained in:
Jakob-Naucke
2020-08-25 10:31:04 +02:00
parent 29aae01779
commit 4c30b2554f
5 changed files with 41 additions and 3 deletions

View File

@@ -123,6 +123,9 @@ const (
// VfioCCW is the vfio driver with CCW transport.
VfioCCW DeviceDriver = "vfio-ccw"
// VfioAP is the vfio driver with AP transport.
VfioAP DeviceDriver = "vfio-ap"
// VHostVSockPCI is a generic Vsock vhost device with PCI transport.
VHostVSockPCI DeviceDriver = "vhost-vsock-pci"
@@ -406,6 +409,9 @@ func (fsdev FSDevice) QemuParams(config *Config) []string {
deviceParams = append(deviceParams, fmt.Sprintf(",romfile=%s", fsdev.ROMFile))
}
if fsdev.Transport.isVirtioCCW(config) {
if config.Knobs.IOMMUPlatform {
deviceParams = append(deviceParams, ",iommu_platform=on")
}
deviceParams = append(deviceParams, fmt.Sprintf(",devno=%s", fsdev.DevNo))
}
@@ -537,6 +543,9 @@ func (cdev CharDevice) QemuParams(config *Config) []string {
}
if cdev.Driver == VirtioSerial && cdev.Transport.isVirtioCCW(config) {
if config.Knobs.IOMMUPlatform {
deviceParams = append(deviceParams, ",iommu_platform=on")
}
deviceParams = append(deviceParams, fmt.Sprintf(",devno=%s", cdev.DevNo))
}
@@ -804,6 +813,9 @@ func (netdev NetDevice) QemuDeviceParams(config *Config) []string {
}
if netdev.Transport.isVirtioCCW(config) {
if config.Knobs.IOMMUPlatform {
deviceParams = append(deviceParams, ",iommu_platform=on")
}
deviceParams = append(deviceParams, fmt.Sprintf(",devno=%s", netdev.DevNo))
}
@@ -937,6 +949,9 @@ func (dev SerialDevice) QemuParams(config *Config) []string {
}
if dev.Transport.isVirtioCCW(config) {
if config.Knobs.IOMMUPlatform {
deviceParams = append(deviceParams, ",iommu_platform=on")
}
deviceParams = append(deviceParams, fmt.Sprintf(",devno=%s", dev.DevNo))
}
@@ -1528,6 +1543,9 @@ func (scsiCon SCSIController) QemuParams(config *Config) []string {
}
if scsiCon.Transport.isVirtioCCW(config) {
if config.Knobs.IOMMUPlatform {
devParams = append(devParams, ",iommu_platform=on")
}
devParams = append(devParams, fmt.Sprintf("devno=%s", scsiCon.DevNo))
}
@@ -1710,6 +1728,9 @@ func (vsock VSOCKDevice) QemuParams(config *Config) []string {
}
if vsock.Transport.isVirtioCCW(config) {
if config.Knobs.IOMMUPlatform {
deviceParams = append(deviceParams, ",iommu_platform=on")
}
deviceParams = append(deviceParams, fmt.Sprintf(",devno=%s", vsock.DevNo))
}
@@ -1780,6 +1801,9 @@ func (v RngDevice) QemuParams(config *Config) []string {
}
if v.Transport.isVirtioCCW(config) {
if config.Knobs.IOMMUPlatform {
deviceParams = append(deviceParams, ",iommu_platform=on")
}
deviceParams = append(deviceParams, fmt.Sprintf("devno=%s", v.DevNo))
}
@@ -2125,6 +2149,9 @@ type Knobs struct {
// Exit instead of rebooting
NoReboot bool
// IOMMUPlatform will enable IOMMU for supported devices
IOMMUPlatform bool
}
// IOThread allows IO to be performed on a separate thread.

View File

@@ -281,7 +281,7 @@ func (q *QMP) readLoop(fromVMCh chan<- []byte) {
fromVMCh <- sendLine
}
q.cfg.Logger.Infof("sanner return error: %v", scanner.Err())
q.cfg.Logger.Infof("scanner return error: %v", scanner.Err())
close(fromVMCh)
}
@@ -1217,6 +1217,15 @@ func (q *QMP) ExecutePCIVFIOMediatedDeviceAdd(ctx context.Context, devID, sysfsd
return q.executeCommand(ctx, "device_add", args, nil)
}
// ExecuteAPVFIOMediatedDeviceAdd adds a VFIO mediated AP device to a QEMU instance using the device_add command.
func (q *QMP) ExecuteAPVFIOMediatedDeviceAdd(ctx context.Context, sysfsdev string) error {
args := map[string]interface{}{
"driver": VfioAP,
"sysfsdev": sysfsdev,
}
return q.executeCommand(ctx, "device_add", args, nil)
}
// isSocketIDSupported returns if the cpu driver supports the socket id option
func isSocketIDSupported(driver string) bool {
if driver == "host-s390x-cpu" || driver == "host-powerpc64-cpu" {