|
|
6d3351 |
From f55694fe90cc25e228bd2f779c600d739aec508e Mon Sep 17 00:00:00 2001
|
|
|
6d3351 |
Message-Id: <f55694fe90cc25e228bd2f779c600d739aec508e@dist-git>
|
|
|
6d3351 |
From: Andrea Bolognani <abologna@redhat.com>
|
|
|
6d3351 |
Date: Mon, 17 Jul 2017 12:09:12 +0200
|
|
|
6d3351 |
Subject: [PATCH] qemu: Deal with PHB naming conventions
|
|
|
6d3351 |
|
|
|
6d3351 |
Usually, a controller with alias 'x' will create a bus with the
|
|
|
6d3351 |
same name; however, the bus created by a PHBs with alias 'x' will
|
|
|
6d3351 |
be named 'x.0' instead, so we need to account for that.
|
|
|
6d3351 |
|
|
|
6d3351 |
As an exception to the exception, the implicit PHB that's added
|
|
|
6d3351 |
automatically to every pSeries guest creates the 'pci.0' bus.
|
|
|
6d3351 |
|
|
|
6d3351 |
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
|
|
6d3351 |
Reviewed-by: Laine Stump <laine@laine.org>
|
|
|
6d3351 |
(cherry picked from commit 32f23b8d30f13c154fba6673b1b42b164c162f8a)
|
|
|
6d3351 |
|
|
|
6d3351 |
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1431193
|
|
|
6d3351 |
|
|
|
6d3351 |
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
|
|
6d3351 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
6d3351 |
---
|
|
|
6d3351 |
src/qemu/qemu_command.c | 16 +++++++++++++++-
|
|
|
6d3351 |
1 file changed, 15 insertions(+), 1 deletion(-)
|
|
|
6d3351 |
|
|
|
6d3351 |
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
|
|
6d3351 |
index a067aaeb17..0176f0d63f 100644
|
|
|
6d3351 |
--- a/src/qemu/qemu_command.c
|
|
|
6d3351 |
+++ b/src/qemu/qemu_command.c
|
|
|
6d3351 |
@@ -301,6 +301,8 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
|
|
|
6d3351 |
int ret = -1;
|
|
|
6d3351 |
char *devStr = NULL;
|
|
|
6d3351 |
const char *contAlias = NULL;
|
|
|
6d3351 |
+ bool contIsPHB = false;
|
|
|
6d3351 |
+ int contTargetIndex = 0;
|
|
|
6d3351 |
|
|
|
6d3351 |
if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
|
|
|
6d3351 |
size_t i;
|
|
|
6d3351 |
@@ -313,6 +315,8 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
|
|
|
6d3351 |
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI &&
|
|
|
6d3351 |
cont->idx == info->addr.pci.bus) {
|
|
|
6d3351 |
contAlias = cont->info.alias;
|
|
|
6d3351 |
+ contIsPHB = virDomainControllerIsPCIHostBridge(cont);
|
|
|
6d3351 |
+ contTargetIndex = cont->opts.pciopts.targetIndex;
|
|
|
6d3351 |
if (!contAlias) {
|
|
|
6d3351 |
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
6d3351 |
_("Device alias was not set for PCI "
|
|
|
6d3351 |
@@ -348,7 +352,17 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
|
|
|
6d3351 |
}
|
|
|
6d3351 |
}
|
|
|
6d3351 |
|
|
|
6d3351 |
- virBufferAsprintf(buf, ",bus=%s", contAlias);
|
|
|
6d3351 |
+ if (contIsPHB && contTargetIndex > 0) {
|
|
|
6d3351 |
+ /* The PCI bus created by a spapr-pci-host-bridge device with
|
|
|
6d3351 |
+ * alias 'x' will be called 'x.0' rather than 'x'; however,
|
|
|
6d3351 |
+ * this does not apply to the implicit PHB in a pSeries guest,
|
|
|
6d3351 |
+ * which always has the hardcoded name 'pci.0' */
|
|
|
6d3351 |
+ virBufferAsprintf(buf, ",bus=%s.0", contAlias);
|
|
|
6d3351 |
+ } else {
|
|
|
6d3351 |
+ /* For all other controllers, the bus name matches the alias
|
|
|
6d3351 |
+ * of the corresponding controller */
|
|
|
6d3351 |
+ virBufferAsprintf(buf, ",bus=%s", contAlias);
|
|
|
6d3351 |
+ }
|
|
|
6d3351 |
|
|
|
6d3351 |
if (info->addr.pci.multi == VIR_TRISTATE_SWITCH_ON)
|
|
|
6d3351 |
virBufferAddLit(buf, ",multifunction=on");
|
|
|
6d3351 |
--
|
|
|
6d3351 |
2.13.3
|
|
|
6d3351 |
|