From d45efe47824a3d143fdc8d5990032deff4cec72b Mon Sep 17 00:00:00 2001 From: Eric Auger Date: Wed, 11 Mar 2020 14:16:16 +0100 Subject: target/arm/kvm: Let kvm_arm_vgic_probe() return a bitmap Convert kvm_arm_vgic_probe() so that it returns a bitmap of supported in-kernel emulation VGIC versions instead of the max version: at the moment values can be v2 and v3. This allows to expose the case where the host GICv3 also supports GICv2 emulation. This will be useful to choose the default version in KVM accelerated mode. Signed-off-by: Eric Auger Reviewed-by: Andrew Jones Reviewed-by: Richard Henderson Message-id: 20200311131618.7187-5-eric.auger@redhat.com Signed-off-by: Peter Maydell --- hw/arm/virt.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'hw/arm/virt.c') diff --git a/hw/arm/virt.c b/hw/arm/virt.c index e55cafa014..a94bc5ddae 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1554,11 +1554,18 @@ static void finalize_gic_version(VirtMachineState *vms) 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) { -- cgit 1.4.1