devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: dts: bcm2711: fix soc's node dma-ranges
@ 2019-12-04 12:56 Nicolas Saenz Julienne
  2019-12-06  0:08 ` Florian Fainelli
  2019-12-09 18:12 ` Florian Fainelli
  0 siblings, 2 replies; 6+ messages in thread
From: Nicolas Saenz Julienne @ 2019-12-04 12:56 UTC (permalink / raw)
  To: Rob Herring, Mark Rutland, Eric Anholt, Stefan Wahren, Florian Fanelli
  Cc: mbrugger, phil, Nicolas Saenz Julienne, devicetree,
	bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	linux-kernel

Raspberry Pi's firmware has a feature to select how much memory to
reserve for its GPU called 'gpu_mem'. The possible values go from 16MB
to 944MB, with a default of 64MB. This memory resides in the topmost
part of the lower 1GB memory area and grows bigger expanding towards the
begging of memory.

It turns out that with low 'gpu_mem' values (16MB and 32MB) the size of
the memory available to the system in the lower 1GB area can outgrow the
interconnect's dma-range as its size was selected based on the maximum
system memory available given the default gpu_mem configuration. This
makes that memory slice unavailable for DMA. And may cause nasty kernel
warnings if CMA happens to include it.

Change soc's dma-ranges to really reflect it's HW limitation, which is
being able to only DMA to the lower 1GB area.

Fixes: 7dbe8c62ceeb ("ARM: dts: Add minimal Raspberry Pi 4 support")
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
---

NOTE: I'd appreciate if someone from the RPi foundation commented on
this as it's something that I'll propose to be backported to their tree.

 arch/arm/boot/dts/bcm2711.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/bcm2711.dtsi b/arch/arm/boot/dts/bcm2711.dtsi
