Add support for Renesas RZ/Five RISC-V SoC
Subsystems (6)
cover Add support for Renesas RZ/Five RISC-V SoC
Hi All,
The RZ/Five microprocessor includes a RISC-V CPU Core (AX45MP Single) 1.0 GHz, 16-bit DDR3L/DDR4 interface. And it also has many interfaces such as Gbit-Ether, CAN, and USB 2.0, making it ideal for applications such as entry-class social infrastructure gateway control and industrial gateway control.
This patch series adds initial SoC DTSi support for Renesas RZ/Five (R9A07G043) SoC and updates the bindings for the same. Below is the list of IP blocks which will be supported by this series:
- ADC
- AX45MP CPU
- CANFD
- CPG
- DMAC
- Ethernet
- I2C
- OSTM
- PINCTRL
- PLIC
- RSPI
- SCIF
- SDHI/eMMC
- SSIF
- SYSC
- Thermal
- USB Host/Device
- WDT
Apart from first two patches all the patches have been cherry picked from upstream kernel.
Sending this series as an RFC mainly beacuse, as the kernel image is not generic to all RISC-V platforms as the HW is noncoherent.
Complete defconfig file for RZ/Five can be found at [0].
[0] https://gitlab.com/prabhakarlad/cip-kernel-config/-/raw/rzfive/6.1.y-cip/riscv/renesas_defconfig
Cheers,
Prabhakar
Arnd Bergmann (2):
riscv: dma-mapping: only invalidate after DMA, not flush
riscv: dma-mapping: skip invalidation before bidirectional DMA
Conor Dooley (1):
riscv: dts: renesas: Clean up dtbs_check W=1 warning due to empty phy
node
Jisheng Zhang (1):
riscv: mm: mark noncoherent_supported as __ro_after_init
Lad Prabhakar (25):
arm64: dts: renesas: rzg2ul-smarc: Drop including RZ/G2UL SoM DTSI
arm64: dts: renesas: rzg2ul: Move PMOD_SCI0_EN macro to board DTS
mmc: host: Kconfig: Make MMC_SDHI_INTERNAL_DMAC config option
dependant on ARCH_RENESAS
clocksource/drivers/riscv: Get rid of clocksource_arch_init() callback
riscv: Kconfig: Enable cpufreq kconfig menu
dt-bindings: riscv: Sort the CPU core list alphabetically
dt-bindings: riscv: Add Andes AX45MP core to the list
riscv: dma-mapping: switch over to generic implementation
riscv: asm: vendorid_list: Add Andes Technology to the vendors list
riscv: errata: Add Andes alternative ports
riscv: mm: dma-noncoherent: nonstandard cache operations support
dt-bindings: cache: andestech,ax45mp-cache: Add DT binding
documentation for L2 cache controller
cache: Add L2 cache management for Andes AX45MP RISC-V core
soc: renesas: Kconfig: Select the required configs for RZ/Five SoC
riscv: Kconfig.socs: Add ARCH_RENESAS kconfig option
riscv: dts: renesas: Add initial devicetree for Renesas RZ/Five SoC
riscv: dts: renesas: Add minimal DTS for Renesas RZ/Five SMARC EVK
riscv: dts: renesas: r9a07g043f/rzfive-smarc-som: Enable
ADC/OPP/Thermal Zones/TSU
riscv: dts: renesas: rzfive-smarc: Enable CANFD/I2C
riscv: dts: renesas: rzfive-smarc-som: Enable WDT
riscv: dts: renesas: rzfive-smarc-som: Enable OSTM nodes
riscv: dts: renesas: rzfive-smarc-som: Drop PHY interrupt support for
ETH{0,1} riscv: dts: renesas: r9a07g043f: Add L2 cache node
riscv: dts: renesas: r9a07g043f: Add dma-noncoherent property
riscv: dts: renesas: rzfive-smarc: Enable the blocks which were
explicitly disabled
Samuel Holland (1):
clocksource/drivers/riscv: Increase the clock source rating
.../cache/andestech,ax45mp-cache.yaml | 81 +++++++ .../devicetree/bindings/riscv/cpus.yaml | 11 +- MAINTAINERS | 7 + .../boot/dts/renesas/r9a07g043u11-smarc.dts | 3 + arch/arm64/boot/dts/renesas/rzg2ul-smarc.dtsi | 4 - arch/riscv/Kconfig | 10 +- arch/riscv/Kconfig.erratas | 21 ++ arch/riscv/Kconfig.socs | 5 + arch/riscv/boot/dts/Makefile | 1 + arch/riscv/boot/dts/renesas/Makefile | 2 + arch/riscv/boot/dts/renesas/r9a07g043f.dtsi | 72 ++++++ .../boot/dts/renesas/r9a07g043f01-smarc.dts | 27 +++ .../boot/dts/renesas/rzfive-smarc-som.dtsi | 24 ++ arch/riscv/boot/dts/renesas/rzfive-smarc.dtsi | 8 + arch/riscv/errata/Makefile | 1 + arch/riscv/errata/andes/Makefile | 1 + arch/riscv/errata/andes/errata.c | 66 ++++++ arch/riscv/include/asm/alternative.h | 3 + arch/riscv/include/asm/dma-noncoherent.h | 28 +++ arch/riscv/include/asm/errata_list.h | 5 + arch/riscv/include/asm/vendorid_list.h | 1 + arch/riscv/kernel/alternative.c | 5 + arch/riscv/kernel/time.c | 9 - arch/riscv/mm/dma-noncoherent.c | 105 ++++++++- drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/cache/Kconfig | 11 + drivers/cache/Makefile | 3 + drivers/cache/ax45mp_cache.c | 213 ++++++++++++++++++ drivers/clocksource/timer-riscv.c | 7 +- drivers/mmc/host/Kconfig | 4 +- drivers/soc/renesas/Kconfig | 4 + 32 files changed, 713 insertions(+), 32 deletions(-) create mode 100644 Documentation/devicetree/bindings/cache/andestech,ax45mp-cache.yaml create mode 100644 arch/riscv/boot/dts/renesas/Makefile create mode 100644 arch/riscv/boot/dts/renesas/r9a07g043f.dtsi create mode 100644 arch/riscv/boot/dts/renesas/r9a07g043f01-smarc.dts create mode 100644 arch/riscv/boot/dts/renesas/rzfive-smarc-som.dtsi create mode 100644 arch/riscv/boot/dts/renesas/rzfive-smarc.dtsi create mode 100644 arch/riscv/errata/andes/Makefile create mode 100644 arch/riscv/errata/andes/errata.c create mode 100644 arch/riscv/include/asm/dma-noncoherent.h create mode 100644 drivers/cache/Kconfig create mode 100644 drivers/cache/Makefile create mode 100644 drivers/cache/ax45mp_cache.c
Signature · 1 line
2.34.1
RFC PATCH 1/30 arm64: dts: renesas: rzg2ul-smarc: Drop including RZ/G2UL SoM DTSI
Drop including RZ/G2UL SoM DTSI in carrier board DTSI as the top level board DTS file r9a07g043u11-smarc.dts includes both of them. Upstream commit 53072ba67e534ddd208697d3465004738f1d4d61 ("arm64: dts: renesas:
rzg2ul-smarc: Include SoM DTSI into board DTS") already did this change but it was re-introduced in below commit (for v6.1-cip):
ce658d9231044 ("arm64: dts: renesas: rzg2ul-smarc: Enable SCI0")
This change is in preparation for adding the Renesas RZ/Five RISC-V SoC. Without this patch when re-using the RZ/G2UL DTS/I for the SMARC RZ/Five board we see below build issues:
DTC arch/riscv/boot/dts/renesas/r9a07g043f01-smarc.dtb
./scripts/dtc/include-prefixes/arm64/renesas/rzg2ul-smarc-som.dtsi:106.23-124.4:
ERROR (phandle_references): /soc/ethernet@11c30000/ethernet-phy@7: Reference to non-existent node or label "irqc"
also defined at arch/riscv/boot/dts/renesas/rzfive-smarc-som.dtsi:20.23-23.4
also defined at ./scripts/dtc/include-prefixes/arm64/renesas/rzg2ul-smarc-som.dtsi:106.23-124.4
ERROR: Input tree has errors, aborting (use -f to force output)
make[2]: *** [scripts/Makefile.lib:406: arch/riscv/boot/dts/renesas/r9a07g043f01-smarc.dtb] Error 2 make[1]: *** [scripts/Makefile.build:500: arch/riscv/boot/dts/renesas] Error
--- arch/arm64/boot/dts/renesas/rzg2ul-smarc.dtsi | 1 - 1 file changed, 1 deletion(-)
arch/arm64/boot/dts/renesas/rzg2ul-smarc.dtsi +0 -1
@@ -8,7 +8,6 @@ /* Please set this macro to 1 for enabling SCI0 on PMOD1 */ #define PMOD_SCI0_EN 0 -#include "rzg2ul-smarc-som.dtsi" #include "rzg2ul-smarc-pinfunction.dtsi" #include "rz-smarc-common.dtsi"
Signature · 1 line
2.34.1
RFC PATCH 2/30 arm64: dts: renesas: rzg2ul: Move PMOD_SCI0_EN macro to board DTS
In reply to Lad PrabhakarIt makes more sense to have all the configurable options in top level board DTS as we already have the configurable macros in there. This makes it easier for platforms who want to share the the DTS/I with other platforms/architectures.
This change is in preparation for adding the Renesas RZ/Five RISC-V SoC.
--- arch/arm64/boot/dts/renesas/r9a07g043u11-smarc.dts | 3 +++ arch/arm64/boot/dts/renesas/rzg2ul-smarc.dtsi | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/renesas/r9a07g043u11-smarc.dts +3 -0
@@ -28,6 +28,9 @@ #error "Cannot set as both PMOD_MTU3 and !SW_ET0_EN_N are mutually exclusive" #endif +/* Please set this macro to 1 for enabling SCI0 on PMOD1 */ +#define PMOD_SCI0_EN 0 + #include "r9a07g043u.dtsi" #include "rzg2ul-smarc-som.dtsi" #include "rzg2ul-smarc.dtsi"
arch/arm64/boot/dts/renesas/rzg2ul-smarc.dtsi +0 -3
@@ -5,9 +5,6 @@ * Copyright (C) 2022 Renesas Electronics Corp. */ -/* Please set this macro to 1 for enabling SCI0 on PMOD1 */ -#define PMOD_SCI0_EN 0 - #include "rzg2ul-smarc-pinfunction.dtsi" #include "rz-smarc-common.dtsi"
Signature · 1 line
2.34.1
RFC PATCH 3/30 mmc: host: Kconfig: Make MMC_SDHI_INTERNAL_DMAC config option dependant on ARCH_RENESAS
In reply to Lad Prabhakarcommit bbe6dc429bf52b0062c2a9b39f850cfd317289a7 upstream.
MMC_SDHI_INTERNAL_DMAC config option has dependency on ARM64 and R7S9210/R8A77470 this dependency will keep growing for future SoCs for varying architectures. So to simplify this configuration make MMC_SDHI_INTERNAL_DMAC solely depend on ARCH_RENESAS, as all Renesas SoCs inherently depend on the ARCH_RENESAS config option.
This allows selecting MMC_SDHI_INTERNAL_DMAC config option for RZ/Five SoC which is based on RISC-V architecture.
--- drivers/mmc/host/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/Kconfig +2 -2
@@ -730,9 +730,9 @@ config MMC_SDHI_SYS_DMAC config MMC_SDHI_INTERNAL_DMAC tristate "DMA for SDHI SD/SDIO controllers using on-chip bus mastering" - depends on ARM64 || ARCH_R7S9210 || ARCH_R8A77470 || COMPILE_TEST + depends on ARCH_RENESAS || COMPILE_TEST depends on MMC_SDHI - default MMC_SDHI if (ARM64 || ARCH_R7S9210 || ARCH_R8A77470) + default MMC_SDHI if ARCH_RENESAS help This provides DMA support for SDHI SD/SDIO controllers using on-chip bus mastering. This supports the controllers
Signature · 1 line
2.34.1
RFC PATCH 4/30 clocksource/drivers/riscv: Increase the clock source rating
In reply to Lad PrabhakarFrom: Samuel Holland <[email protected]>
commit 674402b0098b66b8ba91fe93c0d27af703256098 upstream.
RISC-V provides an architectural clock source via the time CSR. This clock source exposes a 64-bit counter synchronized across all CPUs. Because it is accessed using a CSR, it is much more efficient to read than MMIO clock sources. For example, on the Allwinner D1, reading the sun4i timer in a loop takes 131 cycles/iteration, while reading the RISC-V time CSR takes only 5 cycles/iteration.
Adjust the RISC-V clock source rating so it is preferred over the various platform-specific MMIO clock sources.
--- drivers/clocksource/timer-riscv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clocksource/timer-riscv.c +1 -1
@@ -73,7 +73,7 @@ static u64 notrace riscv_sched_clock(void)static struct clocksource riscv_clocksource = { .name ="riscv_clocksource" , - .rating =300 , + .rating =400 , .mask =CLOCKSOURCE_MASK (64 ), .flags =CLOCK_SOURCE_IS_CONTINUOUS , .read = riscv_clocksource_rdtime,
Signature · 1 line
2.34.1
RFC PATCH 5/30 clocksource/drivers/riscv: Get rid of clocksource_arch_init() callback
In reply to Lad Prabhakarcommit 3aff0403f814df6ce2377a6ecf61dd7750a3925f upstream.
Having a clocksource_arch_init() callback always sets vdso_clock_mode to VDSO_CLOCKMODE_ARCHTIMER if GENERIC_GETTIMEOFDAY is enabled, this is required for the riscv-timer.
This works for platforms where just riscv-timer clocksource is present. On platforms where other clock sources are available we want them to register with vdso_clock_mode set to VDSO_CLOCKMODE_NONE.
On the Renesas RZ/Five SoC OSTM block can be used as clocksource [0], to avoid multiple clock sources being registered as VDSO_CLOCKMODE_ARCHTIMER move setting of vdso_clock_mode in the riscv-timer driver instead of doing this in clocksource_arch_init() callback as done similarly for ARM/64 architecture.
[0] drivers/clocksource/renesas-ostm.c
--- arch/riscv/Kconfig | 1 - arch/riscv/kernel/time.c | 9 --------- drivers/clocksource/timer-riscv.c | 5 +++++ 3 files changed, 5 insertions(+), 10 deletions(-)
arch/riscv/Kconfig +0 -1
@@ -12,7 +12,6 @@ config 32BIT config RISCV def_bool y - select ARCH_CLOCKSOURCE_INIT select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2 select ARCH_HAS_BINFMT_FLAT
arch/riscv/kernel/time.c +0 -9
@@ -33,12 +33,3 @@ void __init time_init(void)tick_setup_hrtimer_broadcast (); } - -void clocksource_arch_init (struct clocksource *cs) -{ -#ifdef CONFIG_GENERIC_GETTIMEOFDAY - cs->vdso_clock_mode =VDSO_CLOCKMODE_ARCHTIMER ; -#else - cs->vdso_clock_mode =VDSO_CLOCKMODE_NONE ; -#endif -}
drivers/clocksource/timer-riscv.c +5 -0
@@ -77,6 +77,11 @@ static struct clocksource riscv_clocksource = { .mask = CLOCKSOURCE_MASK(64), .flags = CLOCK_SOURCE_IS_CONTINUOUS, .read = riscv_clocksource_rdtime, +#if IS_ENABLED (CONFIG_GENERIC_GETTIMEOFDAY ) + .vdso_clock_mode = VDSO_CLOCKMODE_ARCHTIMER, +#else + .vdso_clock_mode = VDSO_CLOCKMODE_NONE, +#endif };static int riscv_timer_starting_cpu (unsigned int cpu)
Signature · 1 line
2.34.1
RFC PATCH 6/30 riscv: Kconfig: Enable cpufreq kconfig menu
In reply to Lad Prabhakarcommit effae0e3d9e1139d583e9b5d050f4f948825b8a3 upstream.
Enable cpufreq kconfig menu for RISC-V.
--- arch/riscv/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
arch/riscv/Kconfig +2 -0
@@ -720,6 +720,8 @@ menu "CPU Power Management" source "drivers/cpuidle/Kconfig" +source "drivers/cpufreq/Kconfig" + endmenu # "CPU Power Management" source "arch/riscv/kvm/Kconfig"
Signature · 1 line
2.34.1
RFC PATCH 7/30 dt-bindings: riscv: Sort the CPU core list alphabetically
In reply to Lad Prabhakarcommit 57e1b873c2f54253f4c81bddb782e183ee6544ae upstream.
Sort the CPU cores list alphabetically for maintenance.
--- Documentation/devicetree/bindings/riscv/cpus.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/riscv/cpus.yaml +5 -5
@@ -28,17 +28,17 @@ properties: oneOf: - items: - enum: - - sifive,rocket0 + - canaan,k210 - sifive,bullet0 - sifive,e5 - sifive,e7 - sifive,e71 - - sifive,u74-mc - - sifive,u54 - - sifive,u74 + - sifive,rocket0 - sifive,u5 + - sifive,u54 - sifive,u7 - - canaan,k210 + - sifive,u74 + - sifive,u74-mc - const: riscv - items: - enum:
Signature · 1 line
2.34.1
RFC PATCH 8/30 dt-bindings: riscv: Add Andes AX45MP core to the list
In reply to Lad Prabhakarcommit 9f643dc28e2c072d7d323898530ee37433e74595 upstream.
The Renesas RZ/Five microprocessor includes a RISC-V CPU Core (AX45MP Single) from Andes. In preparation to add support for RZ/Five SoC add the Andes AX45MP core to the list.
More details about Andes AX45MP core can be found here:
[0] http://www.andestech.com/en/products-solutions/andescore-processors/riscv-ax45mp/
--- Documentation/devicetree/bindings/riscv/cpus.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/riscv/cpus.yaml +1 -0
@@ -28,6 +28,7 @@ properties: oneOf: - items: - enum: + - andestech,ax45mp - canaan,k210 - sifive,bullet0 - sifive,e5
Signature · 1 line
2.34.1
RFC PATCH 9/30 riscv: mm: mark noncoherent_supported as __ro_after_init
In reply to Lad PrabhakarFrom: Jisheng Zhang <[email protected]>
commit 8500808a991f0e569b3d835a6223848c0717a6c7 upstream.
The noncoherent_supported indicates whether the HW is coherent or not, it won't change after booting, mark it as __ro_after_init.
--- arch/riscv/mm/dma-noncoherent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/mm/dma-noncoherent.c +1 -1
@@ -10,7 +10,7 @@#include <linux/mm.h> #include <asm/cacheflush.h> -static bool noncoherent_supported; +static bool noncoherent_supported__ro_after_init ;void arch_sync_dma_for_device (phys_addr_t paddr,size_t size,enum dma_data_direction dir)
Signature · 1 line
2.34.1
RFC PATCH 10/30 riscv: dma-mapping: only invalidate after DMA, not flush
In reply to Lad PrabhakarFrom: Arnd Bergmann <[email protected]>
commit eb746180132a555da8cfb02d98cb6d0a9d58e870 upstream.
No other architecture intentionally writes back dirty cache lines into a buffer that a device has just finished writing into. If the cache is clean, this has no effect at all, but if a cacheline in the buffer has actually been written by the CPU, there is a driver bug that is likely made worse by overwriting that buffer.
--- arch/riscv/mm/dma-noncoherent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/mm/dma-noncoherent.c +1 -1
@@ -42,7 +42,7 @@ void arch_sync_dma_for_cpu(phys_addr_t paddr, size_t size,break ;case DMA_FROM_DEVICE :case DMA_BIDIRECTIONAL : -ALT_CMO_OP (flush, vaddr, size, riscv_cbom_block_size); +ALT_CMO_OP (inval, vaddr, size, riscv_cbom_block_size);break ;default :break ;
Signature · 1 line
2.34.1
RFC PATCH 11/30 riscv: dma-mapping: skip invalidation before bidirectional DMA
In reply to Lad PrabhakarFrom: Arnd Bergmann <[email protected]>
commit 482069ebdc1d61fba14527055894b9f4f0ced08c upstream.
For a DMA_BIDIRECTIONAL transfer, the caches have to be cleaned first to let the device see data written by the CPU, and invalidated after the transfer to let the CPU see data written by the device.
riscv also invalidates the caches before the transfer, which does not appear to serve any purpose.
--- arch/riscv/mm/dma-noncoherent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/mm/dma-noncoherent.c +1 -1
@@ -25,7 +25,7 @@ void arch_sync_dma_for_device(phys_addr_t paddr, size_t size,ALT_CMO_OP (clean, vaddr, size, riscv_cbom_block_size);break ;case DMA_BIDIRECTIONAL : -ALT_CMO_OP (flush, vaddr, size, riscv_cbom_block_size); +ALT_CMO_OP (clean, vaddr, size, riscv_cbom_block_size);break ;default :break ;
Signature · 1 line
2.34.1
RFC PATCH 12/30 riscv: dma-mapping: switch over to generic implementation
In reply to Lad Prabhakarcommit 935730160738a478dbf4b61cf0cfc29c1442fb4e upstream.
Add helper functions for cache wback/inval/clean and use them arch_sync_dma_for_device()/arch_sync_dma_for_cpu() functions. The proposed changes are in preparation for switching over to generic implementation.
Reorganization of the code is based on the patch (Link[0]) from Arnd. For now I have dropped CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU check as this will be enabled by default upon selection of RISCV_DMA_NONCOHERENT and also dropped arch_dma_mark_dcache_clean().
Link[0]: https://lore.kernel.org/all/[email protected]/
--- arch/riscv/mm/dma-noncoherent.c | 60 ++++++++++++++++++++++++++++----- 1 file changed, 51 insertions(+), 9 deletions(-)
arch/riscv/mm/dma-noncoherent.c +51 -9
@@ -12,21 +12,61 @@static bool noncoherent_supported__ro_after_init ; -void arch_sync_dma_for_device (phys_addr_t paddr,size_t size, -enum dma_data_direction dir) +static inline void arch_dma_cache_wback (phys_addr_t paddr,size_t size) +{ +void *vaddr =phys_to_virt (paddr); + +ALT_CMO_OP (clean, vaddr, size, riscv_cbom_block_size); +} + +static inline void arch_dma_cache_inv (phys_addr_t paddr,size_t size) +{ +void *vaddr =phys_to_virt (paddr); + +ALT_CMO_OP (inval, vaddr, size, riscv_cbom_block_size); +} + +static inline void arch_dma_cache_wback_inv (phys_addr_t paddr,size_t size) {void *vaddr =phys_to_virt (paddr); +ALT_CMO_OP (flush, vaddr, size, riscv_cbom_block_size); +} + +static inline bool arch_sync_dma_clean_before_fromdevice (void ) +{ +return true; +} + +static inline bool arch_sync_dma_cpu_needs_post_dma_flush (void ) +{ +return true; +} + +void arch_sync_dma_for_device (phys_addr_t paddr,size_t size, +enum dma_data_direction dir) +{switch (dir) {case DMA_TO_DEVICE : -ALT_CMO_OP (clean, vaddr, size, riscv_cbom_block_size); +arch_dma_cache_wback (paddr, size);break ; +case DMA_FROM_DEVICE : -ALT_CMO_OP (clean, vaddr, size, riscv_cbom_block_size); -break ; +if (!arch_sync_dma_clean_before_fromdevice ()) { +arch_dma_cache_inv (paddr, size); +break ; + } + fallthrough; +case DMA_BIDIRECTIONAL : -ALT_CMO_OP (clean, vaddr, size, riscv_cbom_block_size); +/* Skip the invalidate here if it's done later */ +if (IS_ENABLED (CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU ) && +arch_sync_dma_cpu_needs_post_dma_flush ()) +arch_dma_cache_wback (paddr, size); +else +arch_dma_cache_wback_inv (paddr, size);break ; +default :break ; }
@@ -35,15 +75,17 @@ void arch_sync_dma_for_device(phys_addr_t paddr, size_t size,void arch_sync_dma_for_cpu (phys_addr_t paddr,size_t size,enum dma_data_direction dir) { -void *vaddr =phys_to_virt (paddr); -switch (dir) {case DMA_TO_DEVICE :break ; +case DMA_FROM_DEVICE :case DMA_BIDIRECTIONAL : -ALT_CMO_OP (inval, vaddr, size, riscv_cbom_block_size); +/* FROM_DEVICE invalidate needed if speculative CPU prefetch only */ +if (arch_sync_dma_cpu_needs_post_dma_flush ()) +arch_dma_cache_inv (paddr, size);break ; +default :break ; }
Signature · 1 line
2.34.1
RFC PATCH 13/30 riscv: asm: vendorid_list: Add Andes Technology to the vendors list
In reply to Lad Prabhakarcommit d6ca3a56f4f3e1d408397f1e309f7c57a6d01c38 upstream.
Add Andes Technology to the vendors list.
--- arch/riscv/include/asm/vendorid_list.h | 1 + 1 file changed, 1 insertion(+)
arch/riscv/include/asm/vendorid_list.h +1 -0
@@ -5,6 +5,7 @@#ifndef ASM_VENDOR_LIST_H #define ASM_VENDOR_LIST_H +#define ANDESTECH_VENDOR_ID 0x31e#define SIFIVE_VENDOR_ID 0x489#define THEAD_VENDOR_ID 0x5b7
Signature · 1 line
2.34.1
RFC PATCH 14/30 riscv: errata: Add Andes alternative ports
In reply to Lad Prabhakarcommit e021ae7f5145d46ab64cb058cbffda31059f37e5 upstream.
Add required ports of the Alternative scheme for Andes CPU cores.
I/O Coherence Port (IOCP) provides an AXI interface for connecting external non-caching masters, such as DMA controllers. IOCP is a specification option and is disabled on the Renesas RZ/Five SoC due to this reason cache management needs a software workaround.
--- arch/riscv/Kconfig.erratas | 21 +++++++++ arch/riscv/errata/Makefile | 1 + arch/riscv/errata/andes/Makefile | 1 + arch/riscv/errata/andes/errata.c | 66 ++++++++++++++++++++++++++++ arch/riscv/include/asm/alternative.h | 3 ++ arch/riscv/include/asm/errata_list.h | 5 +++ arch/riscv/kernel/alternative.c | 5 +++ 7 files changed, 102 insertions(+) create mode 100644 arch/riscv/errata/andes/Makefile create mode 100644 arch/riscv/errata/andes/errata.c
arch/riscv/Kconfig.erratas +21 -0
@@ -1,5 +1,26 @@ menu "CPU errata selection" +config ERRATA_ANDES + bool "Andes AX45MP errata" + depends on RISCV_ALTERNATIVE + help + All Andes errata Kconfig depend on this Kconfig. Disabling + this Kconfig will disable all Andes errata. Please say "Y" + here if your platform uses Andes CPU cores. + + Otherwise, please say "N" here to avoid unnecessary overhead. + +config ERRATA_ANDES_CMO + bool "Apply Andes cache management errata" + depends on ERRATA_ANDES && MMU && ARCH_R9A07G043 + select RISCV_DMA_NONCOHERENT + default y + help + This will apply the cache management errata to handle the + non-standard handling on non-coherent operations on Andes cores. + + If you don't know what to do here, say "Y". + config ERRATA_SIFIVE bool "SiFive errata" depends on !XIP_KERNEL
arch/riscv/errata/Makefile +1 -0
@@ -1,2 +1,3 @@ +obj-$(CONFIG_ERRATA_ANDES) += andes/ obj-$(CONFIG_ERRATA_SIFIVE) += sifive/ obj-$(CONFIG_ERRATA_THEAD) += thead/
arch/riscv/errata/andes/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-y += errata.o
arch/riscv/errata/andes/errata.c new file +66 -0
66 lines not on this page · raw message
arch/riscv/include/asm/alternative.h +3 -0
@@ -40,6 +40,9 @@ struct errata_checkfunc_id {bool (*func)(struct alt_entry *alt); }; +void andes_errata_patch_func (struct alt_entry *begin,struct alt_entry *end, +unsigned long archid,unsigned long impid, +unsigned int stage);void sifive_errata_patch_func (struct alt_entry *begin,struct alt_entry *end,unsigned long archid,unsigned long impid,unsigned int stage);
arch/riscv/include/asm/errata_list.h +5 -0
@@ -8,6 +8,11 @@#include <asm/alternative.h> #include <asm/vendorid_list.h> +#ifdef CONFIG_ERRATA_ANDES +#define ERRATA_ANDESTECH_NO_IOCP 0 +#define ERRATA_ANDESTECH_NUMBER 1 +#endif +#ifdef CONFIG_ERRATA_SIFIVE #define ERRATA_SIFIVE_CIP_453 0#define ERRATA_SIFIVE_CIP_1200 1
arch/riscv/kernel/alternative.c +5 -0
@@ -38,6 +38,11 @@ static void __init_or_module riscv_fill_cpu_mfr_info(struct cpu_manufacturer_inf#endif switch (cpu_mfr_info->vendor_id) { +#ifdef CONFIG_ERRATA_ANDES +case ANDESTECH_VENDOR_ID : + cpu_mfr_info->patch_func = andes_errata_patch_func; +break ; +#endif #ifdef CONFIG_ERRATA_SIFIVE case SIFIVE_VENDOR_ID : cpu_mfr_info->patch_func = sifive_errata_patch_func;
Signature · 1 line
2.34.1
RFC PATCH 15/30 riscv: mm: dma-noncoherent: nonstandard cache operations support
In reply to Lad Prabhakarcommit b79f300c1fd4bd83b1f827c7a0e043fca7aad73c upstream.
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.
--- arch/riscv/Kconfig | 7 ++++ arch/riscv/include/asm/dma-noncoherent.h | 28 +++++++++++++++ arch/riscv/mm/dma-noncoherent.c | 43 ++++++++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 arch/riscv/include/asm/dma-noncoherent.h
arch/riscv/Kconfig +7 -0
@@ -231,6 +231,13 @@ config RISCV_DMA_NONCOHERENT select ARCH_HAS_SETUP_DMA_OPS select DMA_DIRECT_REMAP +config RISCV_NONSTANDARD_CACHE_OPS + bool + depends on RISCV_DMA_NONCOHERENT + help + This enables function pointer support for non-standard noncoherent + systems to handle cache management. + config AS_HAS_INSN def_bool $(as-instr,.insn r 51$(comma) 0$(comma) 0$(comma) t0$(comma) t0$(comma) zero)
arch/riscv/include/asm/dma-noncoherent.h new file +28 -0
@@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2023 Renesas Electronics Corp. +*/ + +#ifndef __ASM_DMA_NONCOHERENT_H +#define __ASM_DMA_NONCOHERENT_H + +#include <linux/dma-direct.h> + +/* +* struct riscv_nonstd_cache_ops - Structure for non-standard CMO function pointers +* +* @wback: Function pointer for cache writeback +* @inv: Function pointer for invalidating cache +* @wback_inv: Function pointer for flushing the cache (writeback + invalidating) +*/ +struct riscv_nonstd_cache_ops { +void (*wback)(phys_addr_t paddr,size_t size); +void (*inv)(phys_addr_t paddr,size_t size); +void (*wback_inv)(phys_addr_t paddr,size_t size); +}; + +extern struct riscv_nonstd_cache_ops noncoherent_cache_ops; + +void riscv_noncoherent_register_cache_ops (const struct riscv_nonstd_cache_ops *ops); + +#endif /* __ASM_DMA_NONCOHERENT_H */
arch/riscv/mm/dma-noncoherent.c +43 -0
77 lines not on this page · raw message
Signature · 1 line
2.34.1
RFC PATCH 16/30 dt-bindings: cache: andestech,ax45mp-cache: Add DT binding documentation for L2 cache controller
In reply to Lad Prabhakarcommit 3e7bf4685e42786dc10a57512c8a767947f25c10 upstream.
Add DT binding documentation for L2 cache controller found on RZ/Five SoC.
The Renesas RZ/Five microprocessor includes a RISC-V CPU Core (AX45MP Single) from Andes. The AX45MP core has an L2 cache controller, this patch describes the L2 cache block.
--- .../cache/andestech,ax45mp-cache.yaml | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 Documentation/devicetree/bindings/cache/andestech,ax45mp-cache.yaml
Documentation/devicetree/bindings/cache/andestech,ax45mp-cache.yaml new file +81 -0
@@ -0,0 +1,81 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +# Copyright (C) 2023 Renesas Electronics Corp. +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/cache/andestech,ax45mp-cache.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Andestech AX45MP L2 Cache Controller + +maintainers: + - Lad Prabhakar <[email protected]> + +description: + A level-2 cache (L2C) is used to improve the system performance by providing + a large amount of cache line entries and reasonable access delays. The L2C + is shared between cores, and a non-inclusive non-exclusive policy is used. + +select: + properties: + compatible: + contains: + enum: + - andestech,ax45mp-cache + + required: + - compatible + +properties: + compatible: + items: + - const: andestech,ax45mp-cache + - const: cache + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + cache-line-size: + const: 64 + + cache-level: + const: 2 + + cache-sets: + const: 1024 + + cache-size: + enum: [131072, 262144, 524288, 1048576, 2097152] + + cache-unified: true + + next-level-cache: true + +additionalProperties: false + +required: + - compatible + - reg + - interrupts + - cache-line-size + - cache-level + - cache-sets + - cache-size + - cache-unified + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + + cache-controller@2010000 { + compatible = "andestech,ax45mp-cache", "cache"; + reg = <0x13400000 0x100000>; + interrupts = <508 IRQ_TYPE_LEVEL_HIGH>; + cache-line-size = <64>; + cache-level = <2>; + cache-sets = <1024>; + cache-size = <262144>; + cache-unified; + };
Signature · 1 line
2.34.1
RFC PATCH 17/30 cache: Add L2 cache management for Andes AX45MP RISC-V core
In reply to Lad Prabhakarcommit d34599bcd2e4e93a28d5904bf94bc7dafc511f04 upstream.
I/O Coherence Port (IOCP) provides an AXI interface for connecting external non-caching masters, such as DMA controllers. The accesses from IOCP are coherent with D-Caches and L2 Cache.
IOCP is a specification option and is disabled on the Renesas RZ/Five SoC due to this reason IP blocks using DMA will fail.
The 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. Below are the memory attributes supported:
* Device, Non-bufferable
* Device, bufferable
* Memory, Non-cacheable, Non-bufferable
* Memory, Non-cacheable, Bufferable
* Memory, Write-back, No-allocate
* Memory, Write-back, Read-allocate
* Memory, Write-back, Write-allocate
* Memory, Write-back, Read and Write-allocate
More info about PMA (section 10.3):
As a workaround for SoCs with IOCP disabled CMO needs to be handled by software. Firstly OpenSBI configures the memory region as "Memory, Non-cacheable, Bufferable" and passes this region as a global shared dma pool as a DT node. With DMA_GLOBAL_POOL enabled all DMA allocations happen from this region and synchronization callbacks are implemented to synchronize when doing DMA transactions.
Example PMA region passes as a DT node from OpenSBI:
reserved-memory {
#address-cells = <2>;
#size-cells = <2>;
ranges;
pma_resv0@58000000 {
compatible = "shared-dma-pool";
reg = <0x0 0x58000000 0x0 0x08000000>;
no-map;
linux,dma-default;
};
};--- MAINTAINERS | 7 ++ drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/cache/Kconfig | 11 ++ drivers/cache/Makefile | 3 + drivers/cache/ax45mp_cache.c | 213 +++++++++++++++++++++++++++++++++++ 6 files changed, 237 insertions(+) create mode 100644 drivers/cache/Kconfig create mode 100644 drivers/cache/Makefile create mode 100644 drivers/cache/ax45mp_cache.c
MAINTAINERS +7 -0
@@ -19632,6 +19632,13 @@ S: Supported T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git F: drivers/staging/ +STANDALONE CACHE CONTROLLER DRIVERS +M: Conor Dooley <[email protected]> +L: [email protected] +S: Maintained +T: git https://git.kernel.org/pub/scm/linux/kernel/git/conor/linux.git/ +F: drivers/cache + STARFIRE/DURALAN NETWORK DRIVER M: Ion Badulescu <[email protected]> S: Odd Fixes
drivers/Kconfig +2 -0
@@ -15,6 +15,8 @@ source "drivers/base/Kconfig" source "drivers/bus/Kconfig" +source "drivers/cache/Kconfig" + source "drivers/connector/Kconfig" source "drivers/firmware/Kconfig"
drivers/Makefile +1 -0
@@ -6,6 +6,7 @@ # Rewritten to use lists instead of if-statements. # +obj-y += cache/ obj-y += irqchip/ obj-y += bus/
drivers/cache/Kconfig new file +11 -0
@@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 +menu "Cache Drivers" + +config AX45MP_L2_CACHE + bool "Andes Technology AX45MP L2 Cache controller" + depends on RISCV_DMA_NONCOHERENT + select RISCV_NONSTANDARD_CACHE_OPS + help + Support for the L2 cache controller on Andes Technology AX45MP platforms. + +endmenu
drivers/cache/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-$(CONFIG_AX45MP_L2_CACHE) += ax45mp_cache.o
drivers/cache/ax45mp_cache.c new file +213 -0
213 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH RFC 17/30] cache: Add L2 cache management for Andes AX45MP RISC-V core
Hi!
Quoted 3 lines
IOCP is a specification option and is disabled on the Renesas RZ/Five SoC due to this reason IP blocks using DMA will fail.
...
Quoted 3 lines
As a workaround for SoCs with IOCP disabled CMO needs to be handled by software. Firstly OpenSBI configures the memory region as
There are too many acronyms here. What is CMO, in particular? And putting this forward near the IOCP definition might be more helpful.
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
RE: [PATCH RFC 17/30] cache: Add L2 cache management for Andes AX45MP RISC-V core
Hi,
Quoted 13 lines
-----Original Message-----
From: Pavel Machek <[email protected]>
Sent: Tuesday, December 26, 2023 6:32 PM
To: Prabhakar Mahadev Lad <[email protected]>
Cc: [email protected]; Nobuhiro Iwamatsu <[email protected]>; Pavel Machek <[email protected]>; Biju Das <[email protected]>
Subject: Re: [PATCH RFC 17/30] cache: Add L2 cache management for Andes AX45MP RISC-V coreHi!
Quoted 3 lines
IOCP is a specification option and is disabled on the Renesas RZ/Five SoC due to this reason IP blocks using DMA will fail.
Quoted 8 lines
...
Quoted 3 lines
As a workaround for SoCs with IOCP disabled CMO needs to be handled by software. Firstly OpenSBI configures the memory region as
There are too many acronyms here. What is CMO, in particular? And putting this forward near the IOCP definition might be more helpful.
CMO (cache management operation), in RISC-V [0].
IOCP (I/O coherence port), The IOCP is implemented as an AXI slave interface for communicate between I/O devices and L2 memory subsystem [1]
[0] https://github.com/riscv/riscv-CMOs
[1] https://www.andestech.com/wp-content/uploads/AX45MP-1C-Rev.-5.0.0-Datasheet.pdf
Cheers,
Prabhakar
Re: [PATCH RFC 17/30] cache: Add L2 cache management for Andes AX45MP RISC-V core
In reply to Lad PrabhakarHi!
Quoted 4 lines
drivers/cache/ax45mp_cache.c new file +4
-0+static void ax45mp_dma_cache_inv (phys_addr_t paddr,size_t size) +{ +unsigned long start = (unsigned long )phys_to_virt (paddr); +unsigned long end = start + size;
drivers/cache/ax45mp_cache.c line 116
Quoted 10 lines
drivers/cache/ax45mp_cache.c new file +10
-0+unsigned long line_size; +unsigned long flags; + +if (unlikely (start == end)) +return ; + + line_size = ax45mp_priv.ax45mp_cache_line_size; + + start = start & (~(line_size -1 )); + end = ((end + line_size -1 ) & (~(line_size -1 )));
Could some macros be used to make this more readable? I'm pretty sure we have macros for cacheline alignment and aligning end to cacheline boundary.
Quoted 10 lines
drivers/cache/ax45mp_cache.c new file +10
-0+local_irq_save (flags); + +ax45mp_cpu_dcache_inval_range (start, end); + +local_irq_restore (flags); +} + +static void ax45mp_dma_cache_wback (phys_addr_t paddr,size_t size) +{ +unsigned long start = (unsigned long )phys_to_virt (paddr);
drivers/cache/ax45mp_cache.c line 137
Quoted 10 lines
drivers/cache/ax45mp_cache.c new file +10
-0+unsigned long end = start + size; +unsigned long line_size; +unsigned long flags; + + line_size = ax45mp_priv.ax45mp_cache_line_size; + start = start & (~(line_size -1 )); +local_irq_save (flags); +ax45mp_cpu_dcache_wb_range (start, end); +local_irq_restore (flags); +}
This should be very similar to the previous function, but is not.
In particular, it does not check start == end special case, and does not line-align the end.
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
RE: [PATCH RFC 17/30] cache: Add L2 cache management for Andes AX45MP RISC-V core
Hi Pavel,
Thank you for the review.
Quoted 20 lines
Hi!
drivers/cache/ax45mp_cache.c line 116
Quoted 13 lines
drivers/cache/ax45mp_cache.c new file +13
-0+static void ax45mp_dma_cache_inv (phys_addr_t paddr,size_t size) { +unsigned long start = (unsigned long )phys_to_virt (paddr); +unsigned long end = start + size; +unsigned long line_size; +unsigned long flags; + +if (unlikely (start == end)) +return ; + + line_size = ax45mp_priv.ax45mp_cache_line_size; + + start = start & (~(line_size -1 )); + end = ((end + line_size -1 ) & (~(line_size -1 )));Could some macros be used to make this more readable? I'm pretty sure we have macros for cacheline alignment and aligning end to cacheline boundary.
Hmmm, can you please point me here, I must have missed it.
Quoted 22 lines
Quoted 9 lines
drivers/cache/ax45mp_cache.c new file +9
-0+local_irq_save (flags); + +ax45mp_cpu_dcache_inval_range (start, end); + +local_irq_restore (flags); +} + +static void ax45mp_dma_cache_wback (phys_addr_t paddr,size_t size) { +unsigned long start = (unsigned long )phys_to_virt (paddr);drivers/cache/ax45mp_cache.c line 137
Quoted 10 lines
drivers/cache/ax45mp_cache.c new file +10
-0+unsigned long end = start + size; +unsigned long line_size; +unsigned long flags; + + line_size = ax45mp_priv.ax45mp_cache_line_size; + start = start & (~(line_size -1 )); +local_irq_save (flags); +ax45mp_cpu_dcache_wb_range (start, end); +local_irq_restore (flags); +}This should be very similar to the previous function, but is not.
Quoted 2 lines
In particular, it does not check start == end special case, and does not line-align the end.
Good catch, I'll get that sorted upstream first and then backport it.
Cheers,
Prabhakar
RFC PATCH 18/30 soc: renesas: Kconfig: Select the required configs for RZ/Five SoC
In reply to Lad Prabhakarcommit 484861e09f3ed8fb2e1de290d9e33fee3611b9fc upstream.
Explicitly select the required Cache management and Errata configs required for the RZ/Five SoC.
--- drivers/soc/renesas/Kconfig | 4 ++++ 1 file changed, 4 insertions(+)
drivers/soc/renesas/Kconfig +4 -0
@@ -339,6 +339,10 @@ if RISCV config ARCH_R9A07G043 bool "RISC-V Platform support for RZ/Five" select ARCH_RZG2L + select AX45MP_L2_CACHE + select DMA_GLOBAL_POOL + select ERRATA_ANDES + select ERRATA_ANDES_CMO help This enables support for the Renesas RZ/Five SoC.
Signature · 1 line
2.34.1
RFC PATCH 19/30 riscv: Kconfig.socs: Add ARCH_RENESAS kconfig option
In reply to Lad Prabhakarcommit 8292493c22c8e28b6e67a01e0f5c6db1cf231eb1 upstream.
Add ARCH_RENESAS config option to allow selecting the Renesas RISC-V SoCs. We currently have the newly added RZ/Five (R9A07G043) RISC-V based SoC.
--- arch/riscv/Kconfig.socs | 5 +++++ 1 file changed, 5 insertions(+)
arch/riscv/Kconfig.socs +5 -0
@@ -7,6 +7,11 @@ config SOC_MICROCHIP_POLARFIRE help This enables support for Microchip PolarFire SoC platforms. +config ARCH_RENESAS + bool "Renesas RISC-V SoCs" + help + This enables support for the RISC-V based Renesas SoCs. + config SOC_SIFIVE bool "SiFive SoCs" select SERIAL_SIFIVE if TTY
Signature · 1 line
2.34.1
RFC PATCH 20/30 riscv: dts: renesas: Add initial devicetree for Renesas RZ/Five SoC
In reply to Lad Prabhakarcommit b3e77da00f1b7b670983c69d0295f4ce132bf87c upstream.
Add initial device tree for Renesas RZ/Five RISC-V CPU Core (AX45MP Single).
RZ/Five SoC is almost identical to RZ/G2UL Type-1 SoC (ARM64) hence we will be reusing r9a07g043.dtsi [0] as a base DTSI for both the SoC's. r9a07g043f.dtsi includes RZ/Five SoC specific blocks.
Below are the RZ/Five SoC specific blocks added in the initial DTSI which can be used to boot via initramfs on RZ/Five SMARC EVK:
- AX45MP CPU
- PLIC
[0] arch/arm64/boot/dts/renesas/r9a07g043.dtsi
--- arch/riscv/boot/dts/renesas/r9a07g043f.dtsi | 57 +++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 arch/riscv/boot/dts/renesas/r9a07g043f.dtsi
arch/riscv/boot/dts/renesas/r9a07g043f.dtsi new file +57 -0
@@ -0,0 +1,57 @@ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +/* + * Device Tree Source for the RZ/Five SoC + * + * Copyright (C) 2022 Renesas Electronics Corp. + */ + +#include <dt-bindings/interrupt-controller/irq.h> + +#define SOC_PERIPHERAL_IRQ(nr) (nr + 32) + +#include <arm64/renesas/r9a07g043.dtsi> + +/ { + cpus { + #address-cells = <1>; + #size-cells = <0>; + timebase-frequency = <12000000>; + + cpu0: cpu@0 { + compatible = "andestech,ax45mp", "riscv"; + device_type = "cpu"; + reg = <0x0>; + status = "okay"; + riscv,isa = "rv64imafdc"; + mmu-type = "riscv,sv39"; + i-cache-size = <0x8000>; + i-cache-line-size = <0x40>; + d-cache-size = <0x8000>; + d-cache-line-size = <0x40>; + clocks = <&cpg CPG_CORE R9A07G043_CLK_I>; + + cpu0_intc: interrupt-controller { + #interrupt-cells = <1>; + compatible = "riscv,cpu-intc"; + interrupt-controller; + }; + }; + }; +}; + +&soc { + interrupt-parent = <&plic>; + + plic: interrupt-controller@12c00000 { + compatible = "renesas,r9a07g043-plic", "andestech,nceplic100"; + #interrupt-cells = <2>; + #address-cells = <0>; + riscv,ndev = <511>; + interrupt-controller; + reg = <0x0 0x12c00000 0 0x400000>; + clocks = <&cpg CPG_MOD R9A07G043_NCEPLIC_ACLK>; + power-domains = <&cpg>; + resets = <&cpg R9A07G043_NCEPLIC_ARESETN>; + interrupts-extended = <&cpu0_intc 11 &cpu0_intc 9>; + }; +};
Signature · 1 line
2.34.1
RFC PATCH 21/30 riscv: dts: renesas: Add minimal DTS for Renesas RZ/Five SMARC EVK
In reply to Lad Prabhakarcommit 4adb690aa1b41c1e52af579574d1d6aa58da1187 upstream.
Enable the minimal blocks required for booting the Renesas RZ/Five SMARC EVK with initramfs.
Below are the blocks which are enabled:
- CPG
- CPU0
- DDR (memory regions)
- PINCTRL
- PLIC
- SCIF0
As we are reusing the RZ/G2UL SoC base DTSI [0], RZ/G2UL SMARC SoM [1] and carrier [2] board DTSIs which enables almost all the blocks supported by the RZ/G2UL SMARC EVK and whereas on RZ/Five SoC we will be gradually enabling the blocks hence the aliases for ETH/I2C are deleted and rest of the IP blocks are marked as disabled/deleted.
[0] arch/arm64/boot/dts/renesas/r9a07g043.dtsi
[1] arch/arm64/boot/dts/renesas/rzg2ul-smarc-som.dtsi
[2] arch/arm64/boot/dts/renesas/rzg2ul-smarc.dtsi
--- arch/riscv/boot/dts/Makefile | 1 + arch/riscv/boot/dts/renesas/Makefile | 2 + .../boot/dts/renesas/r9a07g043f01-smarc.dts | 27 ++++++ .../boot/dts/renesas/rzfive-smarc-som.dtsi | 58 ++++++++++++ arch/riscv/boot/dts/renesas/rzfive-smarc.dtsi | 91 +++++++++++++++++++ 5 files changed, 179 insertions(+) create mode 100644 arch/riscv/boot/dts/renesas/Makefile create mode 100644 arch/riscv/boot/dts/renesas/r9a07g043f01-smarc.dts create mode 100644 arch/riscv/boot/dts/renesas/rzfive-smarc-som.dtsi create mode 100644 arch/riscv/boot/dts/renesas/rzfive-smarc.dtsi
arch/riscv/boot/dts/Makefile +1 -0
@@ -3,5 +3,6 @@ subdir-y += sifive subdir-y += starfive subdir-$(CONFIG_SOC_CANAAN_K210_DTB_BUILTIN) += canaan subdir-y += microchip +subdir-y += renesas obj-$(CONFIG_BUILTIN_DTB) := $(addsuffix /, $(subdir-y))
arch/riscv/boot/dts/renesas/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0 +dtb-$(CONFIG_ARCH_R9A07G043) += r9a07g043f01-smarc.dtb
arch/riscv/boot/dts/renesas/r9a07g043f01-smarc.dts new file +27 -0
@@ -0,0 +1,27 @@ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +/* + * Device Tree Source for the RZ/Five SMARC EVK + * + * Copyright (C) 2022 Renesas Electronics Corp. + */ + +/dts-v1/; + +/* + * DIP-Switch SW1 setting + * 1 : High; 0: Low + * SW1-2 : SW_SD0_DEV_SEL (0: uSD; 1: eMMC) + * SW1-3 : SW_ET0_EN_N (0: ETHER0; 1: CAN0, CAN1, SSI1, RSPI1) + * Please change below macros according to SW1 setting on the SoM + */ +#define SW_SW0_DEV_SEL 1 +#define SW_ET0_EN_N 1 + +#include "r9a07g043f.dtsi" +#include "rzfive-smarc-som.dtsi" +#include "rzfive-smarc.dtsi" + +/ { + model = "Renesas SMARC EVK based on r9a07g043f01"; + compatible = "renesas,smarc-evk", "renesas,r9a07g043f01", "renesas,r9a07g043"; +};
arch/riscv/boot/dts/renesas/rzfive-smarc-som.dtsi new file +58 -0
58 lines not on this page · raw message
arch/riscv/boot/dts/renesas/rzfive-smarc.dtsi new file +91 -0
91 lines not on this page · raw message
Signature · 1 line
2.34.1
RFC PATCH 22/30 riscv: dts: renesas: r9a07g043f/rzfive-smarc-som: Enable ADC/OPP/Thermal Zones/TSU
In reply to Lad Prabhakarcommit 42d3345eb3466587798c25a7e5704e15b738263e upstream.
Enable support for below blocks found on RZ/Five SMARC EVK SoC/SoM:
- ADC
- OPP
- Thermal Zones
- TSU
Note, these blocks are enabled in RZ/G2UL SMARC SoM DTSI [0] hence deleting these disabled nodes from RZ/Five SMARC SoM DTSI enables them here too as we include [0] in RZ/Five SMARC SoM DTSI.
[0] arch/arm64/boot/dts/renesas/rzg2ul-smarc-som.dtsi
--- arch/riscv/boot/dts/renesas/r9a07g043f.dtsi | 2 ++ arch/riscv/boot/dts/renesas/rzfive-smarc-som.dtsi | 11 ----------- 2 files changed, 2 insertions(+), 11 deletions(-)
arch/riscv/boot/dts/renesas/r9a07g043f.dtsi +2 -0
@@ -20,6 +20,7 @@ cpus { cpu0: cpu@0 { compatible = "andestech,ax45mp", "riscv"; device_type = "cpu"; + #cooling-cells = <2>; reg = <0x0>; status = "okay"; riscv,isa = "rv64imafdc";
@@ -29,6 +30,7 @@ cpu0: cpu@0 { d-cache-size = <0x8000>; d-cache-line-size = <0x40>; clocks = <&cpg CPG_CORE R9A07G043_CLK_I>; + operating-points-v2 = <&cluster0_opp>; cpu0_intc: interrupt-controller { #interrupt-cells = <1>;
arch/riscv/boot/dts/renesas/rzfive-smarc-som.dtsi +0 -11
@@ -16,13 +16,6 @@ aliases { chosen { bootargs = "ignore_loglevel"; }; - - /delete-node/opp-table-0; - /delete-node/thermal-zones; -}; - -&adc { - status = "disabled"; }; &dmac {
@@ -49,10 +42,6 @@ &sdhi0 { status = "disabled"; }; -&tsu { - status = "disabled"; -}; - &wdt0 { status = "disabled"; };
Signature · 1 line
2.34.1
RFC PATCH 23/30 riscv: dts: renesas: rzfive-smarc: Enable CANFD/I2C
In reply to Lad Prabhakarcommit 40005cb6093e92d24a1bdbc444311c25e4b28878 upstream.
Enable CANFD and I2C on RZ/Five SMARC EVK.
Note, these blocks are enabled in RZ/G2UL SMARC EVK DTSI [0] hence deleting these disabled nodes from RZ/Five SMARC EVK DTSI enables them here too as we include [0] in RZ/Five SMARC EVK DTSI.
[0] arch/arm64/boot/dts/renesas/rzg2ul-smarc.dtsi
--- arch/riscv/boot/dts/renesas/rzfive-smarc.dtsi | 27 ------------------- 1 file changed, 27 deletions(-)
arch/riscv/boot/dts/renesas/rzfive-smarc.dtsi +0 -27
@@ -7,25 +7,6 @@ #include <arm64/renesas/rzg2ul-smarc.dtsi> -/ { - aliases { - /delete-property/ i2c0; - /delete-property/ i2c1; - }; -}; - -&canfd { - status = "disabled"; - - channel0 { - status = "disabled"; - }; - - channel1 { - status = "disabled"; - }; -}; - &ehci0 { status = "disabled"; };
@@ -38,14 +19,6 @@ &hsusb { status = "disabled"; }; -&i2c0 { - status = "disabled"; -}; - -&i2c1 { - status = "disabled"; -}; - &ohci0 { status = "disabled"; };
Signature · 1 line
2.34.1
RFC PATCH 24/30 riscv: dts: renesas: rzfive-smarc-som: Enable WDT
In reply to Lad Prabhakarcommit 3e9e6fc9c64f7b9b777c5b2c2e2c9a1326065137 upstream.
Enable WDT node on RZ/Five SMARC SoM.
Note, WDT block is enabled in RZ/G2UL SMARC SoM DTSI [0] hence deleting the disabled node from RZ/Five SMARC SoM DTSI enables it here too as we include [0] in RZ/Five SMARC SoM DTSI.
[0] arch/arm64/boot/dts/renesas/rzg2ul-smarc-som.dtsi
--- arch/riscv/boot/dts/renesas/rzfive-smarc-som.dtsi | 4 ---- 1 file changed, 4 deletions(-)
arch/riscv/boot/dts/renesas/rzfive-smarc-som.dtsi +0 -4
@@ -41,7 +41,3 @@ &ostm2 { &sdhi0 { status = "disabled"; }; - -&wdt0 { - status = "disabled"; -};
Signature · 1 line
2.34.1
RFC PATCH 25/30 riscv: dts: renesas: rzfive-smarc-som: Enable OSTM nodes
In reply to Lad Prabhakarcommit c68b12a902067aa6c88aa02c29673a96ef086e5d upstream.
Enable OSTM{1,2} nodes on RZ/Five SMARC SoM.
Note, OSTM{1,2} nodes are enabled in the RZ/G2UL SMARC SoM DTSI [0] hence deleting the disabled nodes from RZ/Five SMARC SoM DTSI enables it here too as we include [0] in RZ/Five SMARC SoM DTSI.
[0] arch/arm64/boot/dts/renesas/rzg2ul-smarc-som.dtsi
--- arch/riscv/boot/dts/renesas/rzfive-smarc-som.dtsi | 8 -------- 1 file changed, 8 deletions(-)
arch/riscv/boot/dts/renesas/rzfive-smarc-som.dtsi +0 -8
@@ -30,14 +30,6 @@ ð1 { status = "disabled"; }; -&ostm1 { - status = "disabled"; -}; - -&ostm2 { - status = "disabled"; -}; - &sdhi0 { status = "disabled"; };
Signature · 1 line
2.34.1
RFC PATCH 26/30 riscv: dts: renesas: rzfive-smarc-som: Drop PHY interrupt support for ETH{0,1}
In reply to Lad Prabhakarcommit 7dd48e96d0cda9af79a2fee85e9135b4781f9ee1 upstream.
IRQC support for RZ/Five is still missing so drop the interrupts and interrupt-parent properties from the PHY nodes of ETH{0,1}.
--- arch/riscv/boot/dts/renesas/rzfive-smarc-som.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/riscv/boot/dts/renesas/rzfive-smarc-som.dtsi +10 -0
@@ -24,10 +24,20 @@ &dmac { ð0 { status = "disabled"; + + phy0: ethernet-phy@7 { + /delete-property/ interrupt-parent; + /delete-property/ interrupts; + }; }; ð1 { status = "disabled"; + + phy1: ethernet-phy@7 { + /delete-property/ interrupt-parent; + /delete-property/ interrupts; + }; }; &sdhi0 {
Signature · 1 line
2.34.1
RFC PATCH 27/30 riscv: dts: renesas: Clean up dtbs_check W=1 warning due to empty phy node
In reply to Lad PrabhakarFrom: Conor Dooley <[email protected]>
commit 7a98d75c4a63a90e81178170b748512e7a23417d upstream.
dtbs_check w/ W=1 complains:
Warning (unit_address_vs_reg): /soc/ethernet@11c20000/ethernet-phy@7: node has a unit name, but no reg or ranges property Warning (avoid_unnecessary_addr_size): /soc/ethernet@11c20000: unnecessary #address-cells/#size-cells without "ranges" or child "reg" property
The ethernet@11c20000 node is guarded by an #if (!SW_ET0_EN_N) in rzg2ul-smarc-som.dtsi, where the phy child node is added. In rzfive-smarc-som.dtsi, the ethernet node is marked disabled & the interrupt properties are deleted from the phy child node. As a result, the produced dts looks like:
ethernet@11c20000 {
compatible = "renesas,r9a07g043-gbeth",
"renesas,rzg2l-gbeth";
/* snip */
#address-cells = <1>;
#size-cells = <0>;
status = "disabled";
ethernet-phy@7 {
};
};Adding a corresponding #if (!SW_ET0_EN_N) around the node in rzfive-smarc-som.dtsi avoids the complaint, as the empty child node is not added:
ethernet@11c20000 {
compatible = "renesas,r9a07g043-gbeth",
"renesas,rzg2l-gbeth";
/* snip */
#address-cells = <1>;
#size-cells = <0>;
status = "disabled";
};--- arch/riscv/boot/dts/renesas/rzfive-smarc-som.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/riscv/boot/dts/renesas/rzfive-smarc-som.dtsi +2 -0
@@ -22,6 +22,7 @@ &dmac { status = "disabled"; }; +#if (!SW_ET0_EN_N) ð0 { status = "disabled";
@@ -30,6 +31,7 @@ phy0: ethernet-phy@7 { /delete-property/ interrupts; }; }; +#endif ð1 { status = "disabled";
Signature · 1 line
2.34.1
RFC PATCH 28/30 riscv: dts: renesas: r9a07g043f: Add L2 cache node
In reply to Lad Prabhakarcommit a38b1061d327c120844e5dc0217191b06ce3b25f upstream.
Add L2 cache node for RZ/Five SoC.
--- arch/riscv/boot/dts/renesas/r9a07g043f.dtsi | 12 ++++++++++++ 1 file changed, 12 insertions(+)
arch/riscv/boot/dts/renesas/r9a07g043f.dtsi +12 -0
@@ -29,6 +29,7 @@ cpu0: cpu@0 { i-cache-line-size = <0x40>; d-cache-size = <0x8000>; d-cache-line-size = <0x40>; + next-level-cache = <&l2cache>; clocks = <&cpg CPG_CORE R9A07G043_CLK_I>; operating-points-v2 = <&cluster0_opp>;
@@ -56,4 +57,15 @@ plic: interrupt-controller@12c00000 { resets = <&cpg R9A07G043_NCEPLIC_ARESETN>; interrupts-extended = <&cpu0_intc 11 &cpu0_intc 9>; }; + + l2cache: cache-controller@13400000 { + compatible = "andestech,ax45mp-cache", "cache"; + reg = <0x0 0x13400000 0x0 0x100000>; + interrupts = <SOC_PERIPHERAL_IRQ(476) IRQ_TYPE_LEVEL_HIGH>; + cache-size = <0x40000>; + cache-line-size = <64>; + cache-sets = <1024>; + cache-unified; + cache-level = <2>; + }; };
Signature · 1 line
2.34.1
Re: [PATCH RFC 28/30] riscv: dts: renesas: r9a07g043f: Add L2 cache node
Hi!
Quoted 3 lines
commit
a38b1061d327c120844e5dc0217191b06ce3b25fupstream.Add L2 cache node for RZ/Five SoC.
This is minor, but..
Quoted 11 lines
+++
b/arch/riscv/boot/dts/renesas/r9a07g043f.dtsiarch/riscv/boot/dts/renesas/r9a07g043f.dtsi +2
-0@@ -29,6 +29,7 @@ cpu0: cpu@0 { i-cache-line-size = <0x40>; d-cache-size = <0x8000>; d-cache-line-size = <0x40>;@@ -56,4 +57,15 @@ plic: interrupt-controller@12c00000 { resets = <&cpg R9A07G043_NCEPLIC_ARESETN>; interrupts-extended = <&cpu0_intc 11 &cpu0_intc 9>; }; + + l2cache: cache-controller@13400000 {
...
arch/riscv/boot/dts/renesas/r9a07g043f.dtsi plic: interrupt-controller@12c00000 { · line 66
Quoted 2 lines
arch/riscv/boot/dts/renesas/r9a07g043f.dtsi +2
-0+ cache-size = <0x40000>; + cache-line-size = <64>;
Sometimes using hex and sometimes dec for cache-line-size looks strange.
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
RE: [PATCH RFC 28/30] riscv: dts: renesas: r9a07g043f: Add L2 cache node
Hi Pavel,
Thank you for the review.
Quoted 20 lines
Hi!
Quoted 3 lines
commit
a38b1061d327c120844e5dc0217191b06ce3b25fupstream.Add L2 cache node for RZ/Five SoC.
This is minor, but..
Quoted 11 lines
+++
b/arch/riscv/boot/dts/renesas/r9a07g043f.dtsiarch/riscv/boot/dts/renesas/r9a07g043f.dtsi +2
-0@@ -29,6 +29,7 @@ cpu0: cpu@0 { i-cache-line-size = <0x40>; d-cache-size = <0x8000>; d-cache-line-size = <0x40>;@@ -56,4 +57,15 @@ plic: interrupt-controller@12c00000 { resets = <&cpg R9A07G043_NCEPLIC_ARESETN>; interrupts-extended = <&cpu0_intc 11 &cpu0_intc 9>; }; + + l2cache: cache-controller@13400000 {...
Quoted 5 lines
arch/riscv/boot/dts/renesas/r9a07g043f.dtsi plic: interrupt-controller@12c00000 { · line 66
Quoted 2 lines
arch/riscv/boot/dts/renesas/r9a07g043f.dtsi +2
-0+ cache-size = <0x40000>; + cache-line-size = <64>;Sometimes using hex and sometimes dec for cache-line-size looks strange.
Agreed, If there arises a chance to change this file upstream I'll update it.
Cheers,
Prabhakar
RFC PATCH 29/30 riscv: dts: renesas: r9a07g043f: Add dma-noncoherent property
In reply to Lad Prabhakarcommit 9e40584dc2592edbd35485731c3e9ab1291e6a13 upstream.
RZ/Five is a noncoherent SoC so to indicate this add dma-noncoherent property to RZ/Five SoC DTSI.
--- arch/riscv/boot/dts/renesas/r9a07g043f.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/riscv/boot/dts/renesas/r9a07g043f.dtsi +1 -0
@@ -43,6 +43,7 @@ cpu0_intc: interrupt-controller { }; &soc { + dma-noncoherent; interrupt-parent = <&plic>; plic: interrupt-controller@12c00000 {
Signature · 1 line
2.34.1
RFC PATCH 30/30 riscv: dts: renesas: rzfive-smarc: Enable the blocks which were explicitly disabled
In reply to Lad Prabhakarcommit bfef0760d247550318a4a4a71ae472875caf711c upstream.
Now that noncoherent dma support for the RZ/Five SoC has been added, enable the IP blocks which were disabled on the RZ/Five SMARC. This adds support for the below peripherals:
* Ethernet
* DMAC
* SDHI
* USB
* RSPI
* SSI
--- .../boot/dts/renesas/rzfive-smarc-som.dtsi | 23 -------- arch/riscv/boot/dts/renesas/rzfive-smarc.dtsi | 56 ------------------- 2 files changed, 79 deletions(-)
arch/riscv/boot/dts/renesas/rzfive-smarc-som.dtsi +0 -23
@@ -7,25 +7,8 @@ #include <arm64/renesas/rzg2ul-smarc-som.dtsi> -/ { - aliases { - /delete-property/ ethernet0; - /delete-property/ ethernet1; - }; - - chosen { - bootargs = "ignore_loglevel"; - }; -}; - -&dmac { - status = "disabled"; -}; - #if (!SW_ET0_EN_N) ð0 { - status = "disabled"; - phy0: ethernet-phy@7 { /delete-property/ interrupt-parent; /delete-property/ interrupts;
@@ -34,14 +17,8 @@ phy0: ethernet-phy@7 { #endif ð1 { - status = "disabled"; - phy1: ethernet-phy@7 { /delete-property/ interrupt-parent; /delete-property/ interrupts; }; }; - -&sdhi0 { - status = "disabled"; -};
arch/riscv/boot/dts/renesas/rzfive-smarc.dtsi +0 -56
59 lines not on this page · raw message
Signature · 1 line
2.34.1
Hi!
Ok, so I went through the series, and there's nothing too horrible. I'll have some comments sent to individual patches. I'm not a great fan of 5/, as it touches generic code, but.
Testing did not reveal any breakage... which is not surprising as we don't test r-v at the moment.
Quoted 2 lines
Sending this series as an RFC mainly beacuse, as the kernel image is not generic to all RISC-V platforms as the HW is noncoherent.
I don't understand the "image is not generic". I see the hw is buggy and needs the workarounds provided in the series, but kernel configured for your hw should work elsewhere, too (slowly), no?
Quoted 1 line
Complete defconfig file for RZ/Five can be found at [0].
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Hi Pavel,
Thank you for the review.
Quoted 6 lines
Hi!
Ok, so I went through the series, and there's nothing too horrible. I'll have some comments sent to individual patches. I'm not a great fan of 5/, as it touches generic code, but.
Quoted 8 lines
Testing did not reveal any breakage... which is not surprising as we don't test r-v at the moment.
Quoted 2 lines
Sending this series as an RFC mainly beacuse, as the kernel image is not generic to all RISC-V platforms as the HW is noncoherent.
I don't understand the "image is not generic". I see the hw is buggy and needs the workarounds provided in the series, but kernel configured for your hw should work elsewhere, too (slowly), no?
For the noncoherent issue we carve out a chunk of memory from DDR (done by OpenSBI) as shared-dma-pool, below is the node passed to Linux
reserved-memory {
#address-cells = <2>;
#size-cells = <2>;
ranges;
pma_resv0@58000000 {
compatible = "shared-dma-pool";
reg = <0x0 0x58000000 0x0 0x08000000>;
no-map;
linux,dma-default;
};
};In Linux we enable DMA_GLOBAL_POOL config, so that all dma'ble memory requests happens only through this region. The DMA_GLOBAL_POOL config is compile time check rather than a runtime check [0] so for non-coherent platforms for example which want to use DMA_DIRECT_REMAP config the image built for RZ/Five wont work.
Cheers,
Prabhakar
Quoted 7 lines
Quoted 1 line
Complete defconfig file for RZ/Five can be found at [0].
Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Hi!
Quoted 2 lines
Sending this series as an RFC mainly beacuse, as the kernel image is not generic to all RISC-V platforms as the HW is noncoherent.
Does the hardware also have the "low memory does not work in userspace" problem? How is that handled?
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Hi,
Quoted 7 lines
Hi!
Quoted 2 lines
Sending this series as an RFC mainly beacuse, as the kernel image is not generic to all RISC-V platforms as the HW is noncoherent.
Does the hardware also have the "low memory does not work in userspace" problem? How is that handled?
For the local memory issues (ILM/DLM (Instruction/Data local memory)) we will need a similar patch [0] to cip-isar-core. Note the cip-isar-core image built with this change [0] can be used on other RISC-V platforms.
https://github.com/prabhakarlad/meta-riscv/commit/da749379155980d1f906d8632432f35a01a9c9a1
Cheers,
Prabhakar
Quoted 4 lines · Prabhakar Mahadev Lad
Hi,
Quoted 2 lines
Hi!
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines
Sending this series as an RFC mainly beacuse, as the kernel image is not generic to all RISC-V platforms as the HW is noncoherent.
Does the hardware also have the "low memory does not work in userspace" problem? How is that handled?
For the local memory issues (ILM/DLM (Instruction/Data local memory)) we will need a similar patch [0] to cip-isar-core. Note the cip-isar-core image built with this change [0] can be used on other RISC-V platforms.
https://github.com/prabhakarlad/meta-riscv/commit/da749379155980d1f906d8632432f35a01a9c9a1
Just to emphasize this (again):
Debian is not Yocto, buildroot or Gentoo, and we are not done by patching and rebuilding the toolchain. Unless you can also provide a reasonably short list of packages that require rebuilding after that patch is applied to binutils, it will not be practically feasible to address this hardware design issue via something like isar-cip-core.
It would be better - not only having Debian but also other distros in mind - to look for a kernel/firmware-based workaround, even if ugly and potentially slower.
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center
Hello Jan,
Quoted 30 lines
From: [email protected] <[email protected]> On Behalf Of Jan Kiszka via lists.cip-project.org
Sent: Tuesday, January 2, 2024 8:09 AMQuoted 8 lines · Prabhakar Mahadev Lad
Hi,
Quoted 6 lines
Hi!
Quoted 2 lines
Sending this series as an RFC mainly beacuse, as the kernel image is not generic to all RISC-V platforms as the HW is noncoherent.
Does the hardware also have the "low memory does not work in
userspace" problem? How is that handled?
Quoted 2 lines
Quoted 1 line
For the local memory issues (ILM/DLM (Instruction/Data local memory)) we
will need a similar patch [0] to cip-isar-core. Note the cip-isar-core image built with this change [0] can be used on other RISC-V platforms.
Quoted 2 lines
https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithu
b.com%2Fprabhakarlad%2Fmeta- riscv%2Fcommit%2Fda749379155980d1f906d8632432f35a01a9c9a1&data=05 %7C02%7Cchris.paterson2%40renesas.com%7Ca5d360a701164419501808dc0 b6a1e2b%7C53d82571da1947e49cb4625a166a4a2a%7C0%7C0%7C6383977975 99811411%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoi V2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=dY DnQGyt5JgcvbN2tCqYh7Ba6Tt8vEKooUjU0qBJ2do%3D&reserved=0Quoted 1 line
Quoted 7 lines
Just to emphasize this (again):
Debian is not Yocto, buildroot or Gentoo, and we are not done by patching and rebuilding the toolchain. Unless you can also provide a reasonably short list of packages that require rebuilding after that patch is applied to binutils, it will not be practically feasible to address this hardware design issue via something like isar-cip-core.
Perhaps we can come up with a small list of packages, at least to get CIP core working.
If this is the case, would CIP want to compile these packages separately as part of isar-cip-core builds? Or would we (Renesas) need to compile them separately and pull them in during a normal isar-cip-core build?
I seem to remember you saying that RISC-V cross-compilation for Debian is broken. Do you know if this is still the case?
So perhaps some options for now, in order:
1) Add support for RZ/Five to linux-cip and don't test at all
2) Add support for RZ/Five to linux-cip and rely on Renesas' internal CI to test (similar to other non-official CIP reference platforms from Renesas)
3) Add support for RZ/Five to linux-cip and run limited testing with Renesas' Poky BSP
4a) Add support for RZ/Five to linux-cip, Renesas compiles binutils etc. specifically for RZ/Five, isar-cip-core pulls in the Renesas packages specifically for RZ/Five, or 4b) Add support for RZ/Five to linux-cip, patch isar-cip-core to compile binutils etc. specifically for RZ/Five
Options 1-3 would mean RZ/Five would _not_ become an official CIP reference platform. Option 4 _may_ open up the possibility for RZ/Five to become an official reference platform.
I'd at least like to get 1-2, perhaps 3 working in the short term based on this RFC series, if there are no objections from the CIP maintainers.
Quoted 4 lines
It would be better - not only having Debian but also other distros in mind - to look for a
kernel/firmware-basedworkaround, even if ugly and potentially slower.
It probably would be better, however sadly we haven't been able to come up with such a workaround.
Kind regards, Chris
Quoted 6 lines
Jan
--
Siemens AG, Technology
Linux Expert Center
Quoted 40 lines · Chris Paterson
Hello Jan,
Quoted 30 lines
From: [email protected] <[email protected]> On Behalf Of Jan Kiszka via lists.cip-project.org
Sent: Tuesday, January 2, 2024 8:09 AMQuoted 8 lines · Prabhakar Mahadev Lad
Hi,
Quoted 6 lines
Hi!
Quoted 2 lines
Sending this series as an RFC mainly beacuse, as the kernel image is not generic to all RISC-V platforms as the HW is noncoherent.
Does the hardware also have the "low memory does not work in
userspace" problem? How is that handled?
Quoted 2 lines
Quoted 1 line
For the local memory issues (ILM/DLM (Instruction/Data local memory)) we
will need a similar patch [0] to cip-isar-core. Note the cip-isar-core image built with this change [0] can be used on other RISC-V platforms.
Quoted 2 lines
https://githu
b.com%2Fprabhakarlad%2Fmeta- riscv%2Fcommit%2Fda749379155980d1f906d8632432f35a01a9c9a1&data=05 %7C02%7Cchris.paterson2%40renesas.com%7Ca5d360a701164419501808dc0 b6a1e2b%7C53d82571da1947e49cb4625a166a4a2a%7C0%7C0%7C6383977975 99811411%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoi V2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=dY DnQGyt5JgcvbN2tCqYh7Ba6Tt8vEKooUjU0qBJ2do%3D&reserved=0Quoted 1 line
Quoted 7 lines
Just to emphasize this (again):
Debian is not Yocto, buildroot or Gentoo, and we are not done by patching and rebuilding the toolchain. Unless you can also provide a reasonably short list of packages that require rebuilding after that patch is applied to binutils, it will not be practically feasible to address this hardware design issue via something like isar-cip-core.
Quoted 4 lines
Perhaps we can come up with a small list of packages, at least to get CIP core working.
If this is the case, would CIP want to compile these packages separately as part of isar-cip-core builds? Or would we (Renesas) need to compile them separately and pull them in during a normal isar-cip-core build?
Depends on the length of the list and size (build-time) of the packages.
Quoted 1 line
I seem to remember you saying that RISC-V cross-compilation for Debian is broken. Do you know if this is still the case?
I worked around the issue for now, waiting for review:
https://groups.google.com/g/isar-users/c/0QBjhzcs3ac
Once isar accepted it, isar-cip-core will pick it up quickly.
Quoted 11 lines
So perhaps some options for now, in order:
1) Add support for RZ/Five to linux-cip and don't test at all
2) Add support for RZ/Five to linux-cip and rely on Renesas' internal CI to test (similar to other non-official CIP reference platforms from Renesas)
3) Add support for RZ/Five to linux-cip and run limited testing with Renesas' Poky BSP
4a) Add support for RZ/Five to linux-cip, Renesas compiles binutils etc. specifically for RZ/Five, isar-cip-core pulls in the Renesas packages specifically for RZ/Five, or 4b) Add support for RZ/Five to linux-cip, patch isar-cip-core to compile binutils etc. specifically for RZ/FiveOptions 1-3 would mean RZ/Five would _not_ become an official CIP reference platform. Option 4 _may_ open up the possibility for RZ/Five to become an official reference platform.
Quoted 8 lines
I'd at least like to get 1-2, perhaps 3 working in the short term based on this RFC series, if there are no objections from the CIP maintainers.
Quoted 4 lines
It would be better - not only having Debian but also other distros in mind - to look for a
kernel/firmware-basedworkaround, even if ugly and potentially slower.It probably would be better, however sadly we haven't been able to come up with such a workaround.
Is there information missing when an access to the invalid virtual address happens, or is the implementation of a complete instruction emulator not realistic?
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center
Hi,
Quoted 84 lines · Chris Paterson
Quoted 35 lines
Hello Jan,
Quoted 33 lines
From: [email protected] <[email protected]> On Behalf Of Jan Kiszka via lists.cip-project.org
Sent: Tuesday, January 2, 2024 8:09 AMQuoted 8 lines · Prabhakar Mahadev Lad
Hi,
Quoted 6 lines
Hi!
Quoted 2 lines
Sending this series as an RFC mainly beacuse, as the kernel image is not generic to all RISC-V platforms as the HW is noncoherent.
Does the hardware also have the "low memory does not work in
userspace" problem? How is that handled?
Quoted 3 lines
Quoted 1 line
For the local memory issues (ILM/DLM (Instruction/Data local memory)) we
will need a similar patch [0] to cip-isar-core. Note the
cip-isar-core image built with this change [0] can be used on other RISC-V platforms.Quoted 2 lines
https://githu
b.com%2Fprabhakarlad%2Fmeta- riscv%2Fcommit%2Fda749379155980d1f906d8632432f35a01a9c9a1&data=05 %7C02%7Cchris.paterson2%40renesas.com%7Ca5d360a701164419501808dc0 b6a1e2b%7C53d82571da1947e49cb4625a166a4a2a%7C0%7C0%7C6383977975 99811411%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoi V2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=dY DnQGyt5JgcvbN2tCqYh7Ba6Tt8vEKooUjU0qBJ2do%3D&reserved=0Quoted 1 line
Just to emphasize this (again):
Quoted 8 lines
Quoted 5 lines
Debian is not Yocto, buildroot or Gentoo, and we are not done by patching and rebuilding the toolchain. Unless you can also provide a reasonably short list of packages that require rebuilding after that patch is applied to binutils, it will not be practically feasible to address this hardware design issue via something like isar-cip-core.
Perhaps we can come up with a small list of packages, at least to get CIP core working. If this is the case, would CIP want to compile these packages separately as part of isar-cip-core
builds?
Quoted 1 line
Or would we (Renesas) need to compile them separately and pull them in during a normal isar-cip-core
build?
Quoted 1 line
Depends on the length of the list and size (build-time) of the packages.
Quoted 1 line
I seem to remember you saying that RISC-V cross-compilation for Debian is broken. Do you know if
this is still the case?
I worked around the issue for now, waiting for review:
https://groups.google.com/g/isar-
users%2Fc%2F0QBjhzcs3ac&data=05%7C02%7Cprabhakar.mahadev- lad.rj%40bp.renesas.com%7C5eea955a6b3e43edc6f108dc0bb17ec1%7C53d82571da1947e49cb4625a166a4a2a%7C0%7C0% 7C638398104168344805%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXV CI6Mn0%3D%7C3000%7C%7C%7C&sdata=3BOCfdyyKWJJtw1KF21pMIaZpuEoZoOSEG4JXKd7oLc%3D&reserved=0Once isar accepted it, isar-cip-core will pick it up quickly.
Quoted 14 lines
So perhaps some options for now, in order:
1) Add support for RZ/Five to linux-cip and don't test at all
2) Add support for RZ/Five to linux-cip and rely on Renesas' internal CI to test (similar to other non-official CIP reference platforms from Renesas)
3) Add support for RZ/Five to linux-cip and run limited testing with Renesas' Poky BSP
4a) Add support for RZ/Five to linux-cip, Renesas compiles binutils etc. specifically for RZ/Five, isar-cip-core pulls in the Renesas packages specifically for RZ/Five, or
4b) Add support for RZ/Five to linux-cip, patch isar-cip-core to compile binutils etc. specifically for RZ/FiveQuoted 4 lines
Options 1-3 would mean RZ/Five would _not_ become an official CIP reference platform. Option 4 _may_ open up the possibility for RZ/Five to become an official reference platform.
I'd at least like to get 1-2, perhaps 3 working in the short term based on this RFC series, if there
are no objections from the CIP maintainers.
Quoted 2 lines
Quoted 2 lines
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
It would be better - not only having Debian but also other distros in mind - to look for a
kernel/firmware-basedworkaround, even if ugly and potentially slower.It probably would be better, however sadly we haven't been able to come up with such a workaround.
Is there information missing when an access to the invalid virtual address happens, or is the implementation of a complete instruction emulator not realistic?
The virtual address here is valid, its just that it doesn't go through the cache/MMU therefore the virtual address matches physical address. (This happens for region 0x30000 - 0x4ffff hence we shifted to the start address to 0x50000 in binutils as pointed previously)
Can you please elaborate on "implementation of a complete instruction emulator not realistic?"
Cheers,
Prabhakar
Quoted 90 lines · Prabhakar Mahadev Lad
Hi,
Quoted 88 lines · Chris Paterson
Quoted 35 lines
Hello Jan,
Quoted 33 lines
From: [email protected] <[email protected]> On Behalf Of Jan Kiszka via lists.cip-project.org
Sent: Tuesday, January 2, 2024 8:09 AMQuoted 8 lines · Prabhakar Mahadev Lad
Hi,
Quoted 6 lines
Hi!
Quoted 2 lines
Sending this series as an RFC mainly beacuse, as the kernel image is not generic to all RISC-V platforms as the HW is noncoherent.
Does the hardware also have the "low memory does not work in
userspace" problem? How is that handled?
Quoted 3 lines
Quoted 1 line
For the local memory issues (ILM/DLM (Instruction/Data local memory)) we
will need a similar patch [0] to cip-isar-core. Note the
cip-isar-core image built with this change [0] can be used on other RISC-V platforms.Quoted 2 lines
https://githu
b.com%2Fprabhakarlad%2Fmeta- riscv%2Fcommit%2Fda749379155980d1f906d8632432f35a01a9c9a1&data=05 %7C02%7Cchris.paterson2%40renesas.com%7Ca5d360a701164419501808dc0 b6a1e2b%7C53d82571da1947e49cb4625a166a4a2a%7C0%7C0%7C6383977975 99811411%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoi V2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=dY DnQGyt5JgcvbN2tCqYh7Ba6Tt8vEKooUjU0qBJ2do%3D&reserved=0Quoted 1 line
Just to emphasize this (again):
Quoted 8 lines
Quoted 5 lines
Debian is not Yocto, buildroot or Gentoo, and we are not done by patching and rebuilding the toolchain. Unless you can also provide a reasonably short list of packages that require rebuilding after that patch is applied to binutils, it will not be practically feasible to address this hardware design issue via something like isar-cip-core.
Perhaps we can come up with a small list of packages, at least to get CIP core working. If this is the case, would CIP want to compile these packages separately as part of isar-cip-core
builds?
Quoted 1 line
Or would we (Renesas) need to compile them separately and pull them in during a normal isar-cip-core
build?
Quoted 1 line
Depends on the length of the list and size (build-time) of the packages.
Quoted 1 line
I seem to remember you saying that RISC-V cross-compilation for Debian is broken. Do you know if
this is still the case?
I worked around the issue for now, waiting for review:
https://groups.google.com/g/isar-
users%2Fc%2F0QBjhzcs3ac&data=05%7C02%7Cprabhakar.mahadev- lad.rj%40bp.renesas.com%7C5eea955a6b3e43edc6f108dc0bb17ec1%7C53d82571da1947e49cb4625a166a4a2a%7C0%7C0% 7C638398104168344805%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXV CI6Mn0%3D%7C3000%7C%7C%7C&sdata=3BOCfdyyKWJJtw1KF21pMIaZpuEoZoOSEG4JXKd7oLc%3D&reserved=0Once isar accepted it, isar-cip-core will pick it up quickly.
Quoted 14 lines
So perhaps some options for now, in order:
1) Add support for RZ/Five to linux-cip and don't test at all
2) Add support for RZ/Five to linux-cip and rely on Renesas' internal CI to test (similar to other non-official CIP reference platforms from Renesas)
3) Add support for RZ/Five to linux-cip and run limited testing with Renesas' Poky BSP
4a) Add support for RZ/Five to linux-cip, Renesas compiles binutils etc. specifically for RZ/Five, isar-cip-core pulls in the Renesas packages specifically for RZ/Five, or
4b) Add support for RZ/Five to linux-cip, patch isar-cip-core to compile binutils etc. specifically for RZ/FiveQuoted 4 lines
Options 1-3 would mean RZ/Five would _not_ become an official CIP reference platform. Option 4 _may_ open up the possibility for RZ/Five to become an official reference platform.
I'd at least like to get 1-2, perhaps 3 working in the short term based on this RFC series, if there
are no objections from the CIP maintainers.
Quoted 6 lines
Quoted 5 lines
It would be better - not only having Debian but also other distros in mind - to look for a
kernel/firmware-basedworkaround, even if ugly and potentially slower.
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
It probably would be better, however sadly we haven't been able to come up with such a workaround.
Is there information missing when an access to the invalid virtual address happens, or is the implementation of a complete instruction emulator not realistic?
The virtual address here is valid, its just that it doesn't go through the cache/MMU therefore the virtual address matches physical address. (This happens for region
0x30000-0x4ffffhence we shifted to the start address to0x50000in binutils as pointed previously)
So it's not valid for userspace because it can't be used in reality.
Quoted 2 lines
Can you please elaborate on "implementation of a complete instruction emulator not realistic?"
Given that the MMU is not respected for those magic virtual addresses, the only way to permit userspace to use them is trap-and-emulate: If userspace reads/writes from the virtual=physical address, emulate those accesses. Same when it places code into that region. That's similar to MMIO access emulation under KVM, rather more like early real mode emulation in KVM on x86 CPUs that didn't support real mode in VMs. Look at what linux/arch/x86/kvm/emulate.c has.
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center