[PATCH 11/15] ARM: KVM: timer: always get the virtual interrupt number from DT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Instead of hardcoding the interrupt number, use the DT provided
value. This doesn't improve our isolation between host and guest
CPU model, but as we don't have any, we actually end up with nicer
code.

Signed-off-by: Marc Zyngier <marc.zyngier@xxxxxxx>
---
 arch/arm/kvm/reset.c | 10 ----------
 arch/arm/kvm/timer.c |  6 ++++++
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/arch/arm/kvm/reset.c b/arch/arm/kvm/reset.c
index 7463f5b..94a5b60 100644
--- a/arch/arm/kvm/reset.c
+++ b/arch/arm/kvm/reset.c
@@ -37,13 +37,6 @@ static struct kvm_regs a15_regs_reset = {
 	.usr_regs.ARM_cpsr = SVC_MODE | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT,
 };
 
-#ifdef CONFIG_KVM_ARM_TIMER
-static const struct kvm_irq_level a15_virt_timer_ppi = {
-	{ .irq = 27 },	/* irq: A7/A15 specific */
-	.level = 1	/* level */
-};
-#endif
-
 /*******************************************************************************
  * Exported reset function
  */
@@ -65,9 +58,6 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu)
 			return -EINVAL;
 		cpu_reset = &a15_regs_reset;
 		vcpu->arch.midr = read_cpuid_id();
-#ifdef CONFIG_KVM_ARM_TIMER
-		vcpu->arch.timer_cpu.irq = &a15_virt_timer_ppi;
-#endif
 		break;
 	default:
 		return -ENODEV;
diff --git a/arch/arm/kvm/timer.c b/arch/arm/kvm/timer.c
index a241298..8924595 100644
--- a/arch/arm/kvm/timer.c
+++ b/arch/arm/kvm/timer.c
@@ -28,6 +28,9 @@
 
 static struct timecounter *timecounter;
 static struct workqueue_struct *wqueue;
+static struct kvm_irq_level timer_irq = {
+	.level	= 1,
+};
 
 static cycle_t kvm_phys_timer_read(void)
 {
@@ -128,6 +131,7 @@ void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu)
 	INIT_WORK(&timer->expired, kvm_timer_inject_irq_work);
 	hrtimer_init(&timer->timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
 	timer->timer.function = kvm_timer_expire;
+	timer->irq = &timer_irq;
 }
 
 static void kvm_timer_init_interrupt(void *info)
@@ -173,6 +177,8 @@ int kvm_timer_hyp_init(void)
 		return err;
 	}
 
+	timer_irq.irq = ppi;
+
 	wqueue = create_singlethread_workqueue("kvm_arch_timer");
 	if (!wqueue) {
 		free_percpu_irq(ppi, kvm_get_running_vcpus());
-- 
1.8.0.1



_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/cucslists/listinfo/kvmarm


[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux