return cap;
}
-static inline void gic_cap_kvm_probe(GICCapability *v2, GICCapability *v3)
-{
-#ifdef CONFIG_KVM
- int fdarray[3];
-
- if (!kvm_arm_create_scratch_host_vcpu(fdarray, NULL)) {
- return;
- }
-
- /* Test KVM GICv2 */
- if (kvm_device_supported(fdarray[1], KVM_DEV_TYPE_ARM_VGIC_V2)) {
- v2->kernel = true;
- }
-
- /* Test KVM GICv3 */
- if (kvm_device_supported(fdarray[1], KVM_DEV_TYPE_ARM_VGIC_V3)) {
- v3->kernel = true;
- }
-
- kvm_arm_destroy_scratch_host_vcpu(fdarray);
-#endif
-}
-
GICCapabilityList *qmp_query_gic_capabilities(Error **errp)
{
GICCapabilityList *head = NULL;
v2->emulated = true;
v3->emulated = true;
- gic_cap_kvm_probe(v2, v3);
+ if (kvm_enabled()) {
+ arm_gic_cap_kvm_probe(v2, v3);
+ }
QAPI_LIST_PREPEND(head, v2);
QAPI_LIST_PREPEND(head, v3);
{
g_assert_not_reached();
}
+
+void arm_gic_cap_kvm_probe(GICCapability *v2, GICCapability *v3)
+{
+ g_assert_not_reached();
+}
}
kvm_arm_set_irq(cs->cpu_index, KVM_ARM_IRQ_TYPE_CPU, irq_id, !!level);
}
+
+void arm_gic_cap_kvm_probe(GICCapability *v2, GICCapability *v3)
+{
+ int fdarray[3];
+
+ if (!kvm_arm_create_scratch_host_vcpu(fdarray, NULL)) {
+ return;
+ }
+
+ /* Test KVM GICv2 */
+ if (kvm_device_supported(fdarray[1], KVM_DEV_TYPE_ARM_VGIC_V2)) {
+ v2->kernel = true;
+ }
+
+ /* Test KVM GICv3 */
+ if (kvm_device_supported(fdarray[1], KVM_DEV_TYPE_ARM_VGIC_V3)) {
+ v3->kernel = true;
+ }
+
+ kvm_arm_destroy_scratch_host_vcpu(fdarray);
+}
#ifndef QEMU_KVM_ARM_H
#define QEMU_KVM_ARM_H
+#include "qapi/qapi-types-misc-arm.h"
#include "system/kvm.h"
#include "target/arm/cpu-qom.h"
void arm_cpu_kvm_set_irq(void *arm_cpu, int irq, int level);
+void arm_gic_cap_kvm_probe(GICCapability *v2, GICCapability *v3);
+
#endif
'mmuidx.c',
))
-arm_system_ss.add(files(
+arm_common_system_ss.add(files(
'arm-qmp-cmds.c',
))
arm_system_ss.add(when: 'CONFIG_KVM', if_true: files('hyp_gdbstub.c', 'kvm.c'))