diff mbox series

[for-4.14,3/3] xen/arm: plat: Allocate as much as possible memory below 1GB for dom0 for RPI

Message ID 20200518113008.15422-4-julien@xen.org (mailing list archive)
State Superseded
Headers show
Series Remove the 1GB limitation on Rasberry Pi 4 | expand

Commit Message

Julien Grall May 18, 2020, 11:30 a.m. UTC
From: Julien Grall <jgrall@amazon.com>

The raspberry PI 4 has devices that can only DMA into the first GB of
the RAM. Therefore we want allocate as much as possible memory below 1GB
for dom0.

Use the recently introduced dma_bitsize field to specify the DMA width
supported.

Signed-off-by: Julien Grall <jgrall@amazon.com>
Reported-by: Corey Minyard <minyard@acm.org>
---
 xen/arch/arm/platforms/brcm-raspberry-pi.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Volodymyr Babchuk May 18, 2020, 8:36 p.m. UTC | #1
Hi Julien,

On Mon, 2020-05-18 at 12:30 +0100, Julien Grall wrote:
> From: Julien Grall <jgrall@amazon.com>
> 
> The raspberry PI 4 has devices that can only DMA into the first GB of
> the RAM. Therefore we want allocate as much as possible memory below 1GB
> for dom0.
> 
> Use the recently introduced dma_bitsize field to specify the DMA width
> supported.
> 
> Signed-off-by: Julien Grall <jgrall@amazon.com>
> Reported-by: Corey Minyard <minyard@acm.org>
> ---
>  xen/arch/arm/platforms/brcm-raspberry-pi.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/xen/arch/arm/platforms/brcm-raspberry-pi.c b/xen/arch/arm/platforms/brcm-raspberry-pi.c
> index b697fa2c6c0e..ad5483437b31 100644
> --- a/xen/arch/arm/platforms/brcm-raspberry-pi.c
> +++ b/xen/arch/arm/platforms/brcm-raspberry-pi.c
> @@ -43,6 +43,7 @@ static const struct dt_device_match rpi4_blacklist_dev[] __initconst =
>  PLATFORM_START(rpi4, "Raspberry Pi 4")
>      .compatible     = rpi4_dt_compat,
>      .blacklist_dev  = rpi4_blacklist_dev,
> +    .dma_bitsize    = 10,

I'm confused. Should it be 30?

