Support x-pci-vendor-id and x-pci-device-id pass to qemu

since some vendor id like 1ded can not be identified by virtio-pci
driver, so upper level need to pass a specified vendor id to qemu.

the upper level will change unavailable id and pass it to qemu.

Signed-off-by: Ace-Tang <aceapril@126.com>
This commit is contained in:
Ace-Tang
2019-07-04 21:59:17 +08:00
parent 8d18f344c5
commit 8fd28e23ac
3 changed files with 17 additions and 3 deletions

View File

@@ -901,6 +901,12 @@ type VFIODevice struct {
// DevNo identifies the ccw devices for s390x architecture
DevNo string
// VendorID specifies vendor id
VendorID string
// DeviceID specifies device id
DeviceID string
}
// Valid returns true if the VFIODevice structure is valid and complete.
@@ -917,6 +923,12 @@ func (vfioDev VFIODevice) QemuParams(config *Config) []string {
deviceParams = append(deviceParams, fmt.Sprintf("%s,host=%s", driver, vfioDev.BDF))
if isVirtioPCI[driver] {
if vfioDev.VendorID != "" {
deviceParams = append(deviceParams, fmt.Sprintf(",x-pci-vendor-id=%s", vfioDev.VendorID))
}
if vfioDev.DeviceID != "" {
deviceParams = append(deviceParams, fmt.Sprintf(",x-pci-device-id=%s", vfioDev.DeviceID))
}
deviceParams = append(deviceParams, fmt.Sprintf(",romfile=%s", vfioDev.ROMFile))
}