mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-19 23:34:23 +01:00
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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user