hw/intc/arm_gicv5: Implement gicv5_class_name()
Implement a gicv5_class_name() function that does the same job as gicv3_class_name(): allows board code to get the correct QOM type for the GIC at runtime depending on whether KVM is enabled or not. For the GICv5, we don't yet implement KVM support, so the KVM-enabled codepath is always an error. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-id: 20260327111700.795099-13-peter.maydell@linaro.org
Peter Maydell committed
Mar 27, 2026 at 11:16 UTC
44d0584aaf6bc82c3ac8815fb71333e9b346b955
1 file changed
+20
include/hw/intc/arm_gicv5_common.h
+20
@@ -13,6 +13,8 @@
13
#include "hw/core/sysbus.h"
14
#include "hw/intc/arm_gicv5_types.h"
15
#include "target/arm/cpu-qom.h"
16
+#include "qemu/error-report.h"
17
+#include "system/kvm.h"
18
19
/*
20
* QEMU interface:
@@ -150,4 +152,22 @@ static inline bool gicv5_domain_implemented(GICv5Common *cs, GICv5Domain domain)
152
return cs->implemented_domains & (1 << domain);
153
}
154
155
+/**
156
+ * gicv5_class_name
157
+ *
158
+ * Return name of GICv5 class to use depending on whether KVM acceleration is
159
+ * in use. May throw an error if the chosen implementation is not available.
160
+ *
161
+ * Returns: class name to use
162
+ */
163
+static inline const char *gicv5_class_name(void)
164
+{
165
+ /* When we implement KVM GICv5 we might return "kvm-arm-gicv5" here. */
166
+ if (kvm_enabled()) {
167
+ error_report("Userspace GICv5 is not supported with KVM");
168
+ exit(1);
169
+ }
170
+ return "arm-gicv5";
171
+}
172
+
173
#endif