[libvirt] [PATCH 1/6] Add address type for SPAPR VIO devices

For QEMU PPC64 we have a machine type ("pseries") which has a virtual bus called "spapr-vio". We need to be able to create devices on this bus, and as such need a way to specify the address for those devices. This patch adds a new address type "spapr-vio", which achieves this. The addressing is specified with a "reg" property in the address definition. The reg is optional, if it is not specified QEMU will auto-assign an address for the device. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> --- src/conf/domain_conf.c | 43 ++++++++++++++++++++++++++++++++++++++++++- src/conf/domain_conf.h | 9 +++++++++ src/qemu/qemu_command.c | 5 +++++ 3 files changed, 56 insertions(+), 1 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d68ab10..8dfcebc 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -139,7 +139,8 @@ VIR_ENUM_IMPL(virDomainDeviceAddress, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST, "drive", "virtio-serial", "ccid", - "usb") + "usb", + "spapr-vio") VIR_ENUM_IMPL(virDomainDeviceAddressPciMulti, VIR_DOMAIN_DEVICE_ADDRESS_PCI_MULTI_LAST, @@ -1909,6 +1910,11 @@ virDomainDeviceInfoFormat(virBufferPtr buf, info->addr.usb.port); break; + case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO: + if (info->addr.spaprvio.has_reg) + virBufferAsprintf(buf, " reg='0x%llx'", info->addr.spaprvio.reg); + break; + default: virDomainReportError(VIR_ERR_INTERNAL_ERROR, _("unknown address type '%d'"), info->type); @@ -2168,6 +2174,34 @@ cleanup: } static int +virDomainDeviceSpaprVioAddressParseXML(xmlNodePtr node, + virDomainDeviceSpaprVioAddressPtr addr) +{ + char *reg; + int ret; + + memset(addr, 0, sizeof(*addr)); + addr->has_reg = false; + + reg = virXMLPropString(node, "reg"); + if (reg) { + if (virStrToLong_ull(reg, NULL, 16, &addr->reg) < 0) { + virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot parse <address> 'reg' attribute")); + ret = -1; + goto cleanup; + } + + addr->has_reg = true; + } + + ret = 0; +cleanup: + VIR_FREE(reg); + return ret; +} + +static int virDomainDeviceUSBMasterParseXML(xmlNodePtr node, virDomainDeviceUSBMasterPtr master) { @@ -2280,6 +2314,11 @@ virDomainDeviceInfoParseXML(xmlNodePtr node, goto cleanup; break; + case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO: + if (virDomainDeviceSpaprVioAddressParseXML(address, &info->addr.spaprvio) < 0) + goto cleanup; + break; + default: /* Should not happen */ virDomainReportError(VIR_ERR_INTERNAL_ERROR, @@ -3174,6 +3213,7 @@ virDomainControllerDefParseXML(xmlNodePtr node, } if (def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && + def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO && def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Controllers must use the 'pci' address type")); @@ -3566,6 +3606,7 @@ virDomainNetDefParseXML(virCapsPtr caps, /* XXX what about ISA/USB based NIC models - once we support * them we should make sure address type is correct */ if (def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && + def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO && def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Network interfaces must use 'pci' address type")); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index d6ed898..0ed6aba 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -69,6 +69,7 @@ enum virDomainDeviceAddressType { VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCID, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB, + VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST }; @@ -121,6 +122,13 @@ struct _virDomainDeviceUSBAddress { char *port; }; +typedef struct _virDomainDeviceSpaprVioAddress virDomainDeviceSpaprVioAddress; +typedef virDomainDeviceSpaprVioAddress *virDomainDeviceSpaprVioAddressPtr; +struct _virDomainDeviceSpaprVioAddress { + unsigned long long reg; + bool has_reg; +}; + enum virDomainControllerMaster { VIR_DOMAIN_CONTROLLER_MASTER_NONE, VIR_DOMAIN_CONTROLLER_MASTER_USB, @@ -145,6 +153,7 @@ struct _virDomainDeviceInfo { virDomainDeviceVirtioSerialAddress vioserial; virDomainDeviceCcidAddress ccid; virDomainDeviceUSBAddress usb; + virDomainDeviceSpaprVioAddress spaprvio; } addr; int mastertype; union { diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index d33d7c8..7128b18 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1256,6 +1256,8 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs) def->controllers[i]->idx == 0) continue; + if (def->controllers[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO) + continue; if (def->controllers[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) continue; if (qemuDomainPCIAddressSetNextAddr(addrs, &def->controllers[i]->info) < 0) @@ -1406,6 +1408,9 @@ qemuBuildDeviceAddressStr(virBufferPtr buf, virBufferAsprintf(buf, ",bus="); qemuUsbId(buf, info->addr.usb.bus); virBufferAsprintf(buf, ".0,port=%s", info->addr.usb.port); + } else if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO) { + if (info->addr.spaprvio.has_reg) + virBufferAsprintf(buf, ",reg=0x%llx", info->addr.spaprvio.reg); } return 0; -- 1.7.7.3

Original patch by Bharata. Updated to use {1,16} in spaprvioReg based on example from Eric Blake. Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com> Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <michael@ellerman.id.au> --- docs/schemas/domaincommon.rng | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 27ec1da..553a6f0 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2199,6 +2199,13 @@ <ref name="usbPort"/> </attribute> </define> + <define name="spaprvioaddress"> + <optional> + <attribute name="reg"> + <ref name="spaprvioReg"/> + </attribute> + </optional> + </define> <define name="pciaddress"> <optional> <attribute name="domain"> @@ -2577,6 +2584,12 @@ </attribute> <ref name="usbportaddress"/> </group> + <group> + <attribute name="type"> + <value>spapr-vio</value> + </attribute> + <ref name="spaprvioaddress"/> + </group> </choice> </element> </define> @@ -2866,4 +2879,9 @@ <param name="pattern">[a-zA-Z0-9_\.:]+</param> </data> </define> + <define name="spaprvioReg"> + <data type="string"> + <param name="pattern">(0x)?[0-9a-fA-F]{1,16}</param> + </data> + </define> </grammar> -- 1.7.7.3

On 12/12/2011 04:39 PM, Bharata B Rao wrote:
Original patch by Bharata. Updated to use {1,16} in spaprvioReg based on example from Eric Blake.
Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com> Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <michael@ellerman.id.au> --- docs/schemas/domaincommon.rng | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-)
ACK and pushed. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

Add logic to assign addresses for devices with spapr-vio addresses. We also do validation of addresses specified by the user, ie. ensuring that there are not duplicate addresses on the bus. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> --- src/qemu/qemu_command.c | 89 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 89 insertions(+), 0 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 7128b18..1a7a251 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -683,6 +683,89 @@ qemuAssignDeviceAliases(virDomainDefPtr def, virBitmapPtr qemuCaps) return -1; } +static int +qemuSpaprVIOFindByReg(virDomainDefPtr def ATTRIBUTE_UNUSED, + virDomainDeviceInfoPtr info, void *opaque) +{ + virDomainDeviceInfoPtr target = opaque; + + if (info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO) + return 0; + + /* Match a dev that has a reg, is not us, and has a matching reg */ + if (info->addr.spaprvio.has_reg && info != target && + info->addr.spaprvio.reg == target->addr.spaprvio.reg) + /* Has to be < 0 so virDomainDeviceInfoIterate() will exit */ + return -1; + + return 0; +} + +static int +qemuAssignSpaprVIOAddress(virDomainDefPtr def, virDomainDeviceInfoPtr info, + unsigned long long default_reg) +{ + bool user_reg; + int rc; + + if (info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO) + return 0; + + /* Check if the user has assigned the reg already, if so use it */ + user_reg = info->addr.spaprvio.has_reg; + if (!user_reg) { + info->addr.spaprvio.reg = default_reg; + info->addr.spaprvio.has_reg = true; + } + + rc = virDomainDeviceInfoIterate(def, qemuSpaprVIOFindByReg, info); + while (rc != 0) { + if (user_reg) { + qemuReportError(VIR_ERR_XML_ERROR, + _("spapr-vio address %#llx already in use"), + info->addr.spaprvio.reg); + return -EEXIST; + } + + /* We assigned the reg, so try a new value */ + info->addr.spaprvio.reg += 0x1000; + rc = virDomainDeviceInfoIterate(def, qemuSpaprVIOFindByReg, info); + } + + return 0; +} + +static int qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def) +{ + int i, rc; + + /* Default values match QEMU. See spapr_(llan|vscsi|vty).c */ + + for (i = 0 ; i < def->nnets; i++) { + rc = qemuAssignSpaprVIOAddress(def, &def->nets[i]->info, + 0x1000ul); + if (rc) + return rc; + } + + for (i = 0 ; i < def->ncontrollers; i++) { + rc = qemuAssignSpaprVIOAddress(def, &def->controllers[i]->info, + 0x2000ul); + if (rc) + return rc; + } + + for (i = 0 ; i < def->nserials; i++) { + rc = qemuAssignSpaprVIOAddress(def, &def->serials[i]->info, + 0x30000000ul); + if (rc) + return rc; + } + + /* No other devices are currently supported on spapr-vio */ + + return 0; +} #define QEMU_PCI_ADDRESS_LAST_SLOT 31 #define QEMU_PCI_ADDRESS_LAST_FUNCTION 8 @@ -812,6 +895,12 @@ cleanup: int qemuDomainAssignAddresses(virDomainDefPtr def) { + int rc; + + rc = qemuDomainAssignSpaprVIOAddresses(def); + if (rc) + return rc; + return qemuDomainAssignPCIAddresses(def); } -- 1.7.7.3

On 12/12/2011 04:39 PM, Michael Ellerman wrote:
Add logic to assign addresses for devices with spapr-vio addresses.
We also do validation of addresses specified by the user, ie. ensuring that there are not duplicate addresses on the bus.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au> --- src/qemu/qemu_command.c | 89 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 89 insertions(+), 0 deletions(-)
ACK and pushed. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

Create a fake PPC64 QEMU so that we can run PPC64 QEMU tests when we don't have a real version of the emulator available. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> --- tests/testutilsqemu.c | 30 ++++++++++++++++++++++++++++++ 1 files changed, 30 insertions(+), 0 deletions(-) diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index 857f5da..fa6422a 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -60,6 +60,33 @@ static int testQemuDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED) return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL; } +static int testQemuAddPPC64Guest(virCapsPtr caps) +{ + static const char *machine[] = { "pseries" }; + virCapsGuestMachinePtr *machines = NULL; + virCapsGuestPtr guest; + + machines = virCapabilitiesAllocMachines(machine, 1); + if (!machines) + goto error; + + guest = virCapabilitiesAddGuest(caps, "hvm", "ppc64", 64, + "/usr/bin/qemu-system-ppc64", NULL, + 1, machines); + if (!guest) + goto error; + + if (!virCapabilitiesAddGuestDomain(guest, "qemu", NULL, NULL, 0, NULL)) + goto error; + + return 0; + +error: + /* No way to free a guest? */ + virCapabilitiesFreeMachines(machines, 1); + return -1; +} + virCapsPtr testQemuCapsInit(void) { virCapsPtr caps; virCapsGuestPtr guest; @@ -172,6 +199,9 @@ virCapsPtr testQemuCapsInit(void) { NULL) == NULL) goto cleanup; + if (testQemuAddPPC64Guest(caps)) + goto cleanup; + if (virTestGetDebug()) { char *caps_str; -- 1.7.7.3

