diff mbox series

[2/2] hw/arm/virt: Fix gic-version=max when CONFIG_ARM_GICV3_TCG is unset

Message ID 20220308182452.223473-3-eric.auger@redhat.com (mailing list archive)
State New, archived
Headers show
Series hw/arm/virt: Fix make check-qtest-aarch64 when CONFIG_ARM_GIC_TCG is unset | expand

Commit Message

Eric Auger March 8, 2022, 6:24 p.m. UTC
In TCG mode, if gic-version=max we always select GICv3 even if
CONFIG_ARM_GICV3_TCG is unset. We shall rather select GICv2.
This also brings the benefit of fixing qos tests errors for tests
using gic-version=max with CONFIG_ARM_GICV3_TCG unset.

Signed-off-by: Eric Auger <eric.auger@redhat.com>

---

v2 -> v3:
- Use module_object_class_by_name() and refer to the renamed
  CONFIG_ARM_GICV3_TCG config
---
 hw/arm/virt.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Andrew Jones March 9, 2022, 7:14 a.m. UTC | #1
On Tue, Mar 08, 2022 at 07:24:52PM +0100, Eric Auger wrote:
> In TCG mode, if gic-version=max we always select GICv3 even if
> CONFIG_ARM_GICV3_TCG is unset. We shall rather select GICv2.
> This also brings the benefit of fixing qos tests errors for tests
> using gic-version=max with CONFIG_ARM_GICV3_TCG unset.
> 
> Signed-off-by: Eric Auger <eric.auger@redhat.com>
> 
> ---
> 
> v2 -> v3:
> - Use module_object_class_by_name() and refer to the renamed
>   CONFIG_ARM_GICV3_TCG config
> ---
>  hw/arm/virt.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index 46bf7ceddf..39790d29d2 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -1852,7 +1852,12 @@ static void finalize_gic_version(VirtMachineState *vms)
>          vms->gic_version = VIRT_GIC_VERSION_2;
>          break;
>      case VIRT_GIC_VERSION_MAX:
> -        vms->gic_version = VIRT_GIC_VERSION_3;
> +        if (module_object_class_by_name("arm-gicv3")) {
> +            /* CONFIG_ARM_GICV3_TCG was set */
> +            vms->gic_version = VIRT_GIC_VERSION_3;
> +        } else {
> +            vms->gic_version = VIRT_GIC_VERSION_2;
> +        }
>          break;
>      case VIRT_GIC_VERSION_HOST:
>          error_report("gic-version=host requires KVM");
> -- 
> 2.26.3
>

 
Reviewed-by: Andrew Jones <drjones@redhat.com>
Philippe Mathieu-Daudé March 15, 2022, 6:39 p.m. UTC | #2
On 8/3/22 19:24, Eric Auger wrote:
> In TCG mode, if gic-version=max we always select GICv3 even if
> CONFIG_ARM_GICV3_TCG is unset. We shall rather select GICv2.
> This also brings the benefit of fixing qos tests errors for tests
> using gic-version=max with CONFIG_ARM_GICV3_TCG unset.
> 
> Signed-off-by: Eric Auger <eric.auger@redhat.com>
> 
> ---
> 
> v2 -> v3:
> - Use module_object_class_by_name() and refer to the renamed
>    CONFIG_ARM_GICV3_TCG config
> ---
>   hw/arm/virt.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index 46bf7ceddf..39790d29d2 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -1852,7 +1852,12 @@ static void finalize_gic_version(VirtMachineState *vms)
>           vms->gic_version = VIRT_GIC_VERSION_2;
>           break;
>       case VIRT_GIC_VERSION_MAX:
> -        vms->gic_version = VIRT_GIC_VERSION_3;
> +        if (module_object_class_by_name("arm-gicv3")) {

Too late, but why not use TYPE_ARM_GICV3?

> +            /* CONFIG_ARM_GICV3_TCG was set */
> +            vms->gic_version = VIRT_GIC_VERSION_3;
> +        } else {
> +            vms->gic_version = VIRT_GIC_VERSION_2;
> +        }
>           break;
>       case VIRT_GIC_VERSION_HOST:
>           error_report("gic-version=host requires KVM");
diff mbox series

Patch

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 46bf7ceddf..39790d29d2 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1852,7 +1852,12 @@  static void finalize_gic_version(VirtMachineState *vms)
         vms->gic_version = VIRT_GIC_VERSION_2;
         break;
     case VIRT_GIC_VERSION_MAX:
-        vms->gic_version = VIRT_GIC_VERSION_3;
+        if (module_object_class_by_name("arm-gicv3")) {
+            /* CONFIG_ARM_GICV3_TCG was set */
+            vms->gic_version = VIRT_GIC_VERSION_3;
+        } else {
+            vms->gic_version = VIRT_GIC_VERSION_2;
+        }
         break;
     case VIRT_GIC_VERSION_HOST:
         error_report("gic-version=host requires KVM");