diff mbox series

[v3,2/2] hw/arm/virt: Make accels in GIC finalize logic explicit

Message ID 20221223090107.98888-3-agraf@csgraf.de (mailing list archive)
State New, archived
Headers show
Series hw/arm/virt: Handle HVF in finalize_gic_version() | expand

Commit Message

Alexander Graf Dec. 23, 2022, 9:01 a.m. UTC
Let's explicitly list out all accelerators that we support when trying to
determine the supported set of GIC versions. KVM was already separate, so
the only missing one is HVF which simply reuses all of TCG's emulation
code and thus has the same compatibility matrix.

Signed-off-by: Alexander Graf <agraf@csgraf.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>

---

v1 -> v2:

  - Include TCG header for tcg_enabled()
---
 hw/arm/virt.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Zenghui Yu Jan. 11, 2023, 1:35 p.m. UTC | #1
Hi Alexander,

On 2022/12/23 17:01, Alexander Graf wrote:
> Let's explicitly list out all accelerators that we support when trying to
> determine the supported set of GIC versions. KVM was already separate, so
> the only missing one is HVF which simply reuses all of TCG's emulation
> code and thus has the same compatibility matrix.
> 
> Signed-off-by: Alexander Graf <agraf@csgraf.de>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Reviewed-by: Cornelia Huck <cohuck@redhat.com>


> @@ -1938,6 +1939,9 @@ static void finalize_gic_version(VirtMachineState *vms)
>                  gics_supported |= VIRT_GIC_VERSION_4_MASK;
>              }
>          }
> +    } else {
> +        error_report("Unsupported accelerator, can not determine GIC support");
> +        exit(1);

Looks like qtest will use arguments like '-accel qtest' and a 'make
check-qtest' triggers this error_report() on my box. It'd be good if you
can have a look (as I really don't have much knowledge about qtest..).

Thanks,
Zenghui
Philippe Mathieu-Daudé Jan. 17, 2023, 7:34 a.m. UTC | #2
On 11/1/23 14:35, Zenghui Yu wrote:
> Hi Alexander,
> 
> On 2022/12/23 17:01, Alexander Graf wrote:
>> Let's explicitly list out all accelerators that we support when trying to
>> determine the supported set of GIC versions. KVM was already separate, so
>> the only missing one is HVF which simply reuses all of TCG's emulation
>> code and thus has the same compatibility matrix.
>>
>> Signed-off-by: Alexander Graf <agraf@csgraf.de>
>> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> Reviewed-by: Cornelia Huck <cohuck@redhat.com>
> 
> 
>> @@ -1938,6 +1939,9 @@ static void 
>> finalize_gic_version(VirtMachineState *vms)
>>                  gics_supported |= VIRT_GIC_VERSION_4_MASK;
>>              }
>>          }
>> +    } else {
>> +        error_report("Unsupported accelerator, can not determine GIC 
>> support");
>> +        exit(1);
> 
> Looks like qtest will use arguments like '-accel qtest' and a 'make
> check-qtest' triggers this error_report() on my box. It'd be good if you
> can have a look (as I really don't have much knowledge about qtest..).

Indeed, I had to squash:

-- >8 --
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 611f40c1da..b17e3dafa8 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -50,6 +50,7 @@
  #include "sysemu/tcg.h"
  #include "sysemu/kvm.h"
  #include "sysemu/hvf.h"
+#include "sysemu/qtest.h"
  #include "hw/loader.h"
  #include "qapi/error.h"
  #include "qemu/bitops.h"
@@ -1930,7 +1931,7 @@ static void finalize_gic_version(VirtMachineState 
*vms)
          /* KVM w/o kernel irqchip can only deal with GICv2 */
          gics_supported |= VIRT_GIC_VERSION_2_MASK;
          accel_name = "KVM with kernel-irqchip=off";
-    } else if (tcg_enabled() || hvf_enabled())  {
+    } else if (tcg_enabled() || hvf_enabled() || qtest_enabled())  {
          gics_supported |= VIRT_GIC_VERSION_2_MASK;
          if (module_object_class_by_name("arm-gicv3")) {
              gics_supported |= VIRT_GIC_VERSION_3_MASK;
---

Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff mbox series

Patch

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 6d27f044fe..611f40c1da 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -47,6 +47,7 @@ 
 #include "sysemu/numa.h"
 #include "sysemu/runstate.h"
 #include "sysemu/tpm.h"
+#include "sysemu/tcg.h"
 #include "sysemu/kvm.h"
 #include "sysemu/hvf.h"
 #include "hw/loader.h"
@@ -1929,7 +1930,7 @@  static void finalize_gic_version(VirtMachineState *vms)
         /* KVM w/o kernel irqchip can only deal with GICv2 */
         gics_supported |= VIRT_GIC_VERSION_2_MASK;
         accel_name = "KVM with kernel-irqchip=off";
-    } else {
+    } else if (tcg_enabled() || hvf_enabled())  {
         gics_supported |= VIRT_GIC_VERSION_2_MASK;
         if (module_object_class_by_name("arm-gicv3")) {
             gics_supported |= VIRT_GIC_VERSION_3_MASK;
@@ -1938,6 +1939,9 @@  static void finalize_gic_version(VirtMachineState *vms)
                 gics_supported |= VIRT_GIC_VERSION_4_MASK;
             }
         }
+    } else {
+        error_report("Unsupported accelerator, can not determine GIC support");
+        exit(1);
     }
 
     /*