]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ARM: KVM: arch_timers: Wire the init code and config option
authorMarc Zyngier <marc.zyngier@arm.com>
Wed, 23 Jan 2013 18:21:59 +0000 (13:21 -0500)
committerMarc Zyngier <marc.zyngier@arm.com>
Mon, 11 Feb 2013 19:06:00 +0000 (19:06 +0000)
It is now possible to select CONFIG_KVM_ARM_TIMER to enable the
KVM architected timer support.

Reviewed-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Christoffer Dall <c.dall@virtualopensystems.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
arch/arm/kvm/Kconfig
arch/arm/kvm/Makefile
arch/arm/kvm/arm.c
arch/arm/kvm/vgic.c

index d8126f2b9442e909a45ead05e5eb3094e71ca3ae..49dd64e579c2da533b1cd43235aef3a9d286b909 100644 (file)
@@ -59,6 +59,14 @@ config KVM_ARM_VGIC
        ---help---
          Adds support for a hardware assisted, in-kernel GIC emulation.
 
+config KVM_ARM_TIMER
+       bool "KVM support for Architected Timers"
+       depends on KVM_ARM_VGIC && ARM_ARCH_TIMER
+       select HAVE_KVM_IRQCHIP
+       default y
+       ---help---
+         Adds support for the Architected Timers in virtual machines
+
 source drivers/virtio/Kconfig
 
 endif # VIRTUALIZATION
index dece8edc2e4abbc4b979603016e97ed00660cf00..fc96ce6f2357c683497f80344349449c74e3b077 100644 (file)
@@ -20,3 +20,4 @@ obj-y += kvm-arm.o init.o interrupts.o
 obj-y += arm.o guest.o mmu.o emulate.o reset.o
 obj-y += coproc.o coproc_a15.o mmio.o psci.o
 obj-$(CONFIG_KVM_ARM_VGIC) += vgic.o
+obj-$(CONFIG_KVM_ARM_TIMER) += arch_timer.o
index 800b2cd804d3603d2dc5034e7e4d4db59e417653..9ada5549216dc1f5a8e49b3fe34453b043e55026 100644 (file)
@@ -289,6 +289,7 @@ int kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)
 void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu)
 {
        kvm_mmu_free_memory_caches(vcpu);
+       kvm_timer_vcpu_terminate(vcpu);
        kmem_cache_free(kvm_vcpu_cache, vcpu);
 }
 
@@ -330,6 +331,9 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
        if (ret)
                return ret;
 
+       /* Set up the timer */
+       kvm_timer_vcpu_init(vcpu);
+
        return 0;
 }
 
@@ -1103,6 +1107,13 @@ static int init_hyp_mode(void)
                vgic_present = true;
 #endif
 
+       /*
+        * Init HYP architected timer support
+        */
+       err = kvm_timer_hyp_init();
+       if (err)
+               goto out_free_mappings;
+
        kvm_info("Hyp mode initialized successfully\n");
        return 0;
 out_free_vfp:
index 6d8407672dec3a74077c1fb3f683dc9404bb1f57..c9a17316e9fe75f2a8dec4fe3893816d3d0730c9 100644 (file)
@@ -1418,6 +1418,7 @@ int kvm_vgic_init(struct kvm *kvm)
        for (i = VGIC_NR_PRIVATE_IRQS; i < VGIC_NR_IRQS; i += 4)
                vgic_set_target_reg(kvm, 0, i);
 
+       kvm_timer_init(kvm);
        kvm->arch.vgic.ready = true;
 out:
        mutex_unlock(&kvm->lock);