File tree Expand file tree Collapse file tree 8 files changed +49
-0
lines changed Expand file tree Collapse file tree 8 files changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -36,5 +36,10 @@ static ALWAYS_INLINE uint32_t arch_proc_id(void)
3636 return arch_curr_cpu ()-> id ;
3737}
3838
39+ static ALWAYS_INLINE unsigned int arch_num_cpus (void )
40+ {
41+ return CONFIG_MP_MAX_NUM_CPUS ;
42+ }
43+
3944#endif /* !_ASMLANGUAGE */
4045#endif /* ZEPHYR_INCLUDE_ARCH_XTENSA_ARCH_INLINES_H_ */
Original file line number Diff line number Diff line change @@ -26,4 +26,9 @@ static ALWAYS_INLINE uint32_t arch_proc_id(void)
2626 return arch_curr_cpu ()-> id ;
2727}
2828
29+ static ALWAYS_INLINE unsigned int arch_num_cpus (void )
30+ {
31+ return CONFIG_MP_MAX_NUM_CPUS ;
32+ }
33+
2934#endif /* ZEPHYR_INCLUDE_ARCH_ARM_AARCH32_ARCH_INLINES_H */
Original file line number Diff line number Diff line change @@ -33,5 +33,10 @@ static ALWAYS_INLINE uint32_t arch_proc_id(void)
3333 return (uint32_t )cpu_mpid ;
3434}
3535
36+ static ALWAYS_INLINE unsigned int arch_num_cpus (void )
37+ {
38+ return CONFIG_MP_MAX_NUM_CPUS ;
39+ }
40+
3641#endif /* !_ASMLANGUAGE */
3742#endif /* ZEPHYR_INCLUDE_ARCH_ARM64_ARCH_INLINES_H */
Original file line number Diff line number Diff line change @@ -30,5 +30,10 @@ static ALWAYS_INLINE _cpu_t *arch_curr_cpu(void)
3030 return & _kernel .cpus [arch_proc_id ()];
3131}
3232
33+ static ALWAYS_INLINE unsigned int arch_num_cpus (void )
34+ {
35+ return CONFIG_MP_MAX_NUM_CPUS ;
36+ }
37+
3338#endif /* !_ASMLANGUAGE */
3439#endif /* ZEPHYR_INCLUDE_ARCH_RISCV_ARCH_INLINES_H_ */
Original file line number Diff line number Diff line change @@ -35,6 +35,11 @@ static ALWAYS_INLINE uint32_t arch_proc_id(void)
3535 return arch_curr_cpu ()-> id ;
3636}
3737
38+ static ALWAYS_INLINE unsigned int arch_num_cpus (void )
39+ {
40+ return CONFIG_MP_MAX_NUM_CPUS ;
41+ }
42+
3843#endif /* CONFIG_X86_64 */
3944
4045#endif /* !_ASMLANGUAGE */
Original file line number Diff line number Diff line change @@ -50,6 +50,11 @@ static ALWAYS_INLINE uint32_t arch_proc_id(void)
5050 return prid ;
5151}
5252
53+ static ALWAYS_INLINE unsigned int arch_num_cpus (void )
54+ {
55+ return CONFIG_MP_MAX_NUM_CPUS ;
56+ }
57+
5358#endif /* !_ASMLANGUAGE */
5459
5560#endif /* ZEPHYR_INCLUDE_ARCH_XTENSA_ARCH_INLINES_H_ */
Original file line number Diff line number Diff line change @@ -459,6 +459,17 @@ static inline uint32_t arch_proc_id(void);
459459 * This will invoke z_sched_ipi() on other CPUs in the system.
460460 */
461461void arch_sched_ipi (void );
462+
463+ /**
464+ * @brief Returns the number of CPUs
465+ *
466+ * For most systems this will be the same as CONFIG_MP_MAX_NUM_CPUS,
467+ * however some systems may determine this at runtime instead.
468+ *
469+ * @return the number of CPUs
470+ */
471+ static inline unsigned int arch_num_cpus (void );
472+
462473#endif /* CONFIG_SMP */
463474
464475/** @} */
Original file line number Diff line number Diff line change @@ -879,6 +879,14 @@ config MP_NUM_CPUS
879879 Number of multiprocessing-capable cores available to the
880880 multicpu API and SMP features.
881881
882+ config MP_MAX_NUM_CPUS
883+ int "Maximum number of CPUs/cores"
884+ default MP_NUM_CPUS
885+ range 1 4
886+ help
887+ Maximum number of multiprocessing-capable cores available to the
888+ multicpu API and SMP features.
889+
882890config SCHED_IPI_SUPPORTED
883891 bool
884892 help
You can’t perform that action at this time.
0 commit comments