You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2024/03/30 04:21:31 UTC
(nuttx) branch master updated: board/control: add irq affinity control
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new f732428331 board/control: add irq affinity control
f732428331 is described below
commit f732428331817b679d51c222901aa78314e7cfd5
Author: chao an <an...@lixiang.com>
AuthorDate: Thu Mar 28 18:27:31 2024 +0800
board/control: add irq affinity control
add support for set an IRQ affinity to CPUs by software
Signed-off-by: chao an <an...@lixiang.com>
---
boards/Kconfig | 7 +++++++
boards/boardctl.c | 20 ++++++++++++++++++++
include/sys/boardctl.h | 3 ++-
3 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/boards/Kconfig b/boards/Kconfig
index 2470998350..57d0076507 100644
--- a/boards/Kconfig
+++ b/boards/Kconfig
@@ -4703,6 +4703,13 @@ config BOARDCTL_TESTSET
Enables support for the BOARDIOC_SPINLOCK boardctl() command.
Architecture specific logic must provide up_testset() interface.
+config BOARDCTL_IRQ_AFFINITY
+ bool "Set an IRQ affinity to CPUs by software"
+ default n
+ depends on SMP
+ ---help---
+ Enables support for Set an IRQ affinity to CPUs by software.
+
config BOARDCTL_IOCTL
bool "Board-specific boardctl() commands"
default n
diff --git a/boards/boardctl.c b/boards/boardctl.c
index 2707bb161c..c6cae7ba41 100644
--- a/boards/boardctl.c
+++ b/boards/boardctl.c
@@ -30,6 +30,7 @@
#include <errno.h>
#include <assert.h>
+#include <nuttx/arch.h>
#include <nuttx/board.h>
#include <nuttx/lib/modlib.h>
#include <nuttx/binfmt/symtab.h>
@@ -835,6 +836,25 @@ int boardctl(unsigned int cmd, uintptr_t arg)
break;
#endif
+#ifdef CONFIG_BOARDCTL_IRQ_AFFINITY
+ /* CMD: BOARDIOC_IRQ_AFFINITY
+ * DESCRIPTION: Set an IRQ affinity by software.
+ * ARG: Integer array:
+ member 0 is the interrupt number
+ member 1 is the CPU index
+ * CONFIGURATION: CONFIG_BOARDCTL_IRQ_AFFINITY
+ * DEPENDENCIES: Bound Multi-Processing (CONFIG_BMP)
+ */
+
+ case BOARDIOC_IRQ_AFFINITY:
+ {
+ FAR unsigned int *affinity = (FAR unsigned int *)arg;
+ up_affinity_irq(affinity[0], affinity[1]);
+ ret = OK;
+ }
+ break;
+#endif
+
default:
{
#ifdef CONFIG_BOARDCTL_IOCTL
diff --git a/include/sys/boardctl.h b/include/sys/boardctl.h
index 9e70770091..25ac632a05 100644
--- a/include/sys/boardctl.h
+++ b/include/sys/boardctl.h
@@ -209,6 +209,7 @@
#define BOARDIOC_SWITCH_BOOT _BOARDIOC(0x0013)
#define BOARDIOC_BOOT_IMAGE _BOARDIOC(0x0014)
#define BOARDIOC_RESET_CAUSE _BOARDIOC(0x0015)
+#define BOARDIOC_IRQ_AFFINITY _BOARDIOC(0x0016)
/* If CONFIG_BOARDCTL_IOCTL=y, then board-specific commands will be support.
* In this case, all commands not recognized by boardctl() will be forwarded
@@ -217,7 +218,7 @@
* User defined board commands may begin with this value:
*/
-#define BOARDIOC_USER _BOARDIOC(0x0016)
+#define BOARDIOC_USER _BOARDIOC(0x0017)
/****************************************************************************
* Public Type Definitions