diff options
author | Eric Auger <eric.auger@redhat.com> | 2020-03-11 14:16:16 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2020-03-12 16:27:33 +0000 |
commit | d45efe47824a3d143fdc8d5990032deff4cec72b (patch) | |
tree | b542fe228b90cce25a4d0d978fbdd27d4543bd11 /target | |
parent | 36bf4ec8c8bb943f5be99172cb0506e1b520096e (diff) |
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 <eric.auger@redhat.com>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200311131618.7187-5-eric.auger@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'target')
-rw-r--r-- | target/arm/kvm.c | 14 | ||||
-rw-r--r-- | target/arm/kvm_arm.h | 3 |
2 files changed, 11 insertions, 6 deletions
diff --git a/target/arm/kvm.c b/target/arm/kvm.c index 85860e6f95..390077c518 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -874,15 +874,17 @@ int kvm_arch_irqchip_create(KVMState *s) 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) diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h index ae9e075d75..48bf5e16d5 100644 --- a/target/arm/kvm_arm.h +++ b/target/arm/kvm_arm.h @@ -15,6 +15,9 @@ #include "exec/memory.h" #include "qemu/error-report.h" +#define KVM_ARM_VGIC_V2 (1 << 0) +#define KVM_ARM_VGIC_V3 (1 << 1) + /** * kvm_arm_vcpu_init: * @cs: CPUState |