[libvirt] [PATCH v2 2/2] Allow PCI virtio on ARM "virt" machine

Cole Robinson crobinso at redhat.com
Sun Jun 21 20:10:58 UTC 2015


On 06/11/2015 02:40 AM, Pavel Fedin wrote:
> Signed-off-by: Pavel Fedin <p.fedin at samsung.com>
> ---
>  src/qemu/qemu_command.c | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 0a6d92f..2acdc6a 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -457,7 +457,7 @@ qemuDomainSupportsNicdev(virDomainDefPtr def,
>      /* non-virtio ARM nics require legacy -net nic */
>      if (((def->os.arch == VIR_ARCH_ARMV7L) ||
>          (def->os.arch == VIR_ARCH_AARCH64)) &&
> -        net->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO)
> +        strcmp(net->model, "virtio"))
>          return false;
>  
>      return true;
> @@ -1375,8 +1375,9 @@ qemuDomainAssignARMVirtioMMIOAddresses(virDomainDefPtr def,
>      if (((def->os.arch == VIR_ARCH_ARMV7L) ||
>          (def->os.arch == VIR_ARCH_AARCH64)) &&
>          (STRPREFIX(def->os.machine, "vexpress-") ||
> -            STREQ(def->os.machine, "virt") ||
> -            STRPREFIX(def->os.machine, "virt-")) &&
> +            (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_ARM_VIRT_PCI) &&
> +                (STREQ(def->os.machine, "virt") ||
> +                 STRPREFIX(def->os.machine, "virt-")))) &&
>          virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_MMIO)) {
>          qemuDomainPrimeVirtioDeviceAddresses(
>              def, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO);
> @@ -2498,6 +2499,14 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
>              VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW)
>              continue;
>  
> +        /* ARM virt machine can also have virtio-mmio devices */
> +        if (((def->os.arch == VIR_ARCH_ARMV7L) ||
> +            (def->os.arch == VIR_ARCH_AARCH64)) &&
> +                (STREQ(def->os.machine, "virt") ||
> +                STRPREFIX(def->os.machine, "virt-")) &&
> +            def->disks[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_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'"),
> 

We can't apply this without unit test additions. We will at least need a test
for qemu 2.3+ defaulting to PCI, and a test to ensure that manually specified
virtio-mmio continues to do the correct thing. I'll take a stab at it this week

- Cole




More information about the libvir-list mailing list