>  PLATFORM_END
>  
>  /*
Corey Minyard May 19, 2020, 12:02 a.m. UTC | #2
On Mon, May 18, 2020 at 08:36:08PM +0000, Volodymyr Babchuk wrote:
> Hi Julien,
> 
> On Mon, 2020-05-18 at 12:30 +0100, Julien Grall wrote:
> > From: Julien Grall <jgrall@amazon.com>
> > 
> > The raspberry PI 4 has devices that can only DMA into the first GB of
> > the RAM. Therefore we want allocate as much as possible memory below 1GB
> > for dom0.
> > 
> > Use the recently introduced dma_bitsize field to specify the DMA width
> > supported.
> > 
> > Signed-off-by: Julien Grall <jgrall@amazon.com>
> > Reported-by: Corey Minyard <minyard@acm.org>
> > ---
> >  xen/arch/arm/platforms/brcm-raspberry-pi.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/xen/arch/arm/platforms/brcm-raspberry-pi.c b/xen/arch/arm/platforms/brcm-raspberry-pi.c
> > index b697fa2c6c0e..ad5483437b31 100644
> > --- a/xen/arch/arm/platforms/brcm-raspberry-pi.c
> > +++ b/xen/arch/arm/platforms/brcm-raspberry-pi.c
> > @@ -43,6 +43,7 @@ static const struct dt_device_match rpi4_blacklist_dev[] __initconst =
> >  PLATFORM_START(rpi4, "Raspberry Pi 4")
> >      .compatible     = rpi4_dt_compat,
> >      .blacklist_dev  = rpi4_blacklist_dev,
> > +    .dma_bitsize    = 10,
> 
> I'm confused. Should it be 30?

Indeed it should.  I just tested this series, and Linux fails to boot
with this set to 10.  With it set to 30 it works.

With this set to 30, you can have a:

Tested-by: Corey Minyard <cminyard@mvista.com>

for all three patches.

-corey

> 
> >  PLATFORM_END
> >  
> >  /*
Julien Grall May 19, 2020, 5:06 p.m. UTC | #3
On 18/05/2020 21:36, Volodymyr Babchuk wrote:
> Hi Julien,

Hi,


> On Mon, 2020-05-18 at 12:30 +0100, Julien Grall wrote:
>> From: Julien Grall <jgrall@amazon.com>
>>
>> The raspberry PI 4 has devices that can only DMA into the first GB of
>> the RAM. Therefore we want allocate as much as possible memory below 1GB
>> for dom0.
>>
>> Use the recently introduced dma_bitsize field to specify the DMA width
>> supported.
>>
>> Signed-off-by: Julien Grall <jgrall@amazon.com>
>> Reported-by: Corey Minyard <minyard@acm.org>
>> ---
>>   xen/arch/arm/platforms/brcm-raspberry-pi.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/xen/arch/arm/platforms/brcm-raspberry-pi.c b/xen/arch/arm/platforms/brcm-raspberry-pi.c
>> index b697fa2c6c0e..ad5483437b31 100644
>> --- a/xen/arch/arm/platforms/brcm-raspberry-pi.c
>> +++ b/xen/arch/arm/platforms/brcm-raspberry-pi.c
>> @@ -43,6 +43,7 @@ static const struct dt_device_match rpi4_blacklist_dev[] __initconst =
>>   PLATFORM_START(rpi4, "Raspberry Pi 4")
>>       .compatible     = rpi4_dt_compat,
>>       .blacklist_dev  = rpi4_blacklist_dev,
>> +    .dma_bitsize    = 10,
> 
> I'm confused. Should it be 30?

Argh, yes. I computed the number of bits for 1024 and forgot to add 20 :(.

I will fix it in the next revision.

Cheers,
Julien Grall May 19, 2020, 5:07 p.m. UTC | #4
Hi Corey,

On 19/05/2020 01:02, Corey Minyard wrote:
> On Mon, May 18, 2020 at 08:36:08PM +0000, Volodymyr Babchuk wrote:
>> Hi Julien,
>>
>> On Mon, 2020-05-18 at 12:30 +0100, Julien Grall wrote:
>>> From: Julien Grall <jgrall@amazon.com>
>>>
>>> The raspberry PI 4 has devices that can only DMA into the first GB of
>>> the RAM. Therefore we want allocate as much as possible memory below 1GB
>>> for dom0.
>>>
>>> Use the recently introduced dma_bitsize field to specify the DMA width
>>> supported.
>>>
>>> Signed-off-by: Julien Grall <jgrall@amazon.com>
>>> Reported-by: Corey Minyard <minyard@acm.org>
>>> ---
>>>   xen/arch/arm/platforms/brcm-raspberry-pi.c | 1 +
>>>   1 file changed, 1 insertion(+)
>>>
>>> diff --git a/xen/arch/arm/platforms/brcm-raspberry-pi.c b/xen/arch/arm/platforms/brcm-raspberry-pi.c
>>> index b697fa2c6c0e..ad5483437b31 100644
>>> --- a/xen/arch/arm/platforms/brcm-raspberry-pi.c
>>> +++ b/xen/arch/arm/platforms/brcm-raspberry-pi.c
>>> @@ -43,6 +43,7 @@ static const struct dt_device_match rpi4_blacklist_dev[] __initconst =
>>>   PLATFORM_START(rpi4, "Raspberry Pi 4")
>>>       .compatible     = rpi4_dt_compat,
>>>       .blacklist_dev  = rpi4_blacklist_dev,
>>> +    .dma_bitsize    = 10,
>>
>> I'm confused. Should it be 30?
> 
> Indeed it should.  I just tested this series, and Linux fails to boot
> with this set to 10.  With it set to 30 it works.
> 
> With this set to 30, you can have a:
> 
> Tested-by: Corey Minyard <cminyard@mvista.com>
> 
> for all three patches.

Thank you for the testing! I will fix the bug and resend the series.

Cheers,
diff mbox series

Patch

diff --git a/xen/arch/arm/platforms/brcm-raspberry-pi.c b/xen/arch/arm/platforms/brcm-raspberry-pi.c
index b697fa2c6c0e..ad5483437b31 100644
--- a/xen/arch/arm/platforms/brcm-raspberry-pi.c
+++ b/xen/arch/arm/platforms/brcm-raspberry-pi.c
@@ -43,6 +43,7 @@  static const struct dt_device_match rpi4_blacklist_dev[] __initconst =
 PLATFORM_START(rpi4, "Raspberry Pi 4")
     .compatible     = rpi4_dt_compat,
     .blacklist_dev  = rpi4_blacklist_dev,
+    .dma_bitsize    = 10,
 PLATFORM_END
 
 /*