Re: [PATCH v2] MIPS: c-r4k: Flush the cache error vector before writing it uncached

From: Maciej W. Rozycki

Date: Mon Oct 26 2026 - 16:00:21 EST


On Mon, 26 Oct 2026, Imre Kaloz wrote:

> diff --git a/arch/mips/include/asm/cacheflush.h b/arch/mips/include/asm/cacheflush.h
> index 5099c1b65a58..753dc3d7b190 100644
> --- a/arch/mips/include/asm/cacheflush.h
> +++ b/arch/mips/include/asm/cacheflush.h
> @@ -120,6 +120,7 @@ extern void copy_from_user_page(struct vm_area_struct *vma,
>
> extern void (*flush_icache_all)(void);
> extern void (*flush_data_cache_page)(unsigned long addr);
> +extern void (*cache_wback_inv)(unsigned long start, unsigned long size);

Hmm, I'd be tempted to call the hook flush_dcache_size() or suchlike for
consistency with our existing nomenclature where "flush" stands for WB+INV
and to signify that this function doesn't touch I$ (the *_range() suffix
is already taken for interfaces using start/end rather than start/size for
the boundaries), although our naming seems messy overall.

Any other suggestions, anyone?

> diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
> index d8aadd3dc057..11bb82263b63 100644
> --- a/arch/mips/mm/c-r4k.c
> +++ b/arch/mips/mm/c-r4k.c
> @@ -743,9 +743,7 @@ static void r4k_flush_icache_user_range(unsigned long start,
> unsigned long end)
> return __r4k_flush_icache_range(start, end, true);
> }
>
> -#ifdef CONFIG_DMA_NONCOHERENT
> -
> -static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size)
> +static void r4k_cache_wback_inv(unsigned long addr, unsigned long size)

Likewise accordingly.

> @@ -1743,14 +1743,15 @@ void r4k_cache_init(void)
>
> flush_icache_all = r4k_flush_icache_all;
> flush_data_cache_page = r4k_flush_data_cache_page;
> + cache_wback_inv = r4k_cache_wback_inv;

Please update arch/mips/mm/c-r3k.c accordingly.

Maciej