vms->gic_version = VIRT_GIC_VERSION_3;
}
} else {
- vms->gic_version = kvm_arm_vgic_probe();
- if (!vms->gic_version) {
+ int probe_bitmap = kvm_arm_vgic_probe();
+
+ if (!probe_bitmap) {
error_report(
"Unable to determine GIC version supported by host");
exit(1);
+ } else {
+ if (probe_bitmap & KVM_ARM_VGIC_V3) {
+ vms->gic_version = VIRT_GIC_VERSION_3;
+ } else {
+ vms->gic_version = VIRT_GIC_VERSION_2;
+ }
}
}
} else if (vms->gic_version == VIRT_GIC_VERSION_NOSEL) {
int kvm_arm_vgic_probe(void)
{
+ int val = 0;
+
if (kvm_create_device(kvm_state,
KVM_DEV_TYPE_ARM_VGIC_V3, true) == 0) {
- return 3;
- } else if (kvm_create_device(kvm_state,
- KVM_DEV_TYPE_ARM_VGIC_V2, true) == 0) {
- return 2;
- } else {
- return 0;
+ val |= KVM_ARM_VGIC_V3;
+ }
+ if (kvm_create_device(kvm_state,
+ KVM_DEV_TYPE_ARM_VGIC_V2, true) == 0) {
+ val |= KVM_ARM_VGIC_V2;
}
+ return val;
}
int kvm_arm_set_irq(int cpu, int irqtype, int irq, int level)