On 12/12/2011 04:39 PM, Michael Ellerman wrote:
Create a fake PPC64 QEMU so that we can run PPC64 QEMU tests when we don't have a real version of the emulator available.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au> --- tests/testutilsqemu.c | 30 ++++++++++++++++++++++++++++++ 1 files changed, 30 insertions(+), 0 deletions(-)
New patch; looks good, and like it won't matter until a future patch actually tries to use qemu-system-ppc64 as its <emulator> as part of the testsuite. At any rate, 'make check' still passed for me on F16, where I did not have a qemu-system-ppc64 installed. ACK and pushed. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

We can't call qemuCapsExtractVersionInfo() from test code, because it expects to be able to call the emulator, and for testing we have fake emulators that can't be executed. For that reason qemuxml2argvtest.c doesn't call qemuDomainAssignPCIAddresses(), instead it open codes its own version. That means we can't call qemuDomainAssignAddresses() from the test code, instead we need to manually call qemuDomainAssignSpaprVioAddresses(). Also add logic to cope with qemuDomainAssignSpaprVioAddresses() failing, so that we can write a test that checks for a known failure in there. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> --- src/qemu/qemu_command.c | 2 +- src/qemu/qemu_command.h | 1 + tests/qemuxml2argvtest.c | 18 +++++++++++++----- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 1a7a251..92a5955 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -735,7 +735,7 @@ qemuAssignSpaprVIOAddress(virDomainDefPtr def, virDomainDeviceInfoPtr info, return 0; } -static int qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def) +int qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def) { int i, rc; diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index de61cf3..2f8b5ba 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -175,6 +175,7 @@ virDomainDefPtr qemuParseCommandLinePid(virCapsPtr caps, bool *monJSON); int qemuDomainAssignAddresses(virDomainDefPtr def); +int qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def); int qemuDomainAssignPCIAddresses(virDomainDefPtr def); qemuDomainPCIAddressSetPtr qemuDomainPCIAddressSetCreate(virDomainDefPtr def); diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 228d052..fb2d36e 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -152,6 +152,13 @@ static int testCompareXMLToArgvFiles(const char *xml, if (qemuCapsGet(extraFlags, QEMU_CAPS_DEVICE)) { qemuDomainPCIAddressSetPtr pciaddrs; + + if (qemuDomainAssignSpaprVIOAddresses(vmdef)) { + if (expectError) + goto ok; + goto fail; + } + if (!(pciaddrs = qemuDomainPCIAddressSetCreate(vmdef))) goto fail; @@ -189,11 +196,6 @@ static int testCompareXMLToArgvFiles(const char *xml, goto fail; } - if (expectError) { - /* need to suppress the errors */ - virResetLastError(); - } - if (!(actualargv = virCommandToString(cmd))) goto fail; @@ -211,6 +213,12 @@ static int testCompareXMLToArgvFiles(const char *xml, goto fail; } + ok: + if (expectError) { + /* need to suppress the errors */ + virResetLastError(); + } + ret = 0; fail: -- 1.7.7.3

On 12/12/2011 04:39 PM, Michael Ellerman wrote:
We can't call qemuCapsExtractVersionInfo() from test code, because it expects to be able to call the emulator, and for testing we have fake emulators that can't be executed. For that reason qemuxml2argvtest.c doesn't call qemuDomainAssignPCIAddresses(), instead it open codes its own version.
That means we can't call qemuDomainAssignAddresses() from the test code, instead we need to manually call qemuDomainAssignSpaprVioAddresses().
Also add logic to cope with qemuDomainAssignSpaprVioAddresses() failing, so that we can write a test that checks for a known failure in there.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au> --- src/qemu/qemu_command.c | 2 +- src/qemu/qemu_command.h | 1 + tests/qemuxml2argvtest.c | 18 +++++++++++++----- 3 files changed, 15 insertions(+), 6 deletions(-)
I wasn't sure if we needed to list qemuDomainAssignSpaprVioAddresses in the .syms file for export; so I did a cross-build to mingw, and things still linked. Which means I think we got away without needing it. ACK and pushed. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

Add four tests of the XML -> argv handling for the PPC64 pseries machine. The first is just a basic test of a bare bones machine. The three others test various aspects of the spapr-vio address handling. It seems that currently we can't include network devices, doing so leads to a segfault because the network driverState is not initialised. Working around that leads us to the problem that the 'default' network doesn't exist. So for now just leave network devices out. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> --- .../qemuxml2argv-pseries-basic.args | 1 + .../qemuxml2argv-pseries-basic.xml | 17 ++++++++ .../qemuxml2argv-pseries-vio-address-clash.xml | 42 ++++++++++++++++++++ .../qemuxml2argv-pseries-vio-user-assigned.args | 1 + .../qemuxml2argv-pseries-vio-user-assigned.xml | 42 ++++++++++++++++++++ .../qemuxml2argvdata/qemuxml2argv-pseries-vio.args | 1 + .../qemuxml2argvdata/qemuxml2argv-pseries-vio.xml | 42 ++++++++++++++++++++ tests/qemuxml2argvtest.c | 9 ++++ 8 files changed, 155 insertions(+), 0 deletions(-) diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-basic.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-basic.args new file mode 100644 index 0000000..f9aec92 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-basic.args @@ -0,0 +1 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu-system-ppc64 -S -M pseries -m 512 -smp 1 -nographic -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/tmp/test-monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c -chardev pty,id=charserial0 -device spapr-vty,chardev=charserial0,reg=0x30000000 -usb diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-basic.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-basic.xml new file mode 100644 index 0000000..908ff4b --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-basic.xml @@ -0,0 +1,17 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> + <memory>524288</memory> + <vcpu>1</vcpu> + <os> + <type arch='ppc64' machine='pseries'>hvm</type> + </os> + <clock offset='utc'/> + <devices> + <emulator>/usr/bin/qemu-system-ppc64</emulator> + <console type='pty'> + <address type="spapr-vio"/> + </console> + <memballoon model="none"/> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio-address-clash.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio-address-clash.args new file mode 100644 index 0000000..e69de29 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio-address-clash.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio-address-clash.xml new file mode 100644 index 0000000..e009274 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio-address-clash.xml @@ -0,0 +1,42 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>2754dd7b-ac8a-4850-aec0-1f3fcd43235b</uuid> + <memory>524288</memory> + <vcpu>1</vcpu> + <os> + <type arch='ppc64' machine='pseries'>hvm</type> + </os> + <clock offset='utc'/> + <devices> + <emulator>/usr/bin/qemu-system-ppc64</emulator> + <console type='pty'> + <address type="spapr-vio"/> + </console> + + <!-- Two serials, first is the console --> + <serial type="pty"> + <address type="spapr-vio"/> + </serial> + <serial type="pty"> + <address type="spapr-vio" reg="0x4000"/> + </serial> + + <!-- One disk --> + <disk type="file" device="disk"> + <driver name="qemu" type="raw"/> + <source file="/tmp/scsidisk.img"/> + <target dev="sda" bus="scsi"/> + <address type="drive" controller="1"/> + </disk> + + <!-- Two SCSI controllers --> + <controller type="scsi" index="1"> + <address type="spapr-vio"/> + </controller> + <controller type="scsi" index="0"> + <address type="spapr-vio" reg="0x4000"/> + </controller> + + <memballoon model="none"/> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio-user-assigned.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio-user-assigned.args new file mode 100644 index 0000000..e939e1b --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio-user-assigned.args @@ -0,0 +1 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu-system-ppc64 -S -M pseries -m 512 -smp 1 -nographic -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/tmp/test-monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c -device spapr-vscsi,id=scsi0,reg=0x2000 -device spapr-vscsi,id=scsi1,reg=0x30000000 -drive file=/tmp/scsidisk.img,if=none,id=drive-scsi1-0-0 -device scsi-disk,bus=scsi1.0,scsi-id=0,drive=drive-scsi1-0-0,id=scsi1-0-0 -chardev pty,id=charserial0 -device spapr-vty,chardev=charserial0,reg=0x20000000 -chardev pty,id=charserial1 -device spapr-vty,chardev=charserial1,reg=0x30001000 -usb diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio-user-assigned.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio-user-assigned.xml new file mode 100644 index 0000000..4b8cb1b --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio-user-assigned.xml @@ -0,0 +1,42 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>2754dd7b-ac8a-4850-aec0-1f3fcd43235b</uuid> + <memory>524288</memory> + <vcpu>1</vcpu> + <os> + <type arch='ppc64' machine='pseries'>hvm</type> + </os> + <clock offset='utc'/> + <devices> + <emulator>/usr/bin/qemu-system-ppc64</emulator> + <console type='pty'> + <address type="spapr-vio"/> + </console> + + <!-- Two serials, first is the console --> + <serial type="pty"> + <address type="spapr-vio" reg="0x20000000"/> + </serial> + <serial type="pty"> + <address type="spapr-vio"/> + </serial> + + <!-- One disk --> + <disk type="file" device="disk"> + <driver name="qemu" type="raw"/> + <source file="/tmp/scsidisk.img"/> + <target dev="sda" bus="scsi"/> + <address type="drive" controller="1"/> + </disk> + + <!-- Two SCSI controllers --> + <controller type="scsi" index="1"> + <address type="spapr-vio" reg="0x30000000"/> + </controller> + <controller type="scsi" index="0"> + <address type="spapr-vio"/> + </controller> + + <memballoon model="none"/> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio.args new file mode 100644 index 0000000..5fe0c88 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio.args @@ -0,0 +1 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu-system-ppc64 -S -M pseries -m 512 -smp 1 -nographic -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/tmp/test-monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c -device spapr-vscsi,id=scsi0,reg=0x2000 -device spapr-vscsi,id=scsi1,reg=0x3000 -drive file=/tmp/scsidisk.img,if=none,id=drive-scsi1-0-0 -device scsi-disk,bus=scsi1.0,scsi-id=0,drive=drive-scsi1-0-0,id=scsi1-0-0 -chardev pty,id=charserial0 -device spapr-vty,chardev=charserial0,reg=0x30000000 -chardev pty,id=charserial1 -device spapr-vty,chardev=charserial1,reg=0x30001000 -usb diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio.xml new file mode 100644 index 0000000..6061087 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio.xml @@ -0,0 +1,42 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>2754dd7b-ac8a-4850-aec0-1f3fcd43235b</uuid> + <memory>524288</memory> + <vcpu>1</vcpu> + <os> + <type arch='ppc64' machine='pseries'>hvm</type> + </os> + <clock offset='utc'/> + <devices> + <emulator>/usr/bin/qemu-system-ppc64</emulator> + <console type='pty'> + <address type="spapr-vio"/> + </console> + + <!-- Two serials, first is the console --> + <serial type="pty"> + <address type="spapr-vio"/> + </serial> + <serial type="pty"> + <address type="spapr-vio"/> + </serial> + + <!-- One disk --> + <disk type="file" device="disk"> + <driver name="qemu" type="raw"/> + <source file="/tmp/scsidisk.img"/> + <target dev="sda" bus="scsi"/> + <address type="drive" controller="1"/> + </disk> + + <!-- Two SCSI controllers --> + <controller type="scsi" index="1"> + <address type="spapr-vio"/> + </controller> + <controller type="scsi" index="0"> + <address type="spapr-vio"/> + </controller> + + <memballoon model="none"/> + </devices> +</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index fb2d36e..3b5fb7f 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -667,6 +667,15 @@ mymain(void) QEMU_CAPS_CHARDEV, QEMU_CAPS_MONITOR_JSON, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_NO_SHUTDOWN); + DO_TEST("pseries-basic", false, + QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG); + DO_TEST("pseries-vio", false, QEMU_CAPS_DRIVE, + QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG); + DO_TEST("pseries-vio-user-assigned", false, QEMU_CAPS_DRIVE, + QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG); + DO_TEST("pseries-vio-address-clash", true, QEMU_CAPS_DRIVE, + QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG); + free(driver.stateDir); virCapabilitiesFree(driver.caps); free(map); -- 1.7.7.3

On 12/12/2011 04:39 PM, Michael Ellerman wrote:
Add four tests of the XML -> argv handling for the PPC64 pseries machine.
The first is just a basic test of a bare bones machine.
The three others test various aspects of the spapr-vio address handling.
It seems that currently we can't include network devices, doing so leads to a segfault because the network driverState is not initialised. Working around that leads us to the problem that the 'default' network doesn't exist. So for now just leave network devices out.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au> --- .../qemuxml2argv-pseries-basic.args | 1 + .../qemuxml2argv-pseries-basic.xml | 17 ++++++++ .../qemuxml2argv-pseries-vio-address-clash.xml | 42 ++++++++++++++++++++ .../qemuxml2argv-pseries-vio-user-assigned.args | 1 + .../qemuxml2argv-pseries-vio-user-assigned.xml | 42 ++++++++++++++++++++ .../qemuxml2argvdata/qemuxml2argv-pseries-vio.args | 1 + .../qemuxml2argvdata/qemuxml2argv-pseries-vio.xml | 42 ++++++++++++++++++++ tests/qemuxml2argvtest.c | 9 ++++ 8 files changed, 155 insertions(+), 0 deletions(-)
Hmm, I got a test failure: 9) qemuxml2argvdata/qemuxml2argv-pseries-vio.xml ... FAILED xmllint --relaxng /home/remote/eblake/libvirt/tests/../docs/schemas/domain.rng --noout /home/remote/eblake/libvirt/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio.xml Relax-NG validity error : Extra element devices in interleave /home/remote/eblake/libvirt/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio.xml:10: element devices: Relax-NG validity error : Element domain failed to validate content /home/remote/eblake/libvirt/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio.xml fails to validate also 119) qemuxml2argvdata/qemuxml2argv-pseries-vio-user-assigned.xml ... FAILED 173) qemuxml2argvdata/qemuxml2argv-pseries-vio-address-clash.xml ... FAILED I'm still trying to figure out what went wrong. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 12/20/2011 04:54 PM, Eric Blake wrote:
On 12/12/2011 04:39 PM, Michael Ellerman wrote:
Add four tests of the XML -> argv handling for the PPC64 pseries machine.
The first is just a basic test of a bare bones machine.
Hmm, I got a test failure:
9) qemuxml2argvdata/qemuxml2argv-pseries-vio.xml ... FAILED 119) qemuxml2argvdata/qemuxml2argv-pseries-vio-user-assigned.xml ... FAILED 173) qemuxml2argvdata/qemuxml2argv-pseries-vio-address-clash.xml ... FAILED
I'm still trying to figure out what went wrong.
Meanwhile, I wanted to validate xml output. Does this look correct, or do we have more changes to make in domain_conf.c to support your desired output? diff --git i/tests/qemuxml2argvdata/qemuxml2argv-pseries-basic.xml w/tests/qemuxml2argvdata/qemuxml2argv-pseries-basic.xml index 908ff4b..7893c47 100644 --- i/tests/qemuxml2argvdata/qemuxml2argv-pseries-basic.xml +++ w/tests/qemuxml2argvdata/qemuxml2argv-pseries-basic.xml @@ -2,16 +2,26 @@ <name>QEMUGuest1</name> <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> <memory>524288</memory> + <currentMemory>524288</currentMemory> <vcpu>1</vcpu> <os> <type arch='ppc64' machine='pseries'>hvm</type> + <boot dev='hd'/> </os> <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-system-ppc64</emulator> + <serial type='pty'> + <target port='0'/> + <address type='spapr-vio'/> + </serial> <console type='pty'> - <address type="spapr-vio"/> + <target type='serial' port='0'/> + <address type='spapr-vio'/> </console> - <memballoon model="none"/> + <memballoon model='none'/> </devices> </domain> diff --git i/tests/qemuxml2xmltest.c w/tests/qemuxml2xmltest.c index 35bfdce..6a88a77 100644 --- i/tests/qemuxml2xmltest.c +++ w/tests/qemuxml2xmltest.c @@ -194,6 +194,8 @@ mymain(void) DO_TEST("usb-redir"); DO_TEST("blkdeviotune"); + DO_TEST("pseries-basic"); + /* These tests generate different XML */ DO_TEST_DIFFERENT("balloon-device-auto"); DO_TEST_DIFFERENT("channel-virtio-auto"); -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Tue, 2011-12-20 at 16:54 -0700, Eric Blake wrote:
On 12/12/2011 04:39 PM, Michael Ellerman wrote:
Add four tests of the XML -> argv handling for the PPC64 pseries machine.
Hmm, I got a test failure:
9) qemuxml2argvdata/qemuxml2argv-pseries-vio.xml ... FAILED xmllint --relaxng /home/remote/eblake/libvirt/tests/../docs/schemas/domain.rng --noout /home/remote/eblake/libvirt/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio.xml Relax-NG validity error : Extra element devices in interleave /home/remote/eblake/libvirt/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio.xml:10: element devices: Relax-NG validity error : Element domain failed to validate content /home/remote/eblake/libvirt/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio.xml fails to validate
also
119) qemuxml2argvdata/qemuxml2argv-pseries-vio-user-assigned.xml ... FAILED 173) qemuxml2argvdata/qemuxml2argv-pseries-vio-address-clash.xml ... FAILED
I'm still trying to figure out what went wrong.
Urgh, sorry. Works for me here. What am I doing wrong? cheers

