Skip to contentSkip to conversation

hw/arm/virt: Fix make check-qtest-aarch64 when CONFIG_ARM_GIC_TCG is unset

PATCH Applied Eric Auger 4 participants 7 messages Mar 8, 2022 – Mar 15, 2022 Arm/Amlogic Meson SoC support

lore
Share & tools
lore

Eric Auger

author
#0 lore raw

cover hw/arm/virt: Fix make check-qtest-aarch64 when CONFIG_ARM_GIC_TCG is unset

When CONFIG_ARM_GIC_TCG is unset, qtests fail with ERROR:../qom/object.c:715:object_new_with_type: assertion failed: (type != NULL)

This is due to the fact a bunch tests use gic-version=max which currectly unconditionally selects GICv3, ignoring the fact this latter may have been disabled.

This series renames CONFIG_ARM_GIC_TCG into CONFIG_ARM_GICv3_TCG. Also it selects GICv2 if gic-version=max and CONFIG_ARM_GICV3_TCG is unset, in TCG mode. With those fixes qtests pass along with virt machine node.

Best Regards

Eric

This series can be found at:
https://github.com/eauger/qemu/tree/gicv3_tcg_v3

Eric Auger (2):
hw/intc: Rename CONFIG_ARM_GIC_TCG into CONFIG_ARM_GICV3_TCG hw/arm/virt: Fix gic-version=max when CONFIG_ARM_GICV3_TCG is unset

 hw/arm/virt.c       | 7 ++++++-
 hw/intc/Kconfig     | 2 +-
 hw/intc/meson.build | 4 ++--
 3 files changed, 9 insertions(+), 4 deletions(-)
Signature · 1 line
2.26.3
author
#1 lore raw

PATCH 1/2 hw/intc: Rename CONFIG_ARM_GIC_TCG into CONFIG_ARM_GICV3_TCG

CONFIG_ARM_GIC_TCG actually guards the compilation of TCG GICv3 specific files. So let's rename it into CONFIG_ARM_GICV3_TCG

---
 hw/intc/Kconfig     | 2 +-
 hw/intc/meson.build | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
hw/intc/Kconfig +1 -1
index ec8d4cec29..a7cf301eab 100644
@@ -25,7 +25,7 @@ config APIC
     select MSI_NONBROKEN
     select I8259
 
-config ARM_GIC_TCG
+config ARM_GICV3_TCG
     bool
     default y
     depends on ARM_GIC && TCG
hw/intc/meson.build +2 -2
index 81ccdb0d78..d6d012fb26 100644
@@ -6,7 +6,7 @@ softmmu_ss.add(when: 'CONFIG_ARM_GIC', if_true: files(
   'arm_gicv3_common.c',
   'arm_gicv3_its_common.c',
 ))
-softmmu_ss.add(when: 'CONFIG_ARM_GIC_TCG', if_true: files(
+softmmu_ss.add(when: 'CONFIG_ARM_GICV3_TCG', if_true: files(
   'arm_gicv3.c',
   'arm_gicv3_dist.c',
   'arm_gicv3_its.c',
@@ -28,7 +28,7 @@ softmmu_ss.add(when: 'CONFIG_XLNX_ZYNQMP_PMU', if_true: files('xlnx-pmu-iomod-in
 specific_ss.add(when: 'CONFIG_ALLWINNER_A10_PIC', if_true: files('allwinner-a10-pic.c'))
 specific_ss.add(when: 'CONFIG_APIC', if_true: files('apic.c', 'apic_common.c'))
 specific_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif_common.c'))
-specific_ss.add(when: 'CONFIG_ARM_GIC_TCG', if_true: files('arm_gicv3_cpuif.c'))
+specific_ss.add(when: 'CONFIG_ARM_GICV3_TCG', if_true: files('arm_gicv3_cpuif.c'))
 specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gic_kvm.c'))
 specific_ss.add(when: ['CONFIG_ARM_GIC_KVM', 'TARGET_AARCH64'], if_true: files('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c'))
 specific_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('armv7m_nvic.c'))
Signature · 1 line
2.26.3
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] hw/intc: Rename CONFIG_ARM_GIC_TCG into CONFIG_ARM_GICV3_TCG

Quoted 9 lines · Eric Auger

CONFIG_ARM_GIC_TCG actually guards the compilation of TCG GICv3 specific files. So let's rename it into CONFIG_ARM_GICV3_TCG

---
 hw/intc/Kconfig     | 2 +-
 hw/intc/meson.build | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
author
#3 lore raw

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

In reply to Eric Auger

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.

---

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(-)
hw/arm/virt.c +6 -1
index 46bf7ceddf..39790d29d2 100644
@@ -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");
Signature · 1 line
2.26.3
Reviewed-by on v1 2/2
#4 lore raw

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

Quoted 37 lines · Eric Auger

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.

---

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(-)
hw/arm/virt.c +6 -1
index 46bf7ceddf..39790d29d2 100644
@@ -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");
Signature · 1 line
2.26.3
#5 lore raw

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

In reply to Eric Auger
Quoted 21 lines · Eric Auger

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.

---

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(-)
hw/arm/virt.c +0 -0
index 46bf7ceddf..39790d29d2 100644

hw/arm/virt.c static void finalize_gic_version(VirtMachineState *vms) · line 1855

Quoted 5 lines
hw/arm/virt.c +1 -1
@@ -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?

Quoted 8 lines
hw/arm/virt.c +5 -0
+            /* 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");
#6 lore raw
In reply to Eric Auger
Quoted 4 lines · Eric Auger

When CONFIG_ARM_GIC_TCG is unset, qtests fail with ERROR:../qom/object.c:715:object_new_with_type: assertion failed: (type != NULL)

Quoted 8 lines

This is due to the fact a bunch tests use gic-version=max which currectly unconditionally selects GICv3, ignoring the fact this latter may have been disabled.

This series renames CONFIG_ARM_GIC_TCG into CONFIG_ARM_GICv3_TCG. Also it selects GICv2 if gic-version=max and CONFIG_ARM_GICV3_TCG is unset, in TCG mode. With those fixes qtests pass along with virt machine node.

The use of module_object_class_by_name() looks much neater than the ifdefs.

Applied to target-arm.next, thanks.

-- PMM