diff mbox

[RFC,3/4] ARM: arch_timers: give the virtual timer its own interrupt handler

Message ID 1341566422-20368-4-git-send-email-marc.zyngier@arm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Marc Zyngier July 6, 2012, 9:20 a.m. UTC
In order to prepare for the timer interrupt offloading to the hypervisor,
give the virtual timer its own interrupt handler.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 arch/arm/kernel/arch_timer.c |    8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Christopher Covington July 17, 2012, 4:57 p.m. UTC | #1
Hi Marc,

On 07/06/2012 05:20 AM, Marc Zyngier wrote:
> In order to prepare for the timer interrupt offloading to the hypervisor,
> give the virtual timer its own interrupt handler.
> 
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> ---
>  arch/arm/kernel/arch_timer.c |    8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/arch/arm/kernel/arch_timer.c b/arch/arm/kernel/arch_timer.c
> index 2b5da66..4473f66 100644
> --- a/arch/arm/kernel/arch_timer.c
> +++ b/arch/arm/kernel/arch_timer.c

[...]

> @@ -408,6 +413,9 @@ static int __init arch_timer_register(void)
>  		if (!arch_timer_ppi[i])
>  			continue;
>  
> +		if (i == VIRT_PPI)
> +			handler = arch_timer_virt_handler;
> +

Again, it seems awkward to do this sort of thing inside the loop as
you're only keying off of one value with a known index in the array.

>  		err = request_percpu_irq(arch_timer_ppi[i], handler,
>  					 "arch_timer", arch_timer_evt);
>  		if (err) {

Regards,
Christopher
diff mbox

Patch

diff --git a/arch/arm/kernel/arch_timer.c b/arch/arm/kernel/arch_timer.c
index 2b5da66..4473f66 100644
--- a/arch/arm/kernel/arch_timer.c
+++ b/arch/arm/kernel/arch_timer.c
@@ -202,6 +202,11 @@  static irqreturn_t arch_timer_handler(int irq, void *dev_id)
 	return IRQ_NONE;
 }
 
+static irqreturn_t arch_timer_virt_handler(int irq, void *dev_id)
+{
+	return arch_timer_handler(irq, dev_id);
+}
+
 static void arch_timer_disable(void)
 {
 	unsigned long ctrl;
@@ -408,6 +413,9 @@  static int __init arch_timer_register(void)
 		if (!arch_timer_ppi[i])
 			continue;
 
+		if (i == VIRT_PPI)
+			handler = arch_timer_virt_handler;
+
 		err = request_percpu_irq(arch_timer_ppi[i], handler,
 					 "arch_timer", arch_timer_evt);
 		if (err) {