]> xenbits.xensource.com Git - libvirt.git/commit
conf: fix zPCI address auto-generation on s390
authorShalini Chellathurai Saroja <shalini@linux.ibm.com>
Thu, 18 Jun 2020 08:25:15 +0000 (10:25 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Fri, 26 Jun 2020 16:53:51 +0000 (18:53 +0200)
commit076591009ad11ec108521b52a4945d0f895fa160
treed541b8ba121013f960cfca709daa37e9c42967ec
parentc125556c12cacee1ce7bb6aec906f586b1c2f05c
conf: fix zPCI address auto-generation on s390

Let us fix the issues with zPCI address validation and auto-generation
on s390.

Currently, there are two issues with handling the ZPCI address
extension. Firstly, when the uid is to be auto-generated with a
specified fid, .i.e.:

    ...
    <address type='pci'>
        <zpci fid='0x0000001f'/>
    </address>
    ...

we expect uid='0x0001' (or the next available uid for the domain).
However, we get a parsing error:

    $ virsh define zpci.xml
    error: XML error: Invalid PCI address uid='0x0000', must be > 0x0000
    and <= 0xffff

Secondly, when the uid is specified explicitly with the invalid
numerical value '0x0000', we actually expect the parsing error above.
However, the domain is being defined and the uid value is silently
changed to a valid value.

The first issue is a bug and the second one is undesired behaviour, and
both issues are related to how we (in-band) signal invalid values for
uid and fid. So let's fix the XML parsing to do validation based on what
is actually specified in the XML.

The first issue is also related to the current code behaviour, which
is, if either uid or fid is specified by the user, it is incorrectly
assumed that both uid and fid are specified. This bug is fixed by
identifying when the user specified ZPCI address is incomplete and
auto-generating the missing ZPCI address.

Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com>
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
src/conf/device_conf.c
src/conf/domain_addr.c
src/conf/domain_conf.c
src/libvirt_private.syms
src/qemu/qemu_command.c
src/qemu/qemu_hotplug.c
src/qemu/qemu_validate.c
src/util/virpci.c
src/util/virpci.h
tests/qemuxml2argvdata/hostdev-vfio-zpci-uid-set-zero.xml [new file with mode: 0644]
tests/qemuxml2argvtest.c