Skip to contentSkip to conversation

cobalt/timer: create and register TIMER_OOB_IPI handler

PATCH New hongzha1 1 participant 1 message Oct 29, 2020

lore
Share & tools
lore

hongzha1

author
#0 lore raw

PATCH v3 3/7 cobalt/timer: create and register TIMER_OOB_IPI handler

1.create and register TIMER_OOB_IPI handler.
2.declare global xn_machine_cpudata so that it can be shared with other irq request.

---
 include/cobalt/kernel/sched.h |  6 ++++++
 kernel/cobalt/init.c          |  2 ++
 kernel/cobalt/sched.c         |  5 -----
 kernel/cobalt/timer.c         | 20 +++++++++++++-------
 4 files changed, 21 insertions(+), 12 deletions(-)
include/cobalt/kernel/sched.h +6 -0
index 1f5714fe0..d4f449e4a 100644
@@ -31,6 +31,12 @@
 #include <cobalt/kernel/assert.h>
 #include <asm/xenomai/machine.h>
 
+
+struct xn_machine_cpudata {
+};
+
+DECLARE_PER_CPU(struct xn_machine_cpudata, xn_machine_cpudata);
+
 /**
  * @addtogroup cobalt_core_sched
  * @{
kernel/cobalt/init.c +2 -0
index 9b1651528..563832738 100644
@@ -37,6 +37,8 @@
 #include "posix/internal.h"
 #include "procfs.h"
 
+DEFINE_PER_CPU(struct xn_machine_cpudata, xn_machine_cpudata);
+EXPORT_PER_CPU_SYMBOL_GPL(xn_machine_cpudata);
 
 static DEFINE_PER_CPU(int, cobalt_escalate_devid);
 /**
kernel/cobalt/sched.c +0 -5
index 4ecbcc3fc..2e57f795e 100644
@@ -30,11 +30,6 @@
 #define CREATE_TRACE_POINTS
 #include <trace/events/cobalt-core.h>
 
-struct xn_machine_cpudata {
-};
-
-DEFINE_PER_CPU(struct xn_machine_cpudata, xn_machine_cpudata);
-
 static void xnsched_destroy(struct xnsched *sched);
 
 /**
kernel/cobalt/timer.c +13 -7
index bcfe832d1..9da2c6143 100644
@@ -576,19 +576,25 @@ void __xntimer_set_affinity(struct xntimer *timer, struct xnsched *sched)
 }
 EXPORT_SYMBOL_GPL(__xntimer_set_affinity);
 
+static irqreturn_t clock_ipi_handler(int irq, void *dev_id)
+{
+	xnintr_core_clock_handler();
+
+	return IRQ_HANDLED;
+}
+
 int xntimer_setup_ipi(void)
 {
-#warning TODO
-/*	return ipipe_request_irq(&xnsched_realtime_domain,
-				 IPIPE_HRTIMER_IPI,
-				 (ipipe_irq_handler_t)xnintr_core_clock_handler,
-				 NULL, NULL);*/
+	return __request_percpu_irq(TIMER_OOB_IPI,
+			clock_ipi_handler,
+			IRQF_OOB, "Xenomai timer IPI",
+			&xn_machine_cpudata);
 }
 
 void xntimer_release_ipi(void)
 {
-#warning TODO
-	//ipipe_free_irq(&xnsched_realtime_domain, IPIPE_HRTIMER_IPI);
+	free_percpu_irq(TIMER_OOB_IPI,
+			&xn_machine_cpudata);
 }
 
 #endif /* CONFIG_SMP */
Signature · 1 line
2.17.1