[rtems commit] Add interrupt server set affinity

Sebastian Huber sebh at rtems.org
Wed Jul 12 06:02:24 UTC 2017


Module:    rtems
Branch:    master
Commit:    d1841406b3b16c35c84563557c4ed08db9d3a72f
Changeset: http://git.rtems.org/rtems/commit/?id=d1841406b3b16c35c84563557c4ed08db9d3a72f

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Jul 11 09:08:15 2017 +0200

Add interrupt server set affinity

Update #3071.

---

 c/src/lib/libbsp/shared/src/irq-server.c | 33 +++++++++++++++++++++++++++++
 cpukit/include/rtems/irq-extension.h     | 36 ++++++++++++++++++++++++++++++++
 2 files changed, 69 insertions(+)

diff --git a/c/src/lib/libbsp/shared/src/irq-server.c b/c/src/lib/libbsp/shared/src/irq-server.c
index 542276c..61d3175 100644
--- a/c/src/lib/libbsp/shared/src/irq-server.c
+++ b/c/src/lib/libbsp/shared/src/irq-server.c
@@ -750,3 +750,36 @@ rtems_status_code rtems_interrupt_server_resume(uint32_t server_index)
   );
   return RTEMS_SUCCESSFUL;
 }
+
+rtems_status_code rtems_interrupt_server_set_affinity(
+  uint32_t            server_index,
+  size_t              affinity_size,
+  const cpu_set_t    *affinity,
+  rtems_task_priority priority
+)
+{
+  rtems_status_code sc;
+  bsp_interrupt_server_context *s;
+  rtems_id scheduler;
+
+  s = bsp_interrupt_server_get_context(server_index, &sc);
+  if (s == NULL) {
+    return sc;
+  }
+
+  sc = rtems_scheduler_ident_by_processor_set(
+    affinity_size,
+    affinity,
+    &scheduler
+  );
+  if (sc != RTEMS_SUCCESSFUL) {
+    return sc;
+  }
+
+  sc = rtems_task_set_scheduler(s->server, scheduler, priority);
+  if (sc != RTEMS_SUCCESSFUL) {
+    return sc;
+  }
+
+  return rtems_task_set_affinity(s->server, affinity_size, affinity);
+}
diff --git a/cpukit/include/rtems/irq-extension.h b/cpukit/include/rtems/irq-extension.h
index 4b49a1a..9cade11 100644
--- a/cpukit/include/rtems/irq-extension.h
+++ b/cpukit/include/rtems/irq-extension.h
@@ -401,6 +401,42 @@ rtems_status_code rtems_interrupt_server_suspend( uint32_t server_index );
 rtems_status_code rtems_interrupt_server_resume( uint32_t server_index );
 
 /**
+ * @brief Sets the processor affinity of the specified interrupt server.
+ *
+ * The scheduler is set determined by the highest numbered processor in the
+ * specified affinity set.
+ *
+ * This operation is only reliable in case the specified interrupt was
+ * suspended via rtems_interrupt_server_suspend().
+ *
+ * @param[in] server_index The interrupt server index.  Use
+ *   @c RTEMS_INTERRUPT_SERVER_DEFAULT to specify the default server.
+ * @param[in] affinity_size The storage size of the affinity set.
+ * @param[in] affinity The desired processor affinity set for the specified
+ *   interrupt server.
+ * @param[in] priority The task priority with respect to the corresponding
+ *   scheduler instance.
+ *
+ * @retval RTEMS_SUCCESSFUL Successful operation
+ * @retval RTEMS_INCORRECT_STATE The interrupt servers are not initialized.
+ * @retval RTEMS_INVALID_ID If the interrupt server index is invalid.
+ * @retval RTEMS_INVALID_SIZE Invalid affinity set size.
+ * @retval RTEMS_INVALID_NAME The affinity set contains no online processor.
+ * @retval RTEMS_INCORRECT_STATE The highest numbered online processor in the
+ *   specified affinity set is not owned by a scheduler.
+ * @retval RTEMS_INVALID_PRIORITY Invalid priority.
+ * @retval RTEMS_RESOURCE_IN_USE The interrupt server owns resources which deny
+ *   a scheduler change.
+ * @retval RTEMS_INVALID_NUMBER Invalid processor affinity set.
+ */
+rtems_status_code rtems_interrupt_server_set_affinity(
+  uint32_t            server_index,
+  size_t              affinity_size,
+  const cpu_set_t    *affinity,
+  rtems_task_priority priority
+);
+
+/**
  * @brief Initializes the specified interrupt server entry.
  *
  * @param[in] server_index The interrupt server index.  Use




More information about the vc mailing list