diff mbox series

[06/12] MIPS: c-octeon: Provide alternative SMP cache flush function

Message ID 20230304221524.47160-7-jiaxun.yang@flygoat.com (mailing list archive)
State Superseded
Headers show
Series MIPS Virt board support | expand

Commit Message

Jiaxun Yang March 4, 2023, 10:15 p.m. UTC
Curretly c-octeon relies on octeon's own smp function to flush
I-Cache. However this function is not available on generic platform.

Just use smp_call_function_many on generic platform.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 arch/mips/mm/c-octeon.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Sergey Shtylyov March 5, 2023, 8:41 a.m. UTC | #1
Hello!

On 3/5/23 1:15 AM, Jiaxun Yang wrote:

> Curretly c-octeon relies on octeon's own smp function to flush

   Currently.

> I-Cache. However this function is not available on generic platform.
> 
> Just use smp_call_function_many on generic platform.
> 
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
>  arch/mips/mm/c-octeon.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/mips/mm/c-octeon.c b/arch/mips/mm/c-octeon.c
> index c7ed589de882..61db09e5044c 100644
> --- a/arch/mips/mm/c-octeon.c
> +++ b/arch/mips/mm/c-octeon.c
> @@ -83,8 +83,14 @@ static void octeon_flush_icache_all_cores(struct vm_area_struct *vma)
>  	else
>  		mask = *cpu_online_mask;
>  	cpumask_clear_cpu(cpu, &mask);
> -	for_each_cpu(cpu, &mask)
> +#ifdef CONFIG_CAVIUM_OCTEON_SOC
> +	for_each_cpu(cpu, &mask) {
>  		octeon_send_ipi_single(cpu, SMP_ICACHE_FLUSH);
> +	}

   I think {} aren't needed here.

> +#else
> +	smp_call_function_many(&mask, (smp_call_func_t)octeon_local_flush_icache,
> +			       NULL, 1);
> +#endif
>  
>  	preempt_enable();
>  #endif

MBR, Sergey
diff mbox series

Patch

diff --git a/arch/mips/mm/c-octeon.c b/arch/mips/mm/c-octeon.c
index c7ed589de882..61db09e5044c 100644
--- a/arch/mips/mm/c-octeon.c
+++ b/arch/mips/mm/c-octeon.c
@@ -83,8 +83,14 @@  static void octeon_flush_icache_all_cores(struct vm_area_struct *vma)
 	else
 		mask = *cpu_online_mask;
 	cpumask_clear_cpu(cpu, &mask);
-	for_each_cpu(cpu, &mask)
+#ifdef CONFIG_CAVIUM_OCTEON_SOC
+	for_each_cpu(cpu, &mask) {
 		octeon_send_ipi_single(cpu, SMP_ICACHE_FLUSH);
+	}
+#else
+	smp_call_function_many(&mask, (smp_call_func_t)octeon_local_flush_icache,
+			       NULL, 1);
+#endif
 
 	preempt_enable();
 #endif