On 12/20/2011 05:25 PM, Michael Ellerman wrote:
On Tue, 2011-12-20 at 16:54 -0700, Eric Blake wrote:
On 12/12/2011 04:39 PM, Michael Ellerman wrote:
Add four tests of the XML -> argv handling for the PPC64 pseries machine.
Hmm, I got a test failure:
9) qemuxml2argvdata/qemuxml2argv-pseries-vio.xml ... FAILED xmllint --relaxng /home/remote/eblake/libvirt/tests/../docs/schemas/domain.rng --noout /home/remote/eblake/libvirt/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio.xml Relax-NG validity error : Extra element devices in interleave /home/remote/eblake/libvirt/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio.xml:10: element devices: Relax-NG validity error : Element domain failed to validate content /home/remote/eblake/libvirt/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio.xml fails to validate
also
119) qemuxml2argvdata/qemuxml2argv-pseries-vio-user-assigned.xml ... FAILED 173) qemuxml2argvdata/qemuxml2argv-pseries-vio-address-clash.xml ... FAILED
I'm still trying to figure out what went wrong.
Urgh, sorry. Works for me here. What am I doing wrong?
What version of xmllint do you have installed? I'm wondering why the missing unit attribute choked for me but not you. I tested on Fedora 16, with xmllint from libxml2-2.7.8-6.fc16.x86_64. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Tue, 2011-12-20 at 17:37 -0700, Eric Blake wrote:
On 12/20/2011 05:25 PM, Michael Ellerman wrote:
On Tue, 2011-12-20 at 16:54 -0700, Eric Blake wrote:
On 12/12/2011 04:39 PM, Michael Ellerman wrote:
Add four tests of the XML -> argv handling for the PPC64 pseries machine.
Hmm, I got a test failure:
9) qemuxml2argvdata/qemuxml2argv-pseries-vio.xml ... FAILED xmllint --relaxng /home/remote/eblake/libvirt/tests/../docs/schemas/domain.rng --noout /home/remote/eblake/libvirt/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio.xml Relax-NG validity error : Extra element devices in interleave
Urgh, sorry. Works for me here. What am I doing wrong?
What version of xmllint do you have installed? I'm wondering why the missing unit attribute choked for me but not you.
I tested on Fedora 16, with xmllint from libxml2-2.7.8-6.fc16.x86_64.
I'm on debian, with 2.7.8.dfsg-5. But if I run that command line (above) by hand I get the failure. So it's as if the make check is doing something else. cheers

On Wed, 2011-12-21 at 11:45 +1100, Michael Ellerman wrote:
On Tue, 2011-12-20 at 17:37 -0700, Eric Blake wrote:
On 12/20/2011 05:25 PM, Michael Ellerman wrote:
On Tue, 2011-12-20 at 16:54 -0700, Eric Blake wrote:
On 12/12/2011 04:39 PM, Michael Ellerman wrote:
Add four tests of the XML -> argv handling for the PPC64 pseries machine.
Hmm, I got a test failure:
9) qemuxml2argvdata/qemuxml2argv-pseries-vio.xml ... FAILED xmllint --relaxng /home/remote/eblake/libvirt/tests/../docs/schemas/domain.rng --noout /home/remote/eblake/libvirt/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio.xml Relax-NG validity error : Extra element devices in interleave
Urgh, sorry. Works for me here. What am I doing wrong?
What version of xmllint do you have installed? I'm wondering why the missing unit attribute choked for me but not you.
I tested on Fedora 16, with xmllint from libxml2-2.7.8-6.fc16.x86_64.
I'm on debian, with 2.7.8.dfsg-5.
But if I run that command line (above) by hand I get the failure. So it's as if the make check is doing something else.
Gah, no I'm a chump. It is failing here, I was just missing it. It doesn't fail with my patches as I posted them. But if I rebase onto upstream then I get the failure. So something has changed recently it seems. cheers

