[PATCH v9 3/6] riscv: mm: dma-noncoherent: nonstandard cache operations support

Arnd Bergmann arnd at arndb.de
Wed Jun 14 05:35:44 PDT 2023


On Wed, Jun 14, 2023, at 12:47, Prabhakar wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj at bp.renesas.com>
>
> Introduce support for nonstandard noncoherent systems in the RISC-V
> architecture. It enables function pointer support to handle cache
> management in such systems.
>
> This patch adds a new configuration option called
> "RISCV_NONSTANDARD_CACHE_OPS." This option is a boolean flag that
> depends on "RISCV_DMA_NONCOHERENT" and enables the function pointer
> support for cache management in nonstandard noncoherent systems.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj at bp.renesas.com>

I understand that Christoph will still not like this, but I think this
is as good as it gets, making the standard variant the fast path,
and using the function pointers only for the nonstandard cases.


>  #include <asm/cacheflush.h>
> +#include <asm/dma-noncoherent.h>
> 
>  static bool noncoherent_supported;
> 
> +struct riscv_cache_ops noncoherent_cache_ops = {
> +	.clean = NULL,
> +	.inval = NULL,
> +	.flush = NULL,
> +};

This could be marked __read_mostly or __ro_after_init as
a micro-optimization, if anyone cares.

      Arnd



More information about the linux-riscv mailing list