mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 12:14:48 +00:00
qemu/qmp: add vfio mediated device support on root bus
In addition to supporting hotplug for VFIO mediated device on PCI bridge, this patch adds hotplug functionality on root bus. When parameter bus and addr are set to be empty, the system will pick up an empty slot on root bus. Signed-off-by: Zhao Xinda <xinda.zhao@intel.com>
This commit is contained in:
parent
66bfe83589
commit
de5d278889
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