Commit 300f62c3 authored by Jisheng Zhang's avatar Jisheng Zhang Committed by Palmer Dabbelt

riscv: Constify sbi_ipi_ops

Constify the sbi_ipi_ops so that it will be placed in the .rodata
section. This will cause attempts to modify it to fail when strict
page permissions are in place.
Signed-off-by: default avatarJisheng Zhang <jszhang@kernel.org>
Signed-off-by: default avatarPalmer Dabbelt <palmerdabbelt@google.com>
parent e6a30224
...@@ -46,7 +46,7 @@ int riscv_hartid_to_cpuid(int hartid); ...@@ -46,7 +46,7 @@ int riscv_hartid_to_cpuid(int hartid);
void riscv_cpuid_to_hartid_mask(const struct cpumask *in, struct cpumask *out); void riscv_cpuid_to_hartid_mask(const struct cpumask *in, struct cpumask *out);
/* Set custom IPI operations */ /* Set custom IPI operations */
void riscv_set_ipi_ops(struct riscv_ipi_ops *ops); void riscv_set_ipi_ops(const struct riscv_ipi_ops *ops);
/* Clear IPI for current CPU */ /* Clear IPI for current CPU */
void riscv_clear_ipi(void); void riscv_clear_ipi(void);
...@@ -92,7 +92,7 @@ static inline void riscv_cpuid_to_hartid_mask(const struct cpumask *in, ...@@ -92,7 +92,7 @@ static inline void riscv_cpuid_to_hartid_mask(const struct cpumask *in,
cpumask_set_cpu(boot_cpu_hartid, out); cpumask_set_cpu(boot_cpu_hartid, out);
} }
static inline void riscv_set_ipi_ops(struct riscv_ipi_ops *ops) static inline void riscv_set_ipi_ops(const struct riscv_ipi_ops *ops)
{ {
} }
......
...@@ -571,7 +571,7 @@ static void sbi_send_cpumask_ipi(const struct cpumask *target) ...@@ -571,7 +571,7 @@ static void sbi_send_cpumask_ipi(const struct cpumask *target)
sbi_send_ipi(cpumask_bits(&hartid_mask)); sbi_send_ipi(cpumask_bits(&hartid_mask));
} }
static struct riscv_ipi_ops sbi_ipi_ops = { static const struct riscv_ipi_ops sbi_ipi_ops = {
.ipi_inject = sbi_send_cpumask_ipi .ipi_inject = sbi_send_cpumask_ipi
}; };
......
...@@ -87,9 +87,9 @@ static void ipi_stop(void) ...@@ -87,9 +87,9 @@ static void ipi_stop(void)
wait_for_interrupt(); wait_for_interrupt();
} }
static struct riscv_ipi_ops *ipi_ops __ro_after_init; static const struct riscv_ipi_ops *ipi_ops __ro_after_init;
void riscv_set_ipi_ops(struct riscv_ipi_ops *ops) void riscv_set_ipi_ops(const struct riscv_ipi_ops *ops)
{ {
ipi_ops = ops; ipi_ops = ops;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment