gpu: Use a dedicated VFIO group vs iommufd entry

We do not want to abuse the sysfsentry lets use a dedicated
devfsentry.

Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
This commit is contained in:
Zvonko Kaiser 2025-02-20 16:51:49 +00:00
parent 9add633258
commit 7cca2c4925
4 changed files with 10 additions and 2 deletions

View File

@ -396,6 +396,9 @@ type VFIODev struct {
// sysfsdev of VFIO mediated device
SysfsDev string
// DevfsDev is used to identify a VFIO Group device or IOMMMUFD VFIO device
DevfsDev string
// VendorID specifies vendor id
VendorID string

View File

@ -233,7 +233,8 @@ func GetDeviceFromVFIODev(device config.DeviceInfo) ([]*config.VFIODev, error) {
ID: id,
Type: vfioDeviceType,
BDF: deviceBDF,
SysfsDev: device.HostPath,
SysfsDev: deviceSysfsDev,
DevfsDev: device.HostPath,
IsPCIe: IsPCIeDevice(deviceBDF),
Class: pciClass,
VendorID: vendorID,

View File

@ -1897,6 +1897,9 @@ type VFIODevice struct {
// SysfsDev specifies the sysfs matrix entry for the AP device
SysfsDev string
// DevfsDev is used to identify a VFIO Group device or IOMMMUFD VFIO device
DevfsDev string
}
// VFIODeviceTransport is a map of the vfio device name that corresponds to
@ -1951,7 +1954,7 @@ func (vfioDev VFIODevice) QemuParams(config *Config) []string {
deviceParams = append(deviceParams, fmt.Sprintf("devno=%s", vfioDev.DevNo))
}
if strings.HasPrefix(vfioDev.SysfsDev, drivers.IommufdDevPath) {
if strings.HasPrefix(vfioDev.DevfsDev, drivers.IommufdDevPath) {
qemuParams = append(qemuParams, "-object")
qemuParams = append(qemuParams, fmt.Sprintf("iommufd,id=iommufd%s", vfioDev.ID))
deviceParams = append(deviceParams, fmt.Sprintf("iommufd=iommufd%s", vfioDev.ID))

View File

@ -714,6 +714,7 @@ func (q *qemuArchBase) appendVFIODevice(devices []govmmQemu.Device, vfioDev conf
DeviceID: vfioDev.DeviceID,
Bus: vfioDev.Bus,
SysfsDev: vfioDev.SysfsDev,
DevfsDev: vfioDev.DevfsDev,
},
)