RISC-V: Add mechanism to provide custom IPI operations
We add mechanism to set custom IPI operations so that CLINT driver from drivers directory can provide custom IPI operations. Signed-off-by: Anup Patel <anup.patel@wdc.com> Tested-by: Emil Renner Berhing <kernel@esmil.dk> Reviewed-by: Atish Patra <atish.patra@wdc.com> Reviewed-by: Palmer Dabbelt <palmerdabbelt@google.com> Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
This commit is contained in:
committed by
Palmer Dabbelt
parent
9123e3a74e
commit
cc7f3f72dc
@@ -6,34 +6,9 @@
|
||||
#include <linux/smp.h>
|
||||
|
||||
#ifdef CONFIG_RISCV_M_MODE
|
||||
extern u32 __iomem *clint_ipi_base;
|
||||
|
||||
void clint_init_boot_cpu(void);
|
||||
|
||||
static inline void clint_send_ipi_single(unsigned long hartid)
|
||||
{
|
||||
writel(1, clint_ipi_base + hartid);
|
||||
}
|
||||
|
||||
static inline void clint_send_ipi_mask(const struct cpumask *mask)
|
||||
{
|
||||
int cpu;
|
||||
|
||||
for_each_cpu(cpu, mask)
|
||||
clint_send_ipi_single(cpuid_to_hartid_map(cpu));
|
||||
}
|
||||
|
||||
static inline void clint_clear_ipi(unsigned long hartid)
|
||||
{
|
||||
writel(0, clint_ipi_base + hartid);
|
||||
}
|
||||
#else /* CONFIG_RISCV_M_MODE */
|
||||
#define clint_init_boot_cpu() do { } while (0)
|
||||
|
||||
/* stubs to for code is only reachable under IS_ENABLED(CONFIG_RISCV_M_MODE): */
|
||||
void clint_send_ipi_single(unsigned long hartid);
|
||||
void clint_send_ipi_mask(const struct cpumask *hartid_mask);
|
||||
void clint_clear_ipi(unsigned long hartid);
|
||||
#endif /* CONFIG_RISCV_M_MODE */
|
||||
|
||||
#endif /* _ASM_RISCV_CLINT_H */
|
||||
|
||||
@@ -15,6 +15,11 @@
|
||||
struct seq_file;
|
||||
extern unsigned long boot_cpu_hartid;
|
||||
|
||||
struct riscv_ipi_ops {
|
||||
void (*ipi_inject)(const struct cpumask *target);
|
||||
void (*ipi_clear)(void);
|
||||
};
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
/*
|
||||
* Mapping between linux logical cpu index and hartid.
|
||||
@@ -40,6 +45,12 @@ void arch_send_call_function_single_ipi(int cpu);
|
||||
int riscv_hartid_to_cpuid(int hartid);
|
||||
void riscv_cpuid_to_hartid_mask(const struct cpumask *in, struct cpumask *out);
|
||||
|
||||
/* Set custom IPI operations */
|
||||
void riscv_set_ipi_ops(struct riscv_ipi_ops *ops);
|
||||
|
||||
/* Clear IPI for current CPU */
|
||||
void riscv_clear_ipi(void);
|
||||
|
||||
/* Secondary hart entry */
|
||||
asmlinkage void smp_callin(void);
|
||||
|
||||
@@ -81,6 +92,14 @@ static inline void riscv_cpuid_to_hartid_mask(const struct cpumask *in,
|
||||
cpumask_set_cpu(boot_cpu_hartid, out);
|
||||
}
|
||||
|
||||
static inline void riscv_set_ipi_ops(struct riscv_ipi_ops *ops)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void riscv_clear_ipi(void)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SMP */
|
||||
|
||||
#if defined(CONFIG_HOTPLUG_CPU) && (CONFIG_SMP)
|
||||
|
||||
Reference in New Issue
Block a user