[meta-virtualization] [PATCH] libvirt: Fix bug in assigning virtio-mmio disks with qemu

Bogdan Purcareata bogdan.purcareata at nxp.com
Thu Apr 7 02:13:24 PDT 2016


On 07.04.2016 09:57, Bruce Ashfield wrote:
> On Tue, Apr 5, 2016 at 11:48 AM, Bogdan Purcareata <
> bogdan.purcareata at nxp.com> wrote:
>
>> Patch contains a more detailed description. Basically allows adding
>> virtio-mmio
>> block device to QEMU guests. Tested on ARM64.
>>
>> Please apply on jethro branch.
>>
>
> We don't want to create functionality on old branches that isn't also on
> master.
> Is there any reason why this wouldn't be applicable to master as well ?

Master delivers libvirt 1.3.2 [1] which has this patch included:

[libvirt]$ git checkout v1.3.2 && git log --pretty=oneline | grep "Ignore 
virtio-mmio"
d526e37bad2515cf91caa0e4ff3edaf41e45b5c2 Ignore virtio-mmio disks in 
qemuAssignDevicePCISlots()

[1] 
https://git.yoctoproject.org/cgit/cgit.cgi/meta-virtualization/tree/recipes-extended/libvirt

Thank you,
Bogdan P.

>>
>> Signed-off-by: Bogdan Purcareata <bogdan.purcareata at nxp.com>
>> ---
>>   ...io-mmio-disks-in-qemuAssignDevicePCISlots.patch | 81
>> ++++++++++++++++++++++
>>   recipes-extended/libvirt/libvirt_1.2.19.bb         |  1 +
>>   2 files changed, 82 insertions(+)
>>   create mode 100644
>> recipes-extended/libvirt/libvirt/Ignore-virtio-mmio-disks-in-qemuAssignDevicePCISlots.patch
>>
>> diff --git
>> a/recipes-extended/libvirt/libvirt/Ignore-virtio-mmio-disks-in-qemuAssignDevicePCISlots.patch
>> b/recipes-extended/libvirt/libvirt/Ignore-virtio-mmio-disks-in-qemuAssignDevicePCISlots.patch
>> new file mode 100644
>> index 0000000..f0b7ab5
>> --- /dev/null
>> +++
>> b/recipes-extended/libvirt/libvirt/Ignore-virtio-mmio-disks-in-qemuAssignDevicePCISlots.patch
>> @@ -0,0 +1,81 @@
>> +From d526e37bad2515cf91caa0e4ff3edaf41e45b5c2 Mon Sep 17 00:00:00 2001
>> +From: Pavel Fedin <p.fedin at samsung.com>
>> +Date: Wed, 9 Sep 2015 15:02:53 +0300
>> +Subject: [PATCH] Ignore virtio-mmio disks in qemuAssignDevicePCISlots()
>> +
>> +Fixes the following error when attempting to add a disk with bus='virtio'
>> +to a machine which actually supports virtio-mmio (caught with ARM virt):
>> +
>> +virtio disk cannot have an address of type 'virtio-mmio'
>> +
>> +The problem has been likely introduced by
>> +e8d55172544c1fafe31a9e09346bdebca4f0d6f9. Before that
>> +qemuAssignDevicePCISlots() was never called for ARM "virt" machine.
>> +
>> +Upstream-status: Accepted
>> +[
>> https://libvirt.org/git/?p=libvirt.git;a=commit;h=d526e37bad2515cf91caa0e4ff3edaf41e45b5c2
>> ]
>> +
>> +Signed-off-by: Pavel Fedin <p.fedin at samsung.com>
>> +---
>> + src/qemu/qemu_command.c | 11 +++++++++--
>> + src/qemu/qemu_command.h |  1 +
>> + 2 files changed, 10 insertions(+), 2 deletions(-)
>> +
>> +diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
>> +index b56670c..25f57f2 100644
>> +--- a/src/qemu/qemu_command.c
>> ++++ b/src/qemu/qemu_command.c
>> +@@ -2261,7 +2261,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
>> +                 virDomainPCIAddressReserveNextSlot(addrs, &info, flags)
>> < 0)
>> +                 goto cleanup;
>> +
>> +-            if (qemuAssignDevicePCISlots(def, addrs) < 0)
>> ++            if (qemuAssignDevicePCISlots(def, qemuCaps, addrs) < 0)
>> +                 goto cleanup;
>> +
>> +             for (i = 1; i < addrs->nbuses; i++) {
>> +@@ -2294,7 +2294,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
>> +             if (qemuValidateDevicePCISlotsChipsets(def, qemuCaps, addrs)
>> < 0)
>> +                 goto cleanup;
>> +
>> +-            if (qemuAssignDevicePCISlots(def, addrs) < 0)
>> ++            if (qemuAssignDevicePCISlots(def, qemuCaps, addrs) < 0)
>> +                 goto cleanup;
>> +
>> +             for (i = 0; i < def->ncontrollers; i++) {
>> +@@ -2426,6 +2426,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
>> +  */
>> + int
>> + qemuAssignDevicePCISlots(virDomainDefPtr def,
>> ++                         virQEMUCapsPtr qemuCaps,
>> +                          virDomainPCIAddressSetPtr addrs)
>> + {
>> +     size_t i, j;
>> +@@ -2618,6 +2619,12 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
>> +             VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW)
>> +             continue;
>> +
>> ++        /* Also ignore virtio-mmio disks if our machine allows them */
>> ++        if (def->disks[i]->info.type ==
>> ++            VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO &&
>> ++            virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_MMIO))
>> ++            continue;
>> ++
>> +         if (def->disks[i]->info.type !=
>> VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
>> +             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
>> +                            _("virtio disk cannot have an address of type
>> '%s'"),
>> +diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
>> +index 767d31f..4aa7f2d 100644
>> +--- a/src/qemu/qemu_command.h
>> ++++ b/src/qemu/qemu_command.h
>> +@@ -284,6 +284,7 @@ virDomainPCIAddressSetPtr
>> qemuDomainPCIAddressSetCreate(virDomainDefPtr def,
>> +                                                         bool dryRun);
>> +
>> + int qemuAssignDevicePCISlots(virDomainDefPtr def,
>> ++                             virQEMUCapsPtr qemuCaps,
>> +                              virDomainPCIAddressSetPtr addrs);
>> +
>> + int qemuAssignDeviceAliases(virDomainDefPtr def, virQEMUCapsPtr
>> qemuCaps);
>> +--
>> +1.9.1
>> +
>> diff --git a/recipes-extended/libvirt/libvirt_1.2.19.bb
>> b/recipes-extended/libvirt/libvirt_1.2.19.bb
>> index df53d59..774eea4 100644
>> --- a/recipes-extended/libvirt/libvirt_1.2.19.bb
>> +++ b/recipes-extended/libvirt/libvirt_1.2.19.bb
>> @@ -33,6 +33,7 @@ SRC_URI = "
>> http://libvirt.org/sources/libvirt-${PV}.tar.gz;name=libvirt \
>>              file://libvirt-use-pkg-config-to-locate-libcap.patch \
>>              file://0001-to-fix-build-error.patch \
>>              file://Revert-build-add-prefix-to-SYSTEMD_UNIT_DIR.patch \
>> +
>>   file://Ignore-virtio-mmio-disks-in-qemuAssignDevicePCISlots.patch \
>>             "
>>
>>   SRC_URI[libvirt.md5sum] = "bc3ab1ba5b6fabd2e4516c70ddd4d97c"
>> --
>> 1.9.1
>>
>> --
>> _______________________________________________
>> meta-virtualization mailing list
>> meta-virtualization at yoctoproject.org
>> https://lists.yoctoproject.org/listinfo/meta-virtualization
>>
>
>
>


More information about the meta-virtualization mailing list