On Wed, 2011-12-21 at 12:09 +1100, Michael Ellerman wrote:
On Wed, 2011-12-21 at 11:45 +1100, Michael Ellerman wrote:
On Tue, 2011-12-20 at 17:37 -0700, Eric Blake wrote:
On 12/20/2011 05:25 PM, Michael Ellerman wrote:
On Tue, 2011-12-20 at 16:54 -0700, Eric Blake wrote:
On 12/12/2011 04:39 PM, Michael Ellerman wrote:
Add four tests of the XML -> argv handling for the PPC64 pseries machine.
Hmm, I got a test failure:
9) qemuxml2argvdata/qemuxml2argv-pseries-vio.xml ... FAILED xmllint --relaxng /home/remote/eblake/libvirt/tests/../docs/schemas/domain.rng --noout /home/remote/eblake/libvirt/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio.xml Relax-NG validity error : Extra element devices in interleave
Urgh, sorry. Works for me here. What am I doing wrong?
What version of xmllint do you have installed? I'm wondering why the missing unit attribute choked for me but not you.
I tested on Fedora 16, with xmllint from libxml2-2.7.8-6.fc16.x86_64.
I'm on debian, with 2.7.8.dfsg-5.
But if I run that command line (above) by hand I get the failure. So it's as if the make check is doing something else.
Gah, no I'm a chump. It is failing here, I was just missing it.
It doesn't fail with my patches as I posted them. But if I rebase onto upstream then I get the failure. So something has changed recently it seems.
No, epic fail. The test does fail, if I do it right. I'll debug it here and post something. cheers

