mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-18 14:54:19 +01:00
qemu: Add qemu parameter for PCI address for a bridge.
We need to be able to specify the PCI slot for a bridge while adding it. Add test to verify bridge is correctly added. Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
This commit is contained in:
10
qemu/qemu.go
10
qemu/qemu.go
@@ -907,6 +907,9 @@ type BridgeDevice struct {
|
||||
|
||||
// SHPC is used to enable or disable the standard hot plug controller
|
||||
SHPC bool
|
||||
|
||||
// PCI Slot
|
||||
Addr string
|
||||
}
|
||||
|
||||
// Valid returns true if the BridgeDevice structure is valid and complete.
|
||||
@@ -941,6 +944,13 @@ func (bridgeDev BridgeDevice) QemuParams(config *Config) []string {
|
||||
}
|
||||
|
||||
deviceParam := fmt.Sprintf("%s,bus=%s,id=%s,chassis_nr=%d,shpc=%s", deviceName, bridgeDev.Bus, bridgeDev.ID, bridgeDev.Chassis, shpc)
|
||||
if bridgeDev.Addr != "" {
|
||||
addr, err := strconv.Atoi(bridgeDev.Addr)
|
||||
if err == nil && addr >= 0 {
|
||||
deviceParam += fmt.Sprintf(",addr=%x", addr)
|
||||
}
|
||||
}
|
||||
|
||||
qemuParams = append(qemuParams, "-device")
|
||||
qemuParams = append(qemuParams, deviceParam)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user