mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-22 13:38:26 +00:00
Merge pull request #47 from xindazhao/gpu-vfio-mdev
qemu/qmp: add vfio mediated device support on root bus
This commit is contained in:
commit
9905ae92c5
10
qemu/qmp.go
10
qemu/qmp.go
@ -937,20 +937,22 @@ func (q *QMP) ExecutePCIVFIODeviceAdd(ctx context.Context, devID, bdf, addr, bus
|
||||
}
|
||||
|
||||
// ExecutePCIVFIOMediatedDeviceAdd adds a VFIO mediated device to a QEMU instance using the device_add command.
|
||||
// This function can be used to hot plug VFIO mediated devices on PCI(E) bridges, unlike
|
||||
// This function can be used to hot plug VFIO mediated devices on PCI(E) bridges or root bus, unlike
|
||||
// ExecuteVFIODeviceAdd this function receives the bus and the device address on its parent bus.
|
||||
// bus is optional. devID is the id of the device to add. Must be valid QMP identifier. sysfsdev is the VFIO
|
||||
// mediated device.
|
||||
// devID is the id of the device to add. Must be valid QMP identifier. sysfsdev is the VFIO mediated device.
|
||||
// Both bus and addr are optional. If they are both set to be empty, the system will pick up an empty slot on root bus.
|
||||
func (q *QMP) ExecutePCIVFIOMediatedDeviceAdd(ctx context.Context, devID, sysfsdev, addr, bus string) error {
|
||||
args := map[string]interface{}{
|
||||
"id": devID,
|
||||
"driver": "vfio-pci",
|
||||
"sysfsdev": sysfsdev,
|
||||
"addr": addr,
|
||||
}
|
||||
if bus != "" {
|
||||
args["bus"] = bus
|
||||
}
|
||||
if addr != "" {
|
||||
args["addr"] = addr
|
||||
}
|
||||
return q.executeCommand(ctx, "device_add", args, nil)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user