mbox series

[v2,0/2] Raspberry Pi 4 support

Message ID cover.1564371527.git.stewart.hildebrand@dornerworks.com (mailing list archive)
Headers show
Series Raspberry Pi 4 support | expand

Message

Stewart Hildebrand July 29, 2019, 1:19 p.m. UTC
This is a series to enable UART console for Raspberry Pi 4. Note that I'm relying on the firmware to initialize the UART (i.e. enable_uart=1 in config.txt), since full UART initialization on this platform requires accessing some registers outside the range specified in the brcm,bcm2835-aux-uart node.

I have been able to get Xen+dom0+domUs booting. Tested with Xen 4.12 and 4.13-unstable (b4c8a27d5b) and Linux 4.19.y (Raspberry Pi linux tree + a couple of patches). Please see [1] for build instructions and limitations.

New in v2:
* Drop early printk alias
* Set reg-shift and reg-io-width in the Xen driver
* Blacklist other aux peripherals in platform settings (spi1, spi2, and a couple of base aux registers)

Thanks,
Stewart Hildebrand
DornerWorks, Ltd

[1] https://github.com/dornerworks/xen-rpi4-builder

Stewart Hildebrand (2):
  ns16550: Add compatible string for Raspberry Pi 4
  xen/arm: platform: Add Raspberry Pi platform

 xen/arch/arm/platforms/Makefile            |  1 +
 xen/arch/arm/platforms/brcm-raspberry-pi.c | 55 ++++++++++++++++++++++
 xen/drivers/char/ns16550.c                 |  7 +++
 3 files changed, 63 insertions(+)
 create mode 100644 xen/arch/arm/platforms/brcm-raspberry-pi.c

Comments

Julien Grall July 31, 2019, 12:05 p.m. UTC | #1
Hi Stewart,

On 29/07/2019 14:19, Stewart Hildebrand wrote:
> This is a series to enable UART console for Raspberry Pi 4. Note that I'm relying on the firmware to initialize the UART (i.e. enable_uart=1 in config.txt), since full UART initialization on this platform requires accessing some registers outside the range specified in the brcm,bcm2835-aux-uart node.
> 
> I have been able to get Xen+dom0+domUs booting. Tested with Xen 4.12 and 4.13-unstable (b4c8a27d5b) and Linux 4.19.y (Raspberry Pi linux tree + a couple of patches). Please see [1] for build instructions and limitations.
> 
> New in v2:
> * Drop early printk alias
> * Set reg-shift and reg-io-width in the Xen driver
> * Blacklist other aux peripherals in platform settings (spi1, spi2, and a couple of base aux registers)
> 
> Thanks,
> Stewart Hildebrand
> DornerWorks, Ltd
> 
> [1] https://github.com/dornerworks/xen-rpi4-builder
> 
> Stewart Hildebrand (2):
>    ns16550: Add compatible string for Raspberry Pi 4

I have committed this patch...

>    xen/arm: platform: Add Raspberry Pi platform
... this one need an answer regarding the impact on blacklist spi1 and spi2.

Cheers,
Andre Przywara July 31, 2019, 12:32 p.m. UTC | #2
On Mon, 29 Jul 2019 09:19:18 -0400
Stewart Hildebrand <stewart.hildebrand@dornerworks.com> wrote:

Hi,

> This is a series to enable UART console for Raspberry Pi 4. Note that I'm relying on the firmware to initialize the UART (i.e. enable_uart=1 in config.txt), since full UART initialization on this platform requires accessing some registers outside the range specified in the brcm,bcm2835-aux-uart node.
> 
> I have been able to get Xen+dom0+domUs booting. Tested with Xen 4.12 and 4.13-unstable (b4c8a27d5b)

Mmmh, did that really work for you? I needed the next commit in staging as well:
commit ead6b9f78355e8d366e0c80c4a73fa7fbd6d26cc
Author: Andrii Anisov <andrii_anisov@epam.com>
Date:   Thu Jul 18 16:22:20 2019 +0300

    xen/arm: cpuerrata: Align a virtual address before unmap

Otherwise Xen would crash before even considering Dom0.

With Andrii's patch, your two patches and Stefano's resmem series I was able to at least run Xen till it was looking for Dom0, from U-Boot, with ATF (providing PSCI).
There seems to be some hiccup in the reserved-memory code in U-Boot, where U-Boot tries to use the already region, but that's an independent matter.

Cheers,
Andre.

> and Linux 4.19.y (Raspberry Pi linux tree + a couple of patches). Please see [1] for build instructions and limitations.
> 
> New in v2:
> * Drop early printk alias
> * Set reg-shift and reg-io-width in the Xen driver
> * Blacklist other aux peripherals in platform settings (spi1, spi2, and a couple of base aux registers)
> 
> Thanks,
> Stewart Hildebrand
> DornerWorks, Ltd
> 
> [1] https://github.com/dornerworks/xen-rpi4-builder
> 
> Stewart Hildebrand (2):
>   ns16550: Add compatible string for Raspberry Pi 4
>   xen/arm: platform: Add Raspberry Pi platform
> 
>  xen/arch/arm/platforms/Makefile            |  1 +
>  xen/arch/arm/platforms/brcm-raspberry-pi.c | 55 ++++++++++++++++++++++
>  xen/drivers/char/ns16550.c                 |  7 +++
>  3 files changed, 63 insertions(+)
>  create mode 100644 xen/arch/arm/platforms/brcm-raspberry-pi.c
>
Stewart Hildebrand July 31, 2019, 3:03 p.m. UTC | #3
On Wednesday, July 31, 2019 8:32 AM, Andre Przywara <andre.przywara@arm.com> wrote:
>On Mon, 29 Jul 2019 09:19:18 -0400
>Stewart Hildebrand <stewart.hildebrand@dornerworks.com> wrote:
>
>Hi,
>
>> This is a series to enable UART console for Raspberry Pi 4. Note that I'm relying on the firmware to initialize the UART (i.e. enable_uart=1 in config.txt), since full UART initialization on this platform requires accessing some registers outside the range specified in the brcm,bcm2835-aux-uart node.
>>
>> I have been able to get Xen+dom0+domUs booting. Tested with Xen 4.12 and 4.13-unstable (b4c8a27d5b)
>
>Mmmh, did that really work for you? I needed the next commit in staging as well:
>commit ead6b9f78355e8d366e0c80c4a73fa7fbd6d26cc
>Author: Andrii Anisov <andrii_anisov@epam.com>
>Date:   Thu Jul 18 16:22:20 2019 +0300
>
>    xen/arm: cpuerrata: Align a virtual address before unmap
>
>Otherwise Xen would crash before even considering Dom0.

Hmm... Yes. I did not have Andrii's patch included in my tests. I tested in 4.13-unstable (b4c8a27d5b) and on 4.12 (604ee1116d3e), it booted into Xen+dom0. Now that I'm thinking about it, the domU test may have only been on 4.12, not on 4.13-unstable.

>With Andrii's patch, your two patches and Stefano's resmem series I was able to at least run Xen till it was looking for Dom0, from U-
>Boot, with ATF (providing PSCI).

I'm not using ATF/U-Boot, and I've limited system RAM to total_mem=1024 in config.txt (even though I have the 4GB model) due to some DMA/driver issues (SD card, PCIe, etc) with the 64-bit RPi kernel. I also did not have Stefano's reserved-memory series applied in any test.

The following logs are a from couple of test runs from 4.13-unstable on Sun Jul 28:

(XEN) RAM: 0000000000000000 - 000000003b3fffff
(XEN) 
(XEN) MODULE[0]: 000000002eff5f00 - 000000002effff49 Device Tree 
(XEN) MODULE[1]: 0000000000480000 - 0000000001400000 Kernel      
(XEN)  RESVD[0]: 0000000000000000 - 0000000000001000
...
(XEN) Allocating 1:1 mappings totalling 512MB for dom0:
(XEN) BANK[0] 0x00000010000000-0x00000028000000 (384MB)
(XEN) BANK[1] 0x00000030000000-0x00000038000000 (128MB)

Curiously, in another test with total_mem=1536, Xen happened to allocate memory for dom0 in a different way. I am noticing that the RPi firmware carved out a hole in RAM for me in this case.

(XEN) RAM: 0000000000000000 - 000000003b3fffff
(XEN) RAM: 0000000040000000 - 000000005fffffff
(XEN) 
(XEN) MODULE[0]: 000000002eff5f00 - 000000002effff55 Device Tree 
(XEN) MODULE[1]: 0000000000480000 - 0000000001400000 Kernel      
(XEN)  RESVD[0]: 0000000000000000 - 0000000000001000
...
(XEN) Allocating 1:1 mappings totalling 512MB for dom0:
(XEN) BANK[0] 0x00000010000000-0x00000020000000 (256MB)
(XEN) BANK[1] 0x00000040000000-0x00000050000000 (256MB)

Stew

>There seems to be some hiccup in the reserved-memory code in U-Boot, where U-Boot tries to use the already region, but that's an
>independent matter.
>
>Cheers,
>Andre.
>
>> and Linux 4.19.y (Raspberry Pi linux tree + a couple of patches). Please see [1] for build instructions and limitations.
>>
>> New in v2:
>> * Drop early printk alias
>> * Set reg-shift and reg-io-width in the Xen driver
>> * Blacklist other aux peripherals in platform settings (spi1, spi2, and a couple of base aux registers)
>>
>> Thanks,
>> Stewart Hildebrand
>> DornerWorks, Ltd
>>
>> [1] https://github.com/dornerworks/xen-rpi4-builder
>>
>> Stewart Hildebrand (2):
>>   ns16550: Add compatible string for Raspberry Pi 4
>>   xen/arm: platform: Add Raspberry Pi platform
>>
>>  xen/arch/arm/platforms/Makefile            |  1 +
>>  xen/arch/arm/platforms/brcm-raspberry-pi.c | 55 ++++++++++++++++++++++
>>  xen/drivers/char/ns16550.c                 |  7 +++
>>  3 files changed, 63 insertions(+)
>>  create mode 100644 xen/arch/arm/platforms/brcm-raspberry-pi.c
>>
Julien Grall July 31, 2019, 7:22 p.m. UTC | #4
Hi,

On 7/31/19 1:05 PM, Julien Grall wrote:
> On 29/07/2019 14:19, Stewart Hildebrand wrote:
>> This is a series to enable UART console for Raspberry Pi 4. Note that 
>> I'm relying on the firmware to initialize the UART (i.e. enable_uart=1 
>> in config.txt), since full UART initialization on this platform 
>> requires accessing some registers outside the range specified in the 
>> brcm,bcm2835-aux-uart node.
>>
>> I have been able to get Xen+dom0+domUs booting. Tested with Xen 4.12 
>> and 4.13-unstable (b4c8a27d5b) and Linux 4.19.y (Raspberry Pi linux 
>> tree + a couple of patches). Please see [1] for build instructions and 
>> limitations.
>>
>> New in v2:
>> * Drop early printk alias
>> * Set reg-shift and reg-io-width in the Xen driver
>> * Blacklist other aux peripherals in platform settings (spi1, spi2, 
>> and a couple of base aux registers)
>>
>> Thanks,
>> Stewart Hildebrand
>> DornerWorks, Ltd
>>
>> [1] https://github.com/dornerworks/xen-rpi4-builder
>>
>> Stewart Hildebrand (2):
>>    ns16550: Add compatible string for Raspberry Pi 4
> 
> I have committed this patch...
> 
>>    xen/arm: platform: Add Raspberry Pi platform
> ... this one need an answer regarding the impact on blacklist spi1 and 
> spi2.

This patch is now merged as well. Thank you for adding support for the RPI4!

Cheers,