linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/2] AX45MP: Add support to non-coherent DMA
@ 2022-09-06 10:21 Lad Prabhakar
  2022-09-06 10:21 ` [RFC PATCH 1/2] riscv: vendors: andes: Add support to configure the PMA regions Lad Prabhakar
                   ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Lad Prabhakar @ 2022-09-06 10:21 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou
  Cc: Atish Patra, Anup Patel, Geert Uytterhoeven, Conor Dooley,
	linux-riscv, linux-renesas-soc, linux-kernel, Prabhakar,
	Biju Das, Lad Prabhakar

Hi All,

On the Andes AX45MP core, cache coherency is a specification option so it
may not be supported. In this case DMA will fail. To get around with this
issue this patch series  does the below:

Andes AX45MP core has a Programmable Physical Memory Attributes (PMA)
block that allows dynamic adjustment of memory attributes in the runtime.
It contains a configurable amount of PMA entries implemented as CSR
registers to control the attributes of memory locations in interest. PMA
regions are passed from the cpu core node which are configured as
non-cacheable and non-bufferable with the SBI call.

        ax45mp: cpu@0 {
                compatible = "andestech,ax45mp", "riscv";
                device_type = "cpu";
                ....
                pma-regions = <0x0 0x00000000 0x0 0x14000000>,
                              <0x0 0x20000000 0x0 0x10000000>,
                              <0x0 0x58000000 0x0 0x08000000>;
                ....
        };

We provide callbacks to synchronize specific content between memory and
cache. We allocate a global DMA coherent pool (which is marked as
non-cached using PMA) so that DMA memory allocations happens from this
pool and we implement the below callbacks:

- arch_sync_dma_for_device()
- arch_sync_dma_for_cpu()
- arch_dma_alloc()
- arch_dma_free()

Below are the configs that are enabled:

- DMA_GLOBAL_POOL
- ARCH_HAS_SYNC_DMA_FOR_CPU
- ARCH_HAS_SYNC_DMA_FOR_DEVICE

        l2cache: cache-controller@13400000 {
                compatible = "andestech,ax45mp-cache", "cache";
                cache-size = <0x40000>;
                cache-line-size = <64>;
                cache-sets = <1024>;
                cache-unified;
                reg = <0x0 0x13400000 0x0 0x100000>;
	};

Due to the above approach custom SBI calls have been implemented. The
above implementation is in preparation for adding support for Renesas
RZ/Five SoC which uses the AX45MP core. As with the above approach the
kernel image might not be generic so that it can be used on other
platforms, so sending it as an RFC (without DT binding patches).

OpenSBI implementation isn't upstreamed yet, public repo for access is
available at [0].

[0] https://github.com/renesas-rz/rz_opensbi/tree/work/OpenSBI-PMA

Cheers,
Prabhakar

Lad Prabhakar (2):
  riscv: vendors: andes: Add support to configure the PMA regions
  riscv: vendors: andes: Add support for non-cohernet dma

 arch/riscv/Kbuild                             |   2 +
 arch/riscv/include/asm/sbi.h                  |   1 +
 arch/riscv/vendors/Makefile                   |   3 +
 arch/riscv/vendors/andes/Makefile             |   4 +
 arch/riscv/vendors/andes/ax45mp.c             |  93 ++++++
 arch/riscv/vendors/andes/ax45mp_cache.c       | 296 ++++++++++++++++++
 arch/riscv/vendors/andes/ax45mp_nocache_dma.c |  65 ++++
 arch/riscv/vendors/andes/include/proc.h       |   9 +
 arch/riscv/vendors/andes/include/sbi.h        |  27 ++
 9 files changed, 500 insertions(+)
 create mode 100644 arch/riscv/vendors/Makefile
 create mode 100644 arch/riscv/vendors/andes/Makefile
 create mode 100644 arch/riscv/vendors/andes/ax45mp.c
 create mode 100644 arch/riscv/vendors/andes/ax45mp_cache.c
 create mode 100644 arch/riscv/vendors/andes/ax45mp_nocache_dma.c
 create mode 100644 arch/riscv/vendors/andes/include/proc.h
 create mode 100644 arch/riscv/vendors/andes/include/sbi.h

-- 
2.25.1


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2022-09-22 15:00 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-06 10:21 [RFC PATCH 0/2] AX45MP: Add support to non-coherent DMA Lad Prabhakar
2022-09-06 10:21 ` [RFC PATCH 1/2] riscv: vendors: andes: Add support to configure the PMA regions Lad Prabhakar
2022-09-06 10:39   ` Conor.Dooley
2022-09-06 11:23     ` Lad, Prabhakar
2022-09-07  8:18     ` Chris Paterson
2022-09-22 15:00       ` Chris Paterson
     [not found]     ` <CAOnJCUKLpRz4Fbx1XiMnap-ELw2k1c8E9V8bZiSP+x7z9Z5QrA@mail.gmail.com>
2022-09-07 23:37       ` Conor.Dooley
2022-09-08  8:39         ` Biju Das
2022-09-08 11:50           ` Lad, Prabhakar
2022-09-08 11:59             ` Conor.Dooley
2022-09-08 12:13               ` Lad, Prabhakar
2022-09-08 12:43           ` Conor.Dooley
2022-09-08 13:01             ` Biju Das
2022-09-08 13:20               ` Geert Uytterhoeven
2022-09-08 13:54                 ` Biju Das
2022-09-08 14:04               ` Conor.Dooley
2022-09-08 14:39                 ` Lad, Prabhakar
2022-09-06 10:21 ` [RFC PATCH 2/2] riscv: vendors: andes: Add support for non-cohernet dma Lad Prabhakar
2022-09-08 21:44 ` [RFC PATCH 0/2] AX45MP: Add support to non-coherent DMA Conor.Dooley
2022-09-09 10:21   ` Lad, Prabhakar
2022-09-09 23:06   ` Atish Patra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).