-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
arch: riscv: Add support for custom SOC IPI, per-core init #65824
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,8 +10,10 @@ | |
#include <ipi.h> | ||
#include <zephyr/irq.h> | ||
#include <zephyr/sys/atomic.h> | ||
#include <zephyr/arch/arch_interface.h> | ||
#include <zephyr/arch/riscv/irq.h> | ||
#include <zephyr/drivers/pm_cpu_ops.h> | ||
#include <zephyr/platform/hooks.h> | ||
|
||
volatile struct { | ||
arch_cpustart_t fn; | ||
|
@@ -74,12 +76,17 @@ void arch_secondary_cpu_init(int hartid) | |
#endif | ||
#ifdef CONFIG_SMP | ||
irq_enable(RISCV_IRQ_MSOFT); | ||
#endif | ||
#ifdef CONFIG_SOC_SMP_PER_CORE_INIT_HOOK | ||
soc_smp_per_core_init_hook(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should run this for the main core, probably by adding an invocation of this in I also think that it would be nice to generalize this new hook as |
||
#endif | ||
riscv_cpu_init[cpu_num].fn(riscv_cpu_init[cpu_num].arg); | ||
} | ||
|
||
#ifdef CONFIG_SMP | ||
|
||
#ifndef CONFIG_RISCV_SOC_HAS_CUSTOM_SMP_IPI | ||
|
||
#define MSIP_BASE 0x2000000UL | ||
#define MSIP(hartid) ((volatile uint32_t *)MSIP_BASE)[hartid] | ||
|
||
|
@@ -104,11 +111,6 @@ void arch_sched_directed_ipi(uint32_t cpu_bitmap) | |
arch_irq_unlock(key); | ||
} | ||
|
||
void arch_sched_broadcast_ipi(void) | ||
{ | ||
arch_sched_directed_ipi(IPI_ALL_CPUS_MASK); | ||
} | ||
|
||
#ifdef CONFIG_FPU_SHARING | ||
void arch_flush_fpu_ipi(unsigned int cpu) | ||
{ | ||
|
@@ -172,4 +174,11 @@ int arch_smp_init(void) | |
|
||
return 0; | ||
} | ||
|
||
#endif /* CONFIG_RISCV_SOC_HAS_CUSTOM_SMP_IPI */ | ||
|
||
void arch_sched_broadcast_ipi(void) | ||
{ | ||
arch_sched_directed_ipi(IPI_ALL_CPUS_MASK); | ||
} | ||
#endif /* CONFIG_SMP */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current implementation is using CLINT, I wonder if we should name this
RISCV_SOC_SMP_IPI_CLINT
instead to pave the way for the intro ofRISCV_SOC_SMP_IPI_PLIC
in the future, so that it is a choice between CLINT & PLIC, instead of default vs custom?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would make sense if we upstream our implementation as the default PLIC implementation, otherwise it would be unclear as to what the behavior would be if RISCV_SOC_SMP_IPI_CLINT was not set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be fine as this is an arch-level Kconfig, would like to hear from @fkokosinski @npitre and others as well