On Sat, Jul 25, 2015 at 03:58:30PM -0400, Laine Stump wrote:
This controller can be connected (at domain startup time only - not
hotpluggable) only to a port on the pcie root complex ("pcie-root" in
libvirt config), hence the new connect type
VIR_PCI_CONNECT_TYPE_PCIE_ROOT. It provides a hotpluggable port that
will accept any PCI or PCIe device.
New attributes must be added to the controller <target> subelement for
this - chassis and port are guest-visible option values that will be
set by libvirt with values derived from the controller's index and pci
address information.
---
change from V2:
* check chassis/port for 0-255 range
* 1.3.0 -> 1.2.18
docs/formatdomain.html.in | 33 +++++++++-
docs/schemas/domaincommon.rng | 13 ++++
src/conf/domain_addr.c | 10 ++-
src/conf/domain_addr.h | 5 +-
src/conf/domain_conf.c | 75 +++++++++++++++++++++-
src/conf/domain_conf.h | 8 ++-
src/qemu/qemu_command.c | 1 +
.../qemuxml2argv-pcie-root-port.xml | 36 +++++++++++
tests/qemuxml2xmltest.c | 1 +
9 files changed, 173 insertions(+), 9 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pcie-root-port.xml
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index fdf7e82..a9db924 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -3123,6 +3141,17 @@
auto-determined by libvirt will be placed on this pci-bridge
device. (<span class="since">since 1.1.2</span>).
</p>
+ <p>
+ Domains with an implicit pcie-root can also add controllers
+ with <code>model='pcie-root-port'</code>. This is a simple type
of
+ bridge device that can connect only to one of the 31 slots on
+ the pcie-root bus on the upstream side, and makes a single
+ (PCIe, hotpluggable) port (at slot='0') available on the
+ downstream side. This controller can be used to provide a single
+ slot to later hotplug a PCIe device (but is not itself
+ hotpluggable - it must be in the configuration when the domain
+ is started). (<span class="since">since 1.2.18</span>)
s/18/19/
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index fbad7e9..f1723c0 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -7972,6 +7980,57 @@ virDomainControllerDefParseXML(xmlNodePtr node,
goto error;
}
}
+ if (chassis) {
+ if (virStrToLong_i(chassis, NULL, 0,
+ &def->opts.pciopts.chassis) < 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("Invalid chassis '%s' in PCI
controller"),
+ chassis);
+ goto error;
+ }
+ if (def->opts.pciopts.chassis < 0 ||
+ def->opts.pciopts.chassisNr > 255) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("PCI controller chassis '%s' out of range
"
+ "- must be 0-255"),
+ chassis);
+ goto error;
+ }
+ }
This gets parsed twice, up here ^^ and down here vv, copy-paste error?
Remove one of those, please. I, personally don't care much which one,
none of them is my favourite :)
ACK with that changed
+ if (chassis) {
+ if (virStrToLong_i(chassis, NULL, 0,
+ &def->opts.pciopts.chassis) < 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("Invalid chassis '%s' in PCI
controller"),
+ chassis);
+ goto error;
+ }
+ if (def->opts.pciopts.chassis < 0 ||
+ def->opts.pciopts.chassis > 255) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("PCI controller chassis '%s' out of range
"
+ "- must be 0-255"),
+ chassis);
+ goto error;
+ }
+ }
+ if (port) {
+ if (virStrToLong_i(port, NULL, 0,
+ &def->opts.pciopts.port) < 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("Invalid port '%s' in PCI
controller"),
+ port);
+ goto error;
+ }
+ if (def->opts.pciopts.port < 0 ||
+ def->opts.pciopts.port > 255) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("PCI controller port '%s' out of range
"
+ "- must be 0-255"),
+ port);
+ goto error;
+ }
+ }
break;
default: