[libvirt] [PATCH 2/4] qemu: Add architecture checks to qemuDomainMachineIsVirt()

Laine Stump laine at laine.org
Thu Jun 23 18:08:38 UTC 2016


On 06/23/2016 04:40 AM, Andrea Bolognani wrote:
> Remove all external architecture checks that have been
> made redundant by this change.
> ---
>   src/qemu/qemu_capabilities.c | 12 +++++-------
>   src/qemu/qemu_command.c      |  4 +---
>   src/qemu/qemu_domain.c       | 12 +++++++++---
>   3 files changed, 15 insertions(+), 13 deletions(-)
>
> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index 4ed5b71..5fcd744 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -2174,13 +2174,11 @@ bool virQEMUCapsHasPCIMultiBus(virQEMUCapsPtr qemuCaps,
>           return false;
>       }
>   
> -    if (ARCH_IS_ARM(def->os.arch)) {
> -        /* If 'virt' supports PCI, it supports multibus.
> -         * No extra conditions here for simplicity.
> -         */

Just to be pedantic - here you're removing a check for ARMV6L or ARMV7L 
or ARMV7B or AARCH64, and replacing it with a simpler check for ARMV7L 
or AARCH64. But I guess the virt machinetype isn't available/possible on 
those other two types?

As long as that's okay, ACK.


> -        if (qemuDomainMachineIsVirt(def))
> -            return true;
> -    }
> +    /* If 'virt' supports PCI, it supports multibus.
> +     * No extra conditions here for simplicity.
> +     */
> +    if (qemuDomainMachineIsVirt(def))
> +        return true;
>   
>       return false;
>   }
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 030d84b..10bcb1c 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -6831,9 +6831,7 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
>   
>           if (def->features[VIR_DOMAIN_FEATURE_GIC] == VIR_TRISTATE_SWITCH_ON) {
>               if (def->gic_version != VIR_GIC_VERSION_NONE) {
> -                if ((def->os.arch != VIR_ARCH_ARMV7L &&
> -                     def->os.arch != VIR_ARCH_AARCH64) ||
> -                    !qemuDomainMachineIsVirt(def)) {
> +                if (!qemuDomainMachineIsVirt(def)) {
>                       virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
>                                      _("gic-version option is available "
>                                        "only for ARM virt machine"));
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index 1f99baa..3e906b3 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -2040,7 +2040,6 @@ qemuDomainDefEnableDefaultFeatures(virDomainDefPtr def,
>        * was not included in the domain XML, we need to choose a suitable
>        * GIC version ourselves */
>       if (def->features[VIR_DOMAIN_FEATURE_GIC] == VIR_TRISTATE_SWITCH_ABSENT &&
> -        (def->os.arch == VIR_ARCH_ARMV7L || def->os.arch == VIR_ARCH_AARCH64) &&
>           qemuDomainMachineIsVirt(def)) {
>   
>           VIR_DEBUG("Looking for usable GIC version in domain capabilities");
> @@ -4919,8 +4918,15 @@ qemuDomainMachineIsS390CCW(const virDomainDef *def)
>   bool
>   qemuDomainMachineIsVirt(const virDomainDef *def)
>   {
> -    return STREQ(def->os.machine, "virt") ||
> -           STRPREFIX(def->os.machine, "virt-");
> +    if (def->os.arch != VIR_ARCH_ARMV7L &&
> +        def->os.arch != VIR_ARCH_AARCH64)
> +        return false;
> +
> +    if (STRNEQ(def->os.machine, "virt") &&
> +        !STRPREFIX(def->os.machine, "virt-"))
> +        return false;
> +
> +    return true;
>   }
>   
>   





More information about the libvir-list mailing list