index 5b61cd915f2b..d6a0e350b7b4 100644
--- a/arch/arm/boot/dts/bcm2711.dtsi
+++ b/arch/arm/boot/dts/bcm2711.dtsi
@@ -43,7 +43,7 @@ soc {
 			 <0x7c000000  0x0 0xfc000000  0x02000000>,
 			 <0x40000000  0x0 0xff800000  0x00800000>;
 		/* Emulate a contiguous 30-bit address range for DMA */
-		dma-ranges = <0xc0000000  0x0 0x00000000  0x3c000000>;
+		dma-ranges = <0xc0000000  0x0 0x00000000  0x40000000>;
 
 		/*
 		 * This node is the provider for the enable-method for
-- 
2.24.0


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

* Re: [PATCH] ARM: dts: bcm2711: fix soc's node dma-ranges
  2019-12-04 12:56 [PATCH] ARM: dts: bcm2711: fix soc's node dma-ranges Nicolas Saenz Julienne
@ 2019-12-06  0:08 ` Florian Fainelli
  2019-12-06 10:16   ` Phil Elwell
  2019-12-09 18:12 ` Florian Fainelli
  1 sibling, 1 reply; 6+ messages in thread
From: Florian Fainelli @ 2019-12-06  0:08 UTC (permalink / raw)
  To: Nicolas Saenz Julienne, Rob Herring, Mark Rutland, Eric Anholt,
	Stefan Wahren, Florian Fanelli
  Cc: mbrugger, phil, devicetree, bcm-kernel-feedback-list,
	linux-rpi-kernel, linux-arm-kernel, linux-kernel

On 12/4/19 4:56 AM, Nicolas Saenz Julienne wrote:
> Raspberry Pi's firmware has a feature to select how much memory to
> reserve for its GPU called 'gpu_mem'. The possible values go from 16MB
> to 944MB, with a default of 64MB. This memory resides in the topmost
> part of the lower 1GB memory area and grows bigger expanding towards the
> begging of memory.
> 
> It turns out that with low 'gpu_mem' values (16MB and 32MB) the size of
> the memory available to the system in the lower 1GB area can outgrow the
> interconnect's dma-range as its size was selected based on the maximum
> system memory available given the default gpu_mem configuration. This
> makes that memory slice unavailable for DMA. And may cause nasty kernel
> warnings if CMA happens to include it.
> 
> Change soc's dma-ranges to really reflect it's HW limitation, which is
> being able to only DMA to the lower 1GB area.
> 
> Fixes: 7dbe8c62ceeb ("ARM: dts: Add minimal Raspberry Pi 4 support")
> Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
> ---
> 
> NOTE: I'd appreciate if someone from the RPi foundation commented on
> this as it's something that I'll propose to be backported to their tree.

I don't think our additional DTS changes will be merged until -rc1 is
cut, so we have some time to figure this one out. Thanks

> 
>  arch/arm/boot/dts/bcm2711.dtsi | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boot/dts/bcm2711.dtsi b/arch/arm/boot/dts/bcm2711.dtsi
> index 5b61cd915f2b..d6a0e350b7b4 100644
> --- a/arch/arm/boot/dts/bcm2711.dtsi
> +++ b/arch/arm/boot/dts/bcm2711.dtsi
> @@ -43,7 +43,7 @@ soc {
>  			 <0x7c000000  0x0 0xfc000000  0x02000000>,
>  			 <0x40000000  0x0 0xff800000  0x00800000>;
>  		/* Emulate a contiguous 30-bit address range for DMA */
> -		dma-ranges = <0xc0000000  0x0 0x00000000  0x3c000000>;
> +		dma-ranges = <0xc0000000  0x0 0x00000000  0x40000000>;
>  
>  		/*
>  		 * This node is the provider for the enable-method for
> 


-- 
Florian

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

* Re: [PATCH] ARM: dts: bcm2711: fix soc's node dma-ranges
  2019-12-06  0:08 ` Florian Fainelli
@ 2019-12-06 10:16   ` Phil Elwell
  2019-12-06 18:13     ` Florian Fainelli
  0 siblings, 1 reply; 6+ messages in thread
From: Phil Elwell @ 2019-12-06 10:16 UTC (permalink / raw)
  To: Florian Fainelli, Nicolas Saenz Julienne, Rob Herring,
	Mark Rutland, Eric Anholt, Stefan Wahren
  Cc: mbrugger, devicetree, bcm-kernel-feedback-list, linux-rpi-kernel,
	linux-arm-kernel, linux-kernel

Hi Nicolas,

On 06/12/2019 00:08, Florian Fainelli wrote:
> On 12/4/19 4:56 AM, Nicolas Saenz Julienne wrote:
>> Raspberry Pi's firmware has a feature to select how much memory to
>> reserve for its GPU called 'gpu_mem'. The possible values go from 16MB
>> to 944MB, with a default of 64MB. This memory resides in the topmost
>> part of the lower 1GB memory area and grows bigger expanding towards the
>> begging of memory.
>>
>> It turns out that with low 'gpu_mem' values (16MB and 32MB) the size of
>> the memory available to the system in the lower 1GB area can outgrow the
>> interconnect's dma-range as its size was selected based on the maximum
>> system memory available given the default gpu_mem configuration. This
>> makes that memory slice unavailable for DMA. And may cause nasty kernel
>> warnings if CMA happens to include it.
>>
>> Change soc's dma-ranges to really reflect it's HW limitation, which is
>> being able to only DMA to the lower 1GB area.
>>
>> Fixes: 7dbe8c62ceeb ("ARM: dts: Add minimal Raspberry Pi 4 support")
>> Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
>> ---
>>
>> NOTE: I'd appreciate if someone from the RPi foundation commented on
>> this as it's something that I'll propose to be backported to their tree.

The 0x3c000000 size was a mistake that arose from c0000000 + 3c000000 = 
fc000000, but that is mixing apples and oranges (actually DMA addresses
and host physical addresses). Please correct it as you are proposing.

> 
> I don't think our additional DTS changes will be merged until -rc1 is
> cut, so we have some time to figure this one out. Thanks
> 
>>
>>   arch/arm/boot/dts/bcm2711.dtsi | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/boot/dts/bcm2711.dtsi b/arch/arm/boot/dts/bcm2711.dtsi
>> index 5b61cd915f2b..d6a0e350b7b4 100644
>> --- a/arch/arm/boot/dts/bcm2711.dtsi
>> +++ b/arch/arm/boot/dts/bcm2711.dtsi
>> @@ -43,7 +43,7 @@ soc {
>>   			 <0x7c000000  0x0 0xfc000000  0x02000000>,
>>   			 <0x40000000  0x0 0xff800000  0x00800000>;
>>   		/* Emulate a contiguous 30-bit address range for DMA */
>> -		dma-ranges = <0xc0000000  0x0 0x00000000  0x3c000000>;
>> +		dma-ranges = <0xc0000000  0x0 0x00000000  0x40000000>;
>>   
>>   		/*
>>   		 * This node is the provider for the enable-method for
>>
> 
> 

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

* Re: [PATCH] ARM: dts: bcm2711: fix soc's node dma-ranges
  2019-12-06 10:16   ` Phil Elwell
@ 2019-12-06 18:13     ` Florian Fainelli
  2019-12-09  9:16       ` Phil Elwell
  0 siblings, 1 reply; 6+ messages in thread
From: Florian Fainelli @ 2019-12-06 18:13 UTC (permalink / raw)
  To: Phil Elwell, Florian Fainelli, Nicolas Saenz Julienne,
	Rob Herring, Mark Rutland, Eric Anholt, Stefan Wahren
  Cc: mbrugger, devicetree, bcm-kernel-feedback-list, linux-rpi-kernel,
	linux-arm-kernel, linux-kernel

On 12/6/19 2:16 AM, Phil Elwell wrote:
> Hi Nicolas,
> 
> On 06/12/2019 00:08, Florian Fainelli wrote:
>> On 12/4/19 4:56 AM, Nicolas Saenz Julienne wrote:
>>> Raspberry Pi's firmware has a feature to select how much memory to
>>> reserve for its GPU called 'gpu_mem'. The possible values go from 16MB
>>> to 944MB, with a default of 64MB. This memory resides in the topmost
>>> part of the lower 1GB memory area and grows bigger expanding towards the
>>> begging of memory.
>>>
>>> It turns out that with low 'gpu_mem' values (16MB and 32MB) the size of
>>> the memory available to the system in the lower 1GB area can outgrow the
>>> interconnect's dma-range as its size was selected based on the maximum
>>> system memory available given the default gpu_mem configuration. This
>>> makes that memory slice unavailable for DMA. And may cause nasty kernel
>>> warnings if CMA happens to include it.
>>>
>>> Change soc's dma-ranges to really reflect it's HW limitation, which is
>>> being able to only DMA to the lower 1GB area.
>>>
>>> Fixes: 7dbe8c62ceeb ("ARM: dts: Add minimal Raspberry Pi 4 support")
>>> Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
>>> ---
>>>
>>> NOTE: I'd appreciate if someone from the RPi foundation commented on
>>> this as it's something that I'll propose to be backported to their tree.
> 
> The 0x3c000000 size was a mistake that arose from c0000000 + 3c000000 =
> fc000000, but that is mixing apples and oranges (actually DMA addresses
> and host physical addresses). Please correct it as you are proposing.

Do you want to add an Acked-by or Reviewed-by tag to make this statement
official?
-- 
Florian

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

* Re: [PATCH] ARM: dts: bcm2711: fix soc's node dma-ranges
  2019-12-06 18:13     ` Florian Fainelli
@ 2019-12-09  9:16       ` Phil Elwell
  0 siblings, 0 replies; 6+ messages in thread
From: Phil Elwell @ 2019-12-09  9:16 UTC (permalink / raw)
  To: Florian Fainelli, Nicolas Saenz Julienne, Rob Herring,
	Mark Rutland, Eric Anholt, Stefan Wahren
  Cc: mbrugger, devicetree, bcm-kernel-feedback-list, linux-rpi-kernel,
	linux-arm-kernel, linux-kernel

On 06/12/2019 18:13, Florian Fainelli wrote:
> On 12/6/19 2:16 AM, Phil Elwell wrote:
>> Hi Nicolas,
>>
>> On 06/12/2019 00:08, Florian Fainelli wrote:
>>> On 12/4/19 4:56 AM, Nicolas Saenz Julienne wrote:
>>>> Raspberry Pi's firmware has a feature to select how much memory to
>>>> reserve for its GPU called 'gpu_mem'. The possible values go from 16MB
>>>> to 944MB, with a default of 64MB. This memory resides in the topmost
>>>> part of the lower 1GB memory area and grows bigger expanding towards the
>>>> begging of memory.
>>>>
>>>> It turns out that with low 'gpu_mem' values (16MB and 32MB) the size of
>>>> the memory available to the system in the lower 1GB area can outgrow the
>>>> interconnect's dma-range as its size was selected based on the maximum
>>>> system memory available given the default gpu_mem configuration. This
>>>> makes that memory slice unavailable for DMA. And may cause nasty kernel
>>>> warnings if CMA happens to include it.
>>>>
>>>> Change soc's dma-ranges to really reflect it's HW limitation, which is
>>>> being able to only DMA to the lower 1GB area.
>>>>
>>>> Fixes: 7dbe8c62ceeb ("ARM: dts: Add minimal Raspberry Pi 4 support")
>>>> Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
>>>> ---
>>>>
>>>> NOTE: I'd appreciate if someone from the RPi foundation commented on
>>>> this as it's something that I'll propose to be backported to their tree.
>>
>> The 0x3c000000 size was a mistake that arose from c0000000 + 3c000000 =
>> fc000000, but that is mixing apples and oranges (actually DMA addresses
>> and host physical addresses). Please correct it as you are proposing.
> 
> Do you want to add an Acked-by or Reviewed-by tag to make this statement
> official?

Here you go:

Reviewed-by: Phil Elwell <phil@raspberrypi.org>

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

* Re: [PATCH] ARM: dts: bcm2711: fix soc's node dma-ranges
  2019-12-04 12:56 [PATCH] ARM: dts: bcm2711: fix soc's node dma-ranges Nicolas Saenz Julienne
  2019-12-06  0:08 ` Florian Fainelli
@ 2019-12-09 18:12 ` Florian Fainelli
  1 sibling, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2019-12-09 18:12 UTC (permalink / raw)
  To: bcm-kernel-feedback-list, Nicolas Saenz Julienne, Rob Herring,
	Mark Rutland, Eric Anholt, Stefan Wahren
  Cc: mbrugger, phil, devicetree, linux-rpi-kernel, linux-arm-kernel,
	linux-kernel

On Wed,  4 Dec 2019 13:56:33 +0100, Nicolas Saenz Julienne <nsaenzjulienne@suse.de> wrote:
> Raspberry Pi's firmware has a feature to select how much memory to
> reserve for its GPU called 'gpu_mem'. The possible values go from 16MB
> to 944MB, with a default of 64MB. This memory resides in the topmost
> part of the lower 1GB memory area and grows bigger expanding towards the
> begging of memory.
> 
> It turns out that with low 'gpu_mem' values (16MB and 32MB) the size of
> the memory available to the system in the lower 1GB area can outgrow the
> interconnect's dma-range as its size was selected based on the maximum
> system memory available given the default gpu_mem configuration. This
> makes that memory slice unavailable for DMA. And may cause nasty kernel
> warnings if CMA happens to include it.
> 
> Change soc's dma-ranges to really reflect it's HW limitation, which is
> being able to only DMA to the lower 1GB area.
> 
> Fixes: 7dbe8c62ceeb ("ARM: dts: Add minimal Raspberry Pi 4 support")
> Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
> ---

Applied to devicetree/fixes, thanks!
--
Florian

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

end of thread, other threads:[~2019-12-09 18:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-04 12:56 [PATCH] ARM: dts: bcm2711: fix soc's node dma-ranges Nicolas Saenz Julienne
2019-12-06  0:08 ` Florian Fainelli
2019-12-06 10:16   ` Phil Elwell
2019-12-06 18:13     ` Florian Fainelli
2019-12-09  9:16       ` Phil Elwell
2019-12-09 18:12 ` Florian Fainelli

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