mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-10 07:20:02 +00:00
qemu: Fix handling of user aliases for default PHB
The bus name for the default PHB is always "pci.0".
Fixes: 937f319536
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
95032b89d4
commit
f39f15313a
@ -366,9 +366,26 @@ qemuBuildDeviceAddressPCIGetBus(const virDomainDef *domainDef,
|
||||
if (virDomainDeviceAliasIsUserAlias(contAlias)) {
|
||||
/* When domain has builtin pci-root controller we don't put it
|
||||
* onto cmd line. Therefore we can't set its alias. In that
|
||||
* case, use the default one. */
|
||||
if (!qemuDomainIsPSeries(domainDef) &&
|
||||
cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT) {
|
||||
* case, use the default one.
|
||||
*
|
||||
* Note that we have to check the value of targetIndex here,
|
||||
* because we need to handle three different cases:
|
||||
*
|
||||
* non-pSeries guest (targetIndex == -1)
|
||||
* => must use default alias
|
||||
*
|
||||
* pSeries guest, default PHB (targetIndex == 0)
|
||||
* => must use default alias
|
||||
*
|
||||
* pSeries guest, non-default PHB (targetIndex > 0)
|
||||
* => can use actual alias
|
||||
*
|
||||
* The last one is due to non-default PHBs beind created
|
||||
* through the spapr-pci-host-bridge device, which supports
|
||||
* custom device IDs and thus custom bus names.
|
||||
* */
|
||||
if (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT &&
|
||||
contTargetIndex <= 0) {
|
||||
if (virQEMUCapsHasPCIMultiBus(domainDef))
|
||||
contAlias = "pci.0";
|
||||
else
|
||||
|
@ -28,7 +28,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
|
||||
-boot strict=on \
|
||||
-device '{"driver":"spapr-pci-host-bridge","index":1,"id":"ua-phb1"}' \
|
||||
-netdev user,id=hostnet0 \
|
||||
-device '{"driver":"virtio-net-pci","netdev":"hostnet0","id":"net0","mac":"52:54:00:a2:44:92","bus":"ua-phb0","addr":"0x1"}' \
|
||||
-device '{"driver":"virtio-net-pci","netdev":"hostnet0","id":"net0","mac":"52:54:00:a2:44:92","bus":"pci.0","addr":"0x1"}' \
|
||||
-netdev user,id=hostnet1 \
|
||||
-device '{"driver":"virtio-net-pci","netdev":"hostnet1","id":"net1","mac":"52:54:00:a2:44:93","bus":"ua-phb1.0","addr":"0x1"}' \
|
||||
-audiodev '{"id":"audio1","driver":"none"}' \
|
||||
|
Loading…
Reference in New Issue
Block a user