aboutsummaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorAndre Przywara <andre.przywara@arm.com>2014-10-26 19:17:00 -0400
committerChristoffer Dall <christoffer.dall@linaro.org>2015-01-20 12:25:27 -0500
commitea2f83a7de9d0abbd145e37177905aab57fdb835 (patch)
tree4220e1e4b48490923d9d6fd5f1ac1e2d289bb26c /virt
parentb26e5fdac43c1b7c394502917e42e3b91f3aa1a3 (diff)
arm/arm64: KVM: move kvm_register_device_ops() into vGIC probing
Currently we unconditionally register the GICv2 emulation device during the host's KVM initialization. Since with GICv3 support we may end up with only v2 or only v3 or both supported, we move the registration into the GIC probing function, where we will later know which combination is valid. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Acked-by: Christoffer Dall <christoffer.dall@linaro.org> Acked-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/arm/vgic-v2.c2
-rw-r--r--virt/kvm/arm/vgic-v3.c1
-rw-r--r--virt/kvm/arm/vgic.c5
3 files changed, 5 insertions, 3 deletions
diff --git a/virt/kvm/arm/vgic-v2.c b/virt/kvm/arm/vgic-v2.c
index 2935405ad22f..e1cd3cb95903 100644
--- a/virt/kvm/arm/vgic-v2.c
+++ b/virt/kvm/arm/vgic-v2.c
@@ -229,6 +229,8 @@ int vgic_v2_probe(struct device_node *vgic_node,
229 goto out_unmap; 229 goto out_unmap;
230 } 230 }
231 231
232 kvm_register_device_ops(&kvm_arm_vgic_v2_ops, KVM_DEV_TYPE_ARM_VGIC_V2);
233
232 vgic->vcpu_base = vcpu_res.start; 234 vgic->vcpu_base = vcpu_res.start;
233 235
234 kvm_info("%s@%llx IRQ%d\n", vgic_node->name, 236 kvm_info("%s@%llx IRQ%d\n", vgic_node->name,
diff --git a/virt/kvm/arm/vgic-v3.c b/virt/kvm/arm/vgic-v3.c
index 1c2c8eef0599..d14c75f4a33b 100644
--- a/virt/kvm/arm/vgic-v3.c
+++ b/virt/kvm/arm/vgic-v3.c
@@ -230,6 +230,7 @@ int vgic_v3_probe(struct device_node *vgic_node,
230 ret = -ENXIO; 230 ret = -ENXIO;
231 goto out; 231 goto out;
232 } 232 }
233 kvm_register_device_ops(&kvm_arm_vgic_v2_ops, KVM_DEV_TYPE_ARM_VGIC_V2);
233 234
234 vgic->vcpu_base = vcpu_res.start; 235 vgic->vcpu_base = vcpu_res.start;
235 vgic->vctrl_base = NULL; 236 vgic->vctrl_base = NULL;
diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c
index 9b63141a599d..69f6e7aa573e 100644
--- a/virt/kvm/arm/vgic.c
+++ b/virt/kvm/arm/vgic.c
@@ -2564,7 +2564,7 @@ static int vgic_create(struct kvm_device *dev, u32 type)
2564 return kvm_vgic_create(dev->kvm, type); 2564 return kvm_vgic_create(dev->kvm, type);
2565} 2565}
2566 2566
2567static struct kvm_device_ops kvm_arm_vgic_v2_ops = { 2567struct kvm_device_ops kvm_arm_vgic_v2_ops = {
2568 .name = "kvm-arm-vgic", 2568 .name = "kvm-arm-vgic",
2569 .create = vgic_create, 2569 .create = vgic_create,
2570 .destroy = vgic_destroy, 2570 .destroy = vgic_destroy,
@@ -2643,8 +2643,7 @@ int kvm_vgic_hyp_init(void)
2643 2643
2644 on_each_cpu(vgic_init_maintenance_interrupt, NULL, 1); 2644 on_each_cpu(vgic_init_maintenance_interrupt, NULL, 1);
2645 2645
2646 return kvm_register_device_ops(&kvm_arm_vgic_v2_ops, 2646 return 0;
2647 KVM_DEV_TYPE_ARM_VGIC_V2);
2648 2647
2649out_free_irq: 2648out_free_irq:
2650 free_percpu_irq(vgic->maint_irq, kvm_get_running_vcpus()); 2649 free_percpu_irq(vgic->maint_irq, kvm_get_running_vcpus());