aboutsummaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorVladimir Murzin <vladimir.murzin@arm.com>2016-09-12 10:49:15 -0400
committerChristoffer Dall <christoffer.dall@linaro.org>2016-09-22 07:21:35 -0400
commit5a7a8426b2ac004b064e4106911769e0a55e7c4b (patch)
tree376e94ddd6cc275844d4dc99f034054711425e59 /virt
parent5d947a1447f98eede0778f6f59a8fe03f0c53caf (diff)
arm64: KVM: Use static keys for selecting the GIC backend
Currently GIC backend is selected via alternative framework and this is fine. We are going to introduce vgic-v3 to 32-bit world and there we don't have patching framework in hand, so we can either check support for GICv3 every time we need to choose which backend to use or try to optimise it by using static keys. The later looks quite promising because we can share logic involved in selecting GIC backend between architectures if both uses static keys. This patch moves arm64 from alternative to static keys framework for selecting GIC backend. For that we embed static key into vgic_global and enable the key during vgic initialisation based on what has already been exposed by the host GIC driver. Acked-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/arm/vgic/vgic-init.c4
-rw-r--r--virt/kvm/arm/vgic/vgic.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/virt/kvm/arm/vgic/vgic-init.c b/virt/kvm/arm/vgic/vgic-init.c
index 83777c1cbae0..8cebfbc19e90 100644
--- a/virt/kvm/arm/vgic/vgic-init.c
+++ b/virt/kvm/arm/vgic/vgic-init.c
@@ -405,6 +405,10 @@ int kvm_vgic_hyp_init(void)
405 break; 405 break;
406 case GIC_V3: 406 case GIC_V3:
407 ret = vgic_v3_probe(gic_kvm_info); 407 ret = vgic_v3_probe(gic_kvm_info);
408 if (!ret) {
409 static_branch_enable(&kvm_vgic_global_state.gicv3_cpuif);
410 kvm_info("GIC system register CPU interface enabled\n");
411 }
408 break; 412 break;
409 default: 413 default:
410 ret = -ENODEV; 414 ret = -ENODEV;
diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c
index e83b7fe4baae..8a529a732941 100644
--- a/virt/kvm/arm/vgic/vgic.c
+++ b/virt/kvm/arm/vgic/vgic.c
@@ -29,7 +29,7 @@
29#define DEBUG_SPINLOCK_BUG_ON(p) 29#define DEBUG_SPINLOCK_BUG_ON(p)
30#endif 30#endif
31 31
32struct vgic_global __section(.hyp.text) kvm_vgic_global_state; 32struct vgic_global __section(.hyp.text) kvm_vgic_global_state = {.gicv3_cpuif = STATIC_KEY_FALSE_INIT,};
33 33
34/* 34/*
35 * Locking order is always: 35 * Locking order is always: