Skip to contentSkip to conversation

fix __ipipe_tick_irq tracking across APIC reprogramming

PATCH In review Jan Kiszka 2 participants 2 messages Dec 26, 2007

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 fix __ipipe_tick_irq tracking across APIC reprogramming

As LOCAL_TIMER_VECTOR != RTHAL_APIC_TIMER_VECTOR (Philippe, what was the motivation for this?), we need to update __ipipe_tick_irq when we reprogram the APIC. Otherwise, I-pipe will not be able to capture and forward the related IRQ registers.

At this chance, refactor some references to Xenomai's own APIC timer IRQ.

Merry Christmas and all the best for 2008 to everyone!

Jan

ksrc/arch/x86/hal-common.c +7 -3
Index: xenomai/ksrc/arch/x86/hal-common.c
===================================================================
@@ -54,7 +54,7 @@
 	case RTHAL_SET_ONESHOT_LINUX:
 		rthal_setup_oneshot_apic(LOCAL_TIMER_VECTOR);
 		/* We need to keep the timing cycle alive for the kernel. */
-		rthal_trigger_irq(ipipe_apic_vector_irq(LOCAL_TIMER_VECTOR));
+		rthal_trigger_irq(RTHAL_HOST_TICK_IRQ);
 		break;
 
 	case RTHAL_SET_PERIODIC:
@@ -71,11 +71,14 @@
 	if (rt_mode) {
 		rthal_sync_op = RTHAL_SET_ONESHOT_XENOMAI;
 		rthal_setup_oneshot_apic(RTHAL_APIC_TIMER_VECTOR);
+		if (rthal_ktimer_saved_mode != KTIMER_MODE_UNUSED)
+			__ipipe_tick_irq = RTHAL_TIMER_IRQ;
 	} else {
 		rthal_sync_op = RTHAL_SET_ONESHOT_LINUX;
 		rthal_setup_oneshot_apic(LOCAL_TIMER_VECTOR);
+		__ipipe_tick_irq = RTHAL_HOST_TICK_IRQ;
 		/* We need to keep the timing cycle alive for the kernel. */
-		rthal_trigger_irq(ipipe_apic_vector_irq(LOCAL_TIMER_VECTOR));
+		rthal_trigger_irq(RTHAL_HOST_TICK_IRQ);
 	}
 	rthal_critical_exit(flags);
 }
@@ -87,6 +90,7 @@
 	flags = rthal_critical_enter(&rthal_critical_sync);
 	rthal_sync_op = RTHAL_SET_PERIODIC;
 	rthal_setup_periodic_apic(RTHAL_APIC_ICOUNT, LOCAL_TIMER_VECTOR);
+	__ipipe_tick_irq = RTHAL_HOST_TICK_IRQ;
 	rthal_critical_exit(flags);
 }
 
@@ -112,7 +116,7 @@
 #ifdef CONFIG_SMP
 	send_IPI_all(LOCAL_TIMER_VECTOR);
 #else
-	rthal_trigger_irq(ipipe_apic_vector_irq(LOCAL_TIMER_VECTOR));
+	rthal_trigger_irq(RTHAL_HOST_TICK_IRQ);
 #endif
 	return IRQ_HANDLED;
 }
#1 lore raw
Quoted 2 lines · Jan Kiszka

As LOCAL_TIMER_VECTOR != RTHAL_APIC_TIMER_VECTOR (Philippe, what was the motivation for this?),

In some cases, it's much saner to have two separate timer hw interrupt sources, so that we may trigger a timer tick targeted at the Linux kernel only from whatever domain, while grabbing the real-time timer interrupt within the Xenomai domain, without getting any "boomerang" effect. This is why we grab IPI3 and propagate to the local timer vector.

we need to update __ipipe_tick_irq when we

Quoted 7 lines

reprogram the APIC. Otherwise, I-pipe will not be able to capture and forward the related IRQ registers.

At this chance, refactor some references to Xenomai's own APIC timer IRQ.

Merry Christmas and all the best for 2008 to everyone!

Thanks, best wishes for 2008 too.

Quoted 2 lines

Jan

Signature · 1 line
Philippe.