qemuBuildPCIHostdevDevStr: Always format PCI domain onto cmd line

While it's true that older QEMUs were not able to deal with PCI
domains, we don't support those versions anymore (see
4a42ece13a). Therefore it is safe to always format fully
expanded PCI address. Format PCI domain always as it will
simplify next commits.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Michal Privoznik 2019-07-30 13:34:45 +02:00
parent 86e3de0565
commit 1737d11e1b
11 changed files with 16 additions and 15 deletions

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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