[libvirt] [PATCH 1/6] qemuBuildPCIHostdevDevStr: Always format PCI domain onto cmd line

Michal Privoznik mprivozn at redhat.com
Wed Jul 31 08:32:19 UTC 2019


QEMU is perfectly capable of dealing with fully expanded PCI
address. Format PCI domain always as it will simplify next
commits.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/qemu/qemu_command.c                                   | 8 ++++----
 tests/qemuxml2argvdata/hostdev-pci-address-device.args    | 2 +-
 tests/qemuxml2argvdata/hostdev-pci-address.args           | 2 +-
 .../qemuxml2argvdata/hostdev-vfio-zpci-autogenerate.args  | 2 +-
 tests/qemuxml2argvdata/hostdev-vfio-zpci-boundaries.args  | 2 +-
 tests/qemuxml2argvdata/hostdev-vfio-zpci.args             | 2 +-
 tests/qemuxml2argvdata/hostdev-vfio.args                  | 2 +-
 tests/qemuxml2argvdata/net-hostdev-bootorder.args         | 3 ++-
 tests/qemuxml2argvdata/net-hostdev-vfio.args              | 2 +-
 tests/qemuxml2argvdata/net-hostdev.args                   | 2 +-
 tests/qemuxml2argvdata/pci-rom.args                       | 4 ++--
 11 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index fee51158a9..1871c6ef81 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4933,10 +4933,10 @@ qemuBuildPCIHostdevDevStr(const virDomainDef *def,
     }
 
     virBufferAddLit(&buf, ",host=");
-    if (pcisrc->addr.domain)
-        virBufferAsprintf(&buf, "%.4x:", pcisrc->addr.domain);
-    virBufferAsprintf(&buf, "%.2x:%.2x.%.1x",
-                      pcisrc->addr.bus, pcisrc->addr.slot,
+    virBufferAsprintf(&buf, "%.4x:%.2x:%.2x.%.1x",
+                      pcisrc->addr.domain,
+                      pcisrc->addr.bus,
+                      pcisrc->addr.slot,
                       pcisrc->addr.function);
     virBufferAsprintf(&buf, ",id=%s", dev->info->alias);
     if (dev->info->bootIndex)
diff --git a/tests/qemuxml2argvdata/hostdev-pci-address-device.args b/tests/qemuxml2argvdata/hostdev-pci-address-device.args
index 4763e1a147..5159b00ef1 100644
--- a/tests/qemuxml2argvdata/hostdev-pci-address-device.args
+++ b/tests/qemuxml2argvdata/hostdev-pci-address-device.args
@@ -27,5 +27,5 @@ server,nowait \
 -usb \
 -drive file=/dev/HostVG/QEMUGuest2,format=raw,if=none,id=drive-ide0-0-0 \
 -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
--device pci-assign,host=06:12.5,id=hostdev0,bus=pci.0,addr=0x3 \
+-device pci-assign,host=0000:06:12.5,id=hostdev0,bus=pci.0,addr=0x3 \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
diff --git a/tests/qemuxml2argvdata/hostdev-pci-address.args b/tests/qemuxml2argvdata/hostdev-pci-address.args
index d90fb2c085..fe6acaaf62 100644
--- a/tests/qemuxml2argvdata/hostdev-pci-address.args
+++ b/tests/qemuxml2argvdata/hostdev-pci-address.args
@@ -27,4 +27,4 @@ server,nowait \
 -usb \
 -drive file=/dev/HostVG/QEMUGuest2,format=raw,if=none,id=drive-ide0-0-0 \
 -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
--device pci-assign,host=06:12.5,id=hostdev0,bus=pci.0,addr=0x3
+-device pci-assign,host=0000:06:12.5,id=hostdev0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/hostdev-vfio-zpci-autogenerate.args b/tests/qemuxml2argvdata/hostdev-vfio-zpci-autogenerate.args
index 1861811e8b..963d508066 100644
--- a/tests/qemuxml2argvdata/hostdev-vfio-zpci-autogenerate.args
+++ b/tests/qemuxml2argvdata/hostdev-vfio-zpci-autogenerate.args
@@ -24,6 +24,6 @@ server,nowait \
 -rtc base=utc \
 -no-shutdown \
 -device zpci,uid=1,fid=0,target=hostdev0,id=zpci1 \
--device vfio-pci,host=00:00.0,id=hostdev0,bus=pci.0,addr=0x1 \
+-device vfio-pci,host=0000:00:00.0,id=hostdev0,bus=pci.0,addr=0x1 \
 -device zpci,uid=2,fid=1,target=balloon0,id=zpci2 \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2
diff --git a/tests/qemuxml2argvdata/hostdev-vfio-zpci-boundaries.args b/tests/qemuxml2argvdata/hostdev-vfio-zpci-boundaries.args
index 4a58a1eb8d..2fc4200c23 100644
--- a/tests/qemuxml2argvdata/hostdev-vfio-zpci-boundaries.args
+++ b/tests/qemuxml2argvdata/hostdev-vfio-zpci-boundaries.args
@@ -28,6 +28,6 @@ server,nowait \
 -device zpci,uid=65535,fid=4294967295,target=hostdev0,id=zpci65535 \
 -device vfio-pci,host=ffff:00:00.0,id=hostdev0,bus=pci.1,addr=0x1f \
 -device zpci,uid=1,fid=0,target=hostdev1,id=zpci1 \
--device vfio-pci,host=00:00.0,id=hostdev1,bus=pci.0,addr=0x2 \
+-device vfio-pci,host=0000:00:00.0,id=hostdev1,bus=pci.0,addr=0x2 \
 -device zpci,uid=2,fid=1,target=balloon0,id=zpci2 \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/hostdev-vfio-zpci.args b/tests/qemuxml2argvdata/hostdev-vfio-zpci.args
index 07405c7c14..d3a762e5d4 100644
--- a/tests/qemuxml2argvdata/hostdev-vfio-zpci.args
+++ b/tests/qemuxml2argvdata/hostdev-vfio-zpci.args
@@ -24,6 +24,6 @@ server,nowait \
 -rtc base=utc \
 -no-shutdown \
 -device zpci,uid=25,fid=31,target=hostdev0,id=zpci25 \
--device vfio-pci,host=00:00.0,id=hostdev0,bus=pci.0,addr=0x8 \
+-device vfio-pci,host=0000:00:00.0,id=hostdev0,bus=pci.0,addr=0x8 \
 -device zpci,uid=1,fid=0,target=balloon0,id=zpci1 \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x1
diff --git a/tests/qemuxml2argvdata/hostdev-vfio.args b/tests/qemuxml2argvdata/hostdev-vfio.args
index b86181e267..79654f44bb 100644
--- a/tests/qemuxml2argvdata/hostdev-vfio.args
+++ b/tests/qemuxml2argvdata/hostdev-vfio.args
@@ -27,5 +27,5 @@ server,nowait \
 -usb \
 -drive file=/dev/HostVG/QEMUGuest2,format=raw,if=none,id=drive-ide0-0-0 \
 -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
--device vfio-pci,host=06:12.5,id=hostdev0,bus=pci.0,addr=0x3 \
+-device vfio-pci,host=0000:06:12.5,id=hostdev0,bus=pci.0,addr=0x3 \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
diff --git a/tests/qemuxml2argvdata/net-hostdev-bootorder.args b/tests/qemuxml2argvdata/net-hostdev-bootorder.args
index 700ed5366b..eefc247eed 100644
--- a/tests/qemuxml2argvdata/net-hostdev-bootorder.args
+++ b/tests/qemuxml2argvdata/net-hostdev-bootorder.args
@@ -27,4 +27,5 @@ server,nowait \
 -usb \
 -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
 -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=2 \
--device pci-assign,host=03:07.1,id=hostdev0,bootindex=1,bus=pci.0,addr=0x3
+-device pci-assign,host=0000:03:07.1,id=hostdev0,bootindex=1,bus=pci.0,\
+addr=0x3
diff --git a/tests/qemuxml2argvdata/net-hostdev-vfio.args b/tests/qemuxml2argvdata/net-hostdev-vfio.args
index fcc8716fdf..aa9e91db82 100644
--- a/tests/qemuxml2argvdata/net-hostdev-vfio.args
+++ b/tests/qemuxml2argvdata/net-hostdev-vfio.args
@@ -27,5 +27,5 @@ server,nowait \
 -usb \
 -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
 -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
--device vfio-pci,host=03:07.1,id=hostdev0,bus=pci.0,addr=0x3 \
+-device vfio-pci,host=0000:03:07.1,id=hostdev0,bus=pci.0,addr=0x3 \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
diff --git a/tests/qemuxml2argvdata/net-hostdev.args b/tests/qemuxml2argvdata/net-hostdev.args
index 75f6934d0d..94eac176f3 100644
--- a/tests/qemuxml2argvdata/net-hostdev.args
+++ b/tests/qemuxml2argvdata/net-hostdev.args
@@ -27,5 +27,5 @@ server,nowait \
 -usb \
 -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
 -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
--device pci-assign,host=03:07.1,id=hostdev0,bus=pci.0,addr=0x3 \
+-device pci-assign,host=0000:03:07.1,id=hostdev0,bus=pci.0,addr=0x3 \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
diff --git a/tests/qemuxml2argvdata/pci-rom.args b/tests/qemuxml2argvdata/pci-rom.args
index 5f33b20b4e..7235642ee8 100644
--- a/tests/qemuxml2argvdata/pci-rom.args
+++ b/tests/qemuxml2argvdata/pci-rom.args
@@ -33,7 +33,7 @@ addr=0x3,rombar=1 \
 -netdev user,id=hostnet1 \
 -device virtio-net-pci,netdev=hostnet1,id=net1,mac=52:54:00:24:a5:9e,bus=pci.0,\
 addr=0x4,romfile=/etc/fake/bootrom.bin \
--device pci-assign,host=06:12.5,id=hostdev0,bus=pci.0,addr=0x5,rombar=0 \
--device pci-assign,host=06:12.6,id=hostdev1,bus=pci.0,addr=0x6,rombar=1,\
+-device pci-assign,host=0000:06:12.5,id=hostdev0,bus=pci.0,addr=0x5,rombar=0 \
+-device pci-assign,host=0000:06:12.6,id=hostdev1,bus=pci.0,addr=0x6,rombar=1,\
 romfile=/etc/fake/bootrom.bin \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x7
-- 
2.21.0




More information about the libvir-list mailing list