On 12/20/2011 04:54 PM, Eric Blake wrote:
The three others test various aspects of the spapr-vio address handling.
Hmm, I got a test failure:
9) qemuxml2argvdata/qemuxml2argv-pseries-vio.xml ... FAILED 119) qemuxml2argvdata/qemuxml2argv-pseries-vio-user-assigned.xml ... FAILED 173) qemuxml2argvdata/qemuxml2argv-pseries-vio-address-clash.xml ... FAILED
This silences it, although I don't know if it is right. Also, your formatting is not consistent with the rest of the tests (2-space indent per added level of xml nesting). Does this mean our XML is too strict (failure to validate something we parse), or is our domain_conf too loose (do we want unit to be mandatory, even if it ends up being unit 0)? diff --git i/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio-address-clash.xml w/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio-address-clash.xml index e009274..a5189ef 100644 --- i/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio-address-clash.xml +++ w/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio-address-clash.xml @@ -26,7 +26,7 @@ <driver name="qemu" type="raw"/> <source file="/tmp/scsidisk.img"/> <target dev="sda" bus="scsi"/> - <address type="drive" controller="1"/> + <address type="drive" controller="1" unit='0'/> </disk> <!-- Two SCSI controllers --> diff --git i/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio-user-assigned.xml w/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio-user-assigned.xml index 4b8cb1b..1877efb 100644 --- i/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio-user-assigned.xml +++ w/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio-user-assigned.xml @@ -26,7 +26,7 @@ <driver name="qemu" type="raw"/> <source file="/tmp/scsidisk.img"/> <target dev="sda" bus="scsi"/> - <address type="drive" controller="1"/> + <address type="drive" controller="1" unit='0'/> </disk> <!-- Two SCSI controllers --> diff --git i/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio.xml w/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio.xml index 6061087..55d833b 100644 --- i/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio.xml +++ w/tests/qemuxml2argvdata/qemuxml2argv-pseries-vio.xml @@ -26,7 +26,7 @@ <driver name="qemu" type="raw"/> <source file="/tmp/scsidisk.img"/> <target dev="sda" bus="scsi"/> - <address type="drive" controller="1"/> + <address type="drive" controller="1" unit='0'/> </disk> <!-- Two SCSI controllers --> -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Tue, 2011-12-20 at 17:25 -0700, Eric Blake wrote:
On 12/20/2011 04:54 PM, Eric Blake wrote:
The three others test various aspects of the spapr-vio address handling.
Hmm, I got a test failure:
9) qemuxml2argvdata/qemuxml2argv-pseries-vio.xml ... FAILED 119) qemuxml2argvdata/qemuxml2argv-pseries-vio-user-assigned.xml ... FAILED 173) qemuxml2argvdata/qemuxml2argv-pseries-vio-address-clash.xml ... FAILED
This silences it, although I don't know if it is right. Also, your formatting is not consistent with the rest of the tests (2-space indent per added level of xml nesting).
Sorry, will fix.
Does this mean our XML is too strict (failure to validate something we parse), or is our domain_conf too loose (do we want unit to be mandatory, even if it ends up being unit 0)?
The code in the (entirely pointless) virDomainDeviceDriveAddressIsValid, explicitly says "0 is valid for all fields". And at least in my case 0 works fine. So I think the XML is too strict. cheers

On Tue, 2011-12-13 at 10:39 +1100, Michael Ellerman wrote:
For QEMU PPC64 we have a machine type ("pseries") which has a virtual bus called "spapr-vio". We need to be able to create devices on this bus, and as such need a way to specify the address for those devices.
This patch adds a new address type "spapr-vio", which achieves this.
The addressing is specified with a "reg" property in the address definition. The reg is optional, if it is not specified QEMU will auto-assign an address for the device.
AFAICS this series still applies, so please consider this a resend. cheers

On 12/12/2011 04:39 PM, Michael Ellerman wrote:
For QEMU PPC64 we have a machine type ("pseries") which has a virtual bus called "spapr-vio". We need to be able to create devices on this
bus, and as such need a way to specify the address for those devices.
This patch adds a new address type "spapr-vio", which achieves this.
The addressing is specified with a "reg" property in the address definition. The reg is optional, if it is not specified QEMU will auto-assign an address for the device.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au> --- src/conf/domain_conf.c | 43 ++++++++++++++++++++++++++++++++++++++++++- src/conf/domain_conf.h | 9 +++++++++ src/qemu/qemu_command.c | 5 +++++ 3 files changed, 56 insertions(+), 1 deletions(-)
ACK and pushed. Matches what I had already (pre-emptively) documented, thanks to your doc review of commit fe7fc16.
@@ -2168,6 +2174,34 @@ cleanup: }
static int +virDomainDeviceSpaprVioAddressParseXML(xmlNodePtr node, + virDomainDeviceSpaprVioAddressPtr addr) +{ + char *reg; + int ret; + + memset(addr, 0, sizeof(*addr)); + addr->has_reg = false;
Not strictly necessary - memset already did that. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Tue, 2011-12-20 at 15:35 -0700, Eric Blake wrote:
On 12/12/2011 04:39 PM, Michael Ellerman wrote:
For QEMU PPC64 we have a machine type ("pseries") which has a virtual bus called "spapr-vio". We need to be able to create devices on this bus, and as such need a way to specify the address for those devices.
ACK and pushed. Matches what I had already (pre-emptively) documented, thanks to your doc review of commit fe7fc16.
Thanks.
@@ -2168,6 +2174,34 @@ cleanup: }
static int +virDomainDeviceSpaprVioAddressParseXML(xmlNodePtr node, + virDomainDeviceSpaprVioAddressPtr addr) +{ + char *reg; + int ret; + + memset(addr, 0, sizeof(*addr)); + addr->has_reg = false;
Not strictly necessary - memset already did that.
Yes indeed. I think I added the memset 2nd. cheers
participants (3)
-
Bharata B Rao
-
Eric Blake
-
Michael Ellerman