linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] soc: renesas: make ARCH_R9A07G043 (riscv version) depend on NONPORTABLE
@ 2023-10-04 15:08 Jisheng Zhang
  2023-10-04 15:27 ` Robin Murphy
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Jisheng Zhang @ 2023-10-04 15:08 UTC (permalink / raw)
  To: Geert Uytterhoeven, Magnus Damm, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Lad Prabhakar
  Cc: linux-renesas-soc, linux-kernel, linux-riscv, Robin Murphy,
	Christoph Hellwig, Drew Fustini

Drew found "CONFIG_DMA_GLOBAL_POOL=y causes ADMA buffer alloc to fail"
the log looks like:
[    3.741083] mmc0: Unable to allocate ADMA buffers - falling back to standard DMA

The logic is: generic riscv defconfig selects ARCH_RENESAS then
ARCH_R9A07G043 which selects DMA_GLOBAL_POOL, which assumes all
non-dma-coherent riscv platforms have a dma global pool, this assumption
seems not correct. And I believe DMA_GLOBAL_POOL should not be
selected by ARCH_SOCFAMILIY, instead, only ARCH under some specific
conditions can select it globaly, for example NOMMU ARM and so on,
because it's designed for special cases such as "nommu cases where
non-cacheable memory lives in a fixed place in the physical address
map" as pointed out by Robin.

Fix the issue by making ARCH_R9A07G043 (riscv version) depend on
NONPORTABLE, thus generic defconfig won't select ARCH_R9A07G043 by
default. And even for random config case, there will be less debug
effort once we see NONPORTABLE is enabled.

Reported-by: Drew Fustini <dfustini@baylibre.com>
Closes: https://lore.kernel.org/linux-riscv/ZRuamJuShOnvP1pr@x1/
Fixes: 484861e09f3e ("soc: renesas: Kconfig: Select the required configs for RZ/Five SoC")
Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
---
 drivers/soc/renesas/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/soc/renesas/Kconfig b/drivers/soc/renesas/Kconfig
index 5a75ab64d1ed..12040ce116a5 100644
--- a/drivers/soc/renesas/Kconfig
+++ b/drivers/soc/renesas/Kconfig
@@ -333,6 +333,7 @@ if RISCV
 
 config ARCH_R9A07G043
 	bool "RISC-V Platform support for RZ/Five"
+	depends on NONPORTABLE
 	select ARCH_RZG2L
 	select AX45MP_L2_CACHE if RISCV_DMA_NONCOHERENT
 	select DMA_GLOBAL_POOL
-- 
2.40.1


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

* Re: [PATCH] soc: renesas: make ARCH_R9A07G043 (riscv version) depend on NONPORTABLE
  2023-10-04 15:08 [PATCH] soc: renesas: make ARCH_R9A07G043 (riscv version) depend on NONPORTABLE Jisheng Zhang
@ 2023-10-04 15:27 ` Robin Murphy
  2023-10-04 17:42 ` Drew Fustini
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Robin Murphy @ 2023-10-04 15:27 UTC (permalink / raw)
  To: Jisheng Zhang, Geert Uytterhoeven, Magnus Damm, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Lad Prabhakar
  Cc: linux-renesas-soc, linux-kernel, linux-riscv, Christoph Hellwig,
	Drew Fustini

On 04/10/2023 4:08 pm, Jisheng Zhang wrote:
> Drew found "CONFIG_DMA_GLOBAL_POOL=y causes ADMA buffer alloc to fail"
> the log looks like:
> [    3.741083] mmc0: Unable to allocate ADMA buffers - falling back to standard DMA
> 
> The logic is: generic riscv defconfig selects ARCH_RENESAS then
> ARCH_R9A07G043 which selects DMA_GLOBAL_POOL, which assumes all
> non-dma-coherent riscv platforms have a dma global pool, this assumption
> seems not correct. And I believe DMA_GLOBAL_POOL should not be
> selected by ARCH_SOCFAMILIY, instead, only ARCH under some specific
> conditions can select it globaly, for example NOMMU ARM and so on,
> because it's designed for special cases such as "nommu cases where
> non-cacheable memory lives in a fixed place in the physical address
> map" as pointed out by Robin.
> 
> Fix the issue by making ARCH_R9A07G043 (riscv version) depend on
> NONPORTABLE, thus generic defconfig won't select ARCH_R9A07G043 by
> default. And even for random config case, there will be less debug
> effort once we see NONPORTABLE is enabled.

FWIW,

Reviewed-by: Robin Murphy <robin.murphy@arm.com>

> Reported-by: Drew Fustini <dfustini@baylibre.com>
> Closes: https://lore.kernel.org/linux-riscv/ZRuamJuShOnvP1pr@x1/
> Fixes: 484861e09f3e ("soc: renesas: Kconfig: Select the required configs for RZ/Five SoC")
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> ---
>   drivers/soc/renesas/Kconfig | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/soc/renesas/Kconfig b/drivers/soc/renesas/Kconfig
> index 5a75ab64d1ed..12040ce116a5 100644
> --- a/drivers/soc/renesas/Kconfig
> +++ b/drivers/soc/renesas/Kconfig
> @@ -333,6 +333,7 @@ if RISCV
>   
>   config ARCH_R9A07G043
>   	bool "RISC-V Platform support for RZ/Five"
> +	depends on NONPORTABLE
>   	select ARCH_RZG2L
>   	select AX45MP_L2_CACHE if RISCV_DMA_NONCOHERENT
>   	select DMA_GLOBAL_POOL

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

* Re: [PATCH] soc: renesas: make ARCH_R9A07G043 (riscv version) depend on NONPORTABLE
  2023-10-04 15:08 [PATCH] soc: renesas: make ARCH_R9A07G043 (riscv version) depend on NONPORTABLE Jisheng Zhang
  2023-10-04 15:27 ` Robin Murphy
@ 2023-10-04 17:42 ` Drew Fustini
  2023-10-05  9:19 ` Lad, Prabhakar
  2023-10-05 12:57 ` Geert Uytterhoeven
  3 siblings, 0 replies; 5+ messages in thread
From: Drew Fustini @ 2023-10-04 17:42 UTC (permalink / raw)
  To: Jisheng Zhang
  Cc: Geert Uytterhoeven, Magnus Damm, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Lad Prabhakar, linux-renesas-soc, linux-kernel,
	linux-riscv, Robin Murphy, Christoph Hellwig

On Wed, Oct 04, 2023 at 11:08:56PM +0800, Jisheng Zhang wrote:
> Drew found "CONFIG_DMA_GLOBAL_POOL=y causes ADMA buffer alloc to fail"
> the log looks like:
> [    3.741083] mmc0: Unable to allocate ADMA buffers - falling back to standard DMA
> 
> The logic is: generic riscv defconfig selects ARCH_RENESAS then
> ARCH_R9A07G043 which selects DMA_GLOBAL_POOL, which assumes all
> non-dma-coherent riscv platforms have a dma global pool, this assumption
> seems not correct. And I believe DMA_GLOBAL_POOL should not be
> selected by ARCH_SOCFAMILIY, instead, only ARCH under some specific
> conditions can select it globaly, for example NOMMU ARM and so on,
> because it's designed for special cases such as "nommu cases where
> non-cacheable memory lives in a fixed place in the physical address
> map" as pointed out by Robin.
> 
> Fix the issue by making ARCH_R9A07G043 (riscv version) depend on
> NONPORTABLE, thus generic defconfig won't select ARCH_R9A07G043 by
> default. And even for random config case, there will be less debug
> effort once we see NONPORTABLE is enabled.
> 
> Reported-by: Drew Fustini <dfustini@baylibre.com>
> Closes: https://lore.kernel.org/linux-riscv/ZRuamJuShOnvP1pr@x1/
> Fixes: 484861e09f3e ("soc: renesas: Kconfig: Select the required configs for RZ/Five SoC")
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> ---
>  drivers/soc/renesas/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/soc/renesas/Kconfig b/drivers/soc/renesas/Kconfig
> index 5a75ab64d1ed..12040ce116a5 100644
> --- a/drivers/soc/renesas/Kconfig
> +++ b/drivers/soc/renesas/Kconfig
> @@ -333,6 +333,7 @@ if RISCV
>  
>  config ARCH_R9A07G043
>  	bool "RISC-V Platform support for RZ/Five"
> +	depends on NONPORTABLE
>  	select ARCH_RZG2L
>  	select AX45MP_L2_CACHE if RISCV_DMA_NONCOHERENT
>  	select DMA_GLOBAL_POOL
> -- 
> 2.40.1
> 

Tested-by: Drew Fustini <dfustini@baylibre.com>

With this patch, I can use the defconfig and sdhci-of-dwcmshc driver is
able to use ADMA mode without needing to add shared-dma-pool to dts:

# zcat /proc/config.gz |grep DMA_GLOBAL_POOL
# dtc -I fs /sys/firmware/devicetree/base/ 2>/dev/null |grep pool
# dmesg |grep ADMA
[    3.910269] mmc0: SDHCI controller on ffe7080000.mmc [ffe7080000.mmc] using ADMA 64-bit


Thanks,
Drew

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

* Re: [PATCH] soc: renesas: make ARCH_R9A07G043 (riscv version) depend on NONPORTABLE
  2023-10-04 15:08 [PATCH] soc: renesas: make ARCH_R9A07G043 (riscv version) depend on NONPORTABLE Jisheng Zhang
  2023-10-04 15:27 ` Robin Murphy
  2023-10-04 17:42 ` Drew Fustini
@ 2023-10-05  9:19 ` Lad, Prabhakar
  2023-10-05 12:57 ` Geert Uytterhoeven
  3 siblings, 0 replies; 5+ messages in thread
From: Lad, Prabhakar @ 2023-10-05  9:19 UTC (permalink / raw)
  To: Jisheng Zhang
  Cc: Geert Uytterhoeven, Magnus Damm, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Lad Prabhakar, linux-renesas-soc, linux-kernel,
	linux-riscv, Robin Murphy, Christoph Hellwig, Drew Fustini

On Wed, Oct 4, 2023 at 4:21 PM Jisheng Zhang <jszhang@kernel.org> wrote:
>
> Drew found "CONFIG_DMA_GLOBAL_POOL=y causes ADMA buffer alloc to fail"
> the log looks like:
> [    3.741083] mmc0: Unable to allocate ADMA buffers - falling back to standard DMA
>
> The logic is: generic riscv defconfig selects ARCH_RENESAS then
> ARCH_R9A07G043 which selects DMA_GLOBAL_POOL, which assumes all
> non-dma-coherent riscv platforms have a dma global pool, this assumption
> seems not correct. And I believe DMA_GLOBAL_POOL should not be
> selected by ARCH_SOCFAMILIY, instead, only ARCH under some specific
> conditions can select it globaly, for example NOMMU ARM and so on,
> because it's designed for special cases such as "nommu cases where
> non-cacheable memory lives in a fixed place in the physical address
> map" as pointed out by Robin.
>
> Fix the issue by making ARCH_R9A07G043 (riscv version) depend on
> NONPORTABLE, thus generic defconfig won't select ARCH_R9A07G043 by
> default. And even for random config case, there will be less debug
> effort once we see NONPORTABLE is enabled.
>
> Reported-by: Drew Fustini <dfustini@baylibre.com>
> Closes: https://lore.kernel.org/linux-riscv/ZRuamJuShOnvP1pr@x1/
> Fixes: 484861e09f3e ("soc: renesas: Kconfig: Select the required configs for RZ/Five SoC")
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> ---
>  drivers/soc/renesas/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Cheers,
Prabhakar


> diff --git a/drivers/soc/renesas/Kconfig b/drivers/soc/renesas/Kconfig
> index 5a75ab64d1ed..12040ce116a5 100644
> --- a/drivers/soc/renesas/Kconfig
> +++ b/drivers/soc/renesas/Kconfig
> @@ -333,6 +333,7 @@ if RISCV
>
>  config ARCH_R9A07G043
>         bool "RISC-V Platform support for RZ/Five"
> +       depends on NONPORTABLE
>         select ARCH_RZG2L
>         select AX45MP_L2_CACHE if RISCV_DMA_NONCOHERENT
>         select DMA_GLOBAL_POOL
> --
> 2.40.1
>

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

* Re: [PATCH] soc: renesas: make ARCH_R9A07G043 (riscv version) depend on NONPORTABLE
  2023-10-04 15:08 [PATCH] soc: renesas: make ARCH_R9A07G043 (riscv version) depend on NONPORTABLE Jisheng Zhang
                   ` (2 preceding siblings ...)
  2023-10-05  9:19 ` Lad, Prabhakar
@ 2023-10-05 12:57 ` Geert Uytterhoeven
  3 siblings, 0 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2023-10-05 12:57 UTC (permalink / raw)
  To: Jisheng Zhang
  Cc: Magnus Damm, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Lad Prabhakar, linux-renesas-soc, linux-kernel, linux-riscv,
	Robin Murphy, Christoph Hellwig, Drew Fustini

On Wed, Oct 4, 2023 at 5:21 PM Jisheng Zhang <jszhang@kernel.org> wrote:
> Drew found "CONFIG_DMA_GLOBAL_POOL=y causes ADMA buffer alloc to fail"
> the log looks like:
> [    3.741083] mmc0: Unable to allocate ADMA buffers - falling back to standard DMA
>
> The logic is: generic riscv defconfig selects ARCH_RENESAS then
> ARCH_R9A07G043 which selects DMA_GLOBAL_POOL, which assumes all
> non-dma-coherent riscv platforms have a dma global pool, this assumption
> seems not correct. And I believe DMA_GLOBAL_POOL should not be
> selected by ARCH_SOCFAMILIY, instead, only ARCH under some specific
> conditions can select it globaly, for example NOMMU ARM and so on,
> because it's designed for special cases such as "nommu cases where
> non-cacheable memory lives in a fixed place in the physical address
> map" as pointed out by Robin.
>
> Fix the issue by making ARCH_R9A07G043 (riscv version) depend on
> NONPORTABLE, thus generic defconfig won't select ARCH_R9A07G043 by
> default. And even for random config case, there will be less debug
> effort once we see NONPORTABLE is enabled.
>
> Reported-by: Drew Fustini <dfustini@baylibre.com>
> Closes: https://lore.kernel.org/linux-riscv/ZRuamJuShOnvP1pr@x1/
> Fixes: 484861e09f3e ("soc: renesas: Kconfig: Select the required configs for RZ/Five SoC")
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
I guess this is the right thing to do until a better solution is found.
I.e. will queue in renesas-fixes for v6.6.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

end of thread, other threads:[~2023-10-05 14:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-04 15:08 [PATCH] soc: renesas: make ARCH_R9A07G043 (riscv version) depend on NONPORTABLE Jisheng Zhang
2023-10-04 15:27 ` Robin Murphy
2023-10-04 17:42 ` Drew Fustini
2023-10-05  9:19 ` Lad, Prabhakar
2023-10-05 12:57 ` Geert Uytterhoeven

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).