runtime: Add support for VFIO-AP pass-through

Recognise when a device to be hot-plugged is an IBM Adjunct Processor
(AP) device and execute VFIO AP hot-plug accordingly. Includes unittest
for recognising and uses CCW for addDeviceToBridge in hotplugVFIODevice
if appropriate.

Fixes: #491

Signed-off-by: Jakob-Naucke <jakob.naucke@ibm.com>
Co-authored-by: Julio Montes <julio.montes@intel.com>
Reviewed-by: Alice Frosi <afrosi@redhat.com>
This commit is contained in:
Jakob-Naucke
2020-08-26 16:45:37 +02:00
parent 8df06a046e
commit 1236e22475
5 changed files with 59 additions and 11 deletions

View File

@@ -92,7 +92,8 @@ func FindContextID() (*os.File, uint64, error) {
const (
procMountsFile = "/proc/mounts"
fieldsPerLine = 6
fieldsPerLine = 6
vfioAPSysfsDir = "vfio_ap"
)
const (
@@ -141,3 +142,15 @@ func GetDevicePathAndFsType(mountPoint string) (devicePath, fsType string, err e
}
}
}
// IsAPVFIOMediatedDevice decides whether a device is a VFIO-AP device
// by checking for the existence of "vfio_ap" in the path
func IsAPVFIOMediatedDevice(sysfsdev string) bool {
split := strings.Split(sysfsdev, string(os.PathSeparator))
for _, el := range split {
if el == vfioAPSysfsDir {
return true
}
}
return false
}