mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-18 06:44:23 +01:00
runtime: Add support for GPUDirect and GPUDirect RDMA PCIe topology
Fixes: #4491 Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
This commit is contained in:
@@ -140,6 +140,9 @@ type qemuArch interface {
|
||||
// appendPCIeRootPortDevice appends a pcie-root-port device to pcie.0 bus
|
||||
appendPCIeRootPortDevice(devices []govmmQemu.Device, number uint32, memSize32bit uint64, memSize64bit uint64) []govmmQemu.Device
|
||||
|
||||
// appendPCIeSwitch appends a ioh3420 device to a pcie-root-port
|
||||
appendPCIeSwitchPortDevice(devices []govmmQemu.Device, number uint32, memSize32bit uint64, memSize64bit uint64) []govmmQemu.Device
|
||||
|
||||
// append vIOMMU device
|
||||
appendIOMMU(devices []govmmQemu.Device) ([]govmmQemu.Device, error)
|
||||
|
||||
@@ -177,13 +180,18 @@ type qemuArchBase struct {
|
||||
}
|
||||
|
||||
const (
|
||||
defaultCores uint32 = 1
|
||||
defaultThreads uint32 = 1
|
||||
defaultCPUModel = "host"
|
||||
defaultBridgeBus = "pcie.0"
|
||||
defaultPCBridgeBus = "pci.0"
|
||||
maxDevIDSize = 31
|
||||
pcieRootPortPrefix = "rp"
|
||||
defaultCores uint32 = 1
|
||||
defaultThreads uint32 = 1
|
||||
defaultCPUModel = "host"
|
||||
defaultBridgeBus = "pcie.0"
|
||||
defaultPCBridgeBus = "pci.0"
|
||||
maxDevIDSize = 31
|
||||
maxPCIeRootPort = 16 // Limitation from QEMU
|
||||
maxPCIeSwitchPort = 16 // Limitation from QEMU
|
||||
pcieRootPortPrefix = "rp"
|
||||
pcieSwitchPrefix = "sw"
|
||||
pcieSwitchUpstreamPortPrefix = "swup"
|
||||
pcieSwitchDownstreamPortPrefix = "swdp"
|
||||
)
|
||||
|
||||
// This is the PCI start address assigned to the first bridge that
|
||||
@@ -675,17 +683,17 @@ func (q *qemuArchBase) appendVhostUserDevice(ctx context.Context, devices []govm
|
||||
}
|
||||
|
||||
func (q *qemuArchBase) appendVFIODevice(devices []govmmQemu.Device, vfioDev config.VFIODev) []govmmQemu.Device {
|
||||
pciDevice := vfioDev.(config.VFIOPCIDev)
|
||||
if pciDevice.BDF == "" {
|
||||
|
||||
if vfioDev.BDF == "" {
|
||||
return devices
|
||||
}
|
||||
|
||||
devices = append(devices,
|
||||
govmmQemu.VFIODevice{
|
||||
BDF: pciDevice.BDF,
|
||||
VendorID: pciDevice.VendorID,
|
||||
DeviceID: pciDevice.DeviceID,
|
||||
Bus: pciDevice.Bus,
|
||||
BDF: vfioDev.BDF,
|
||||
VendorID: vfioDev.VendorID,
|
||||
DeviceID: vfioDev.DeviceID,
|
||||
Bus: vfioDev.Bus,
|
||||
},
|
||||
)
|
||||
|
||||
@@ -801,6 +809,13 @@ func (q *qemuArchBase) appendPCIeRootPortDevice(devices []govmmQemu.Device, numb
|
||||
return genericAppendPCIeRootPort(devices, number, q.qemuMachine.Type, memSize32bit, memSize64bit)
|
||||
}
|
||||
|
||||
// appendPCIeSwitchPortDevice appends a PCIe Switch with <number> ports
|
||||
func (q *qemuArchBase) appendPCIeSwitchPortDevice(devices []govmmQemu.Device, number uint32, memSize32bit uint64, memSize64bit uint64) []govmmQemu.Device {
|
||||
return genericAppendPCIeSwitchPort(devices, number, q.qemuMachine.Type, memSize32bit, memSize64bit)
|
||||
}
|
||||
|
||||
// getBARsMaxAddressableMemory we need to know the BAR sizes to configure the
|
||||
// PCIe Root Port or PCIe Downstream Port attaching a device with huge BARs.
|
||||
func (q *qemuArchBase) getBARsMaxAddressableMemory() (uint64, uint64) {
|
||||
|
||||
pci := nvpci.New()
|
||||
|
||||
Reference in New Issue
Block a user