Skip to content

Commit

Permalink
boardctl: add board control api to start slave core
Browse files Browse the repository at this point in the history
This interface may be used by application specific logic to start
specified slave cpu core under the pseudo AMP case which is different
with armv7-a/armv8-a SMP. Support for this function is required by
board-level logic if CONFIG_BOARDCTL_START_CPU is selected.

Signed-off-by: wanggang26 <[email protected]>
  • Loading branch information
wanggang26 authored and xiaoxiang781216 committed Sep 16, 2024
1 parent d259138 commit 872208f
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
8 changes: 8 additions & 0 deletions boards/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4828,6 +4828,14 @@ config BOARDCTL_IRQ_AFFINITY
---help---
Enables support for Set an IRQ affinity to CPUs by software.

config BOARDCTL_START_CPU
bool "Start slave cpu"
default n
---help---
Enables support for the BOARDIOC_START_CPU boardctl() command.
Architecture specific logic must provide the board_start_cpu()
interface.

config BOARDCTL_IOCTL
bool "Board-specific boardctl() commands"
default n
Expand Down
16 changes: 16 additions & 0 deletions boards/boardctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,22 @@ int boardctl(unsigned int cmd, uintptr_t arg)
break;
#endif

#ifdef CONFIG_BOARDCTL_START_CPU
/* CMD: BOARDIOC_START_CPU
* DESCRIPTION: Start specified slave core by master core
* ARG: Integer value for cpu core id.
* CONFIGURATION: CONFIG_BOARDCTL_START_CPU
* DEPENDENCIES: Board logic must provide the
* board_start_cpu() interface.
*/

case BOARDIOC_START_CPU:
{
ret = board_start_cpu((int)arg);
}
break;
#endif

default:
{
#ifdef CONFIG_BOARDCTL_IOCTL
Expand Down
15 changes: 15 additions & 0 deletions include/nuttx/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,21 @@ void board_init_rngseed(void);
int board_reset_cause(FAR struct boardioc_reset_cause_s *cause);
#endif

/****************************************************************************
* Name: board_start_cpu
*
* Description:
* This interface may be used by application specific logic to start
* specified slave cpu core under the pseudo AMP case which is different
* with armv7-a/armv8-a SMP. Support for this function is required by
* board-level logic if CONFIG_BOARDCTL_START_CPU is selected.
*
****************************************************************************/

#ifdef CONFIG_BOARDCTL_START_CPU
int board_start_cpu(int cpuid);
#endif

#undef EXTERN
#ifdef __cplusplus
}
Expand Down
3 changes: 2 additions & 1 deletion include/sys/boardctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
#define BOARDIOC_BOOT_IMAGE _BOARDIOC(0x0014)
#define BOARDIOC_RESET_CAUSE _BOARDIOC(0x0015)
#define BOARDIOC_IRQ_AFFINITY _BOARDIOC(0x0016)
#define BOARDIOC_START_CPU _BOARDIOC(0x0017)

/* If CONFIG_BOARDCTL_IOCTL=y, then board-specific commands will be support.
* In this case, all commands not recognized by boardctl() will be forwarded
Expand All @@ -221,7 +222,7 @@
* User defined board commands may begin with this value:
*/

#define BOARDIOC_USER _BOARDIOC(0x0017)
#define BOARDIOC_USER _BOARDIOC(0x0018)

/****************************************************************************
* Public Type Definitions
Expand Down

0 comments on commit 872208f

Please sign in to comment.