All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xen-devel] [PATCH v2 0/2] Raspberry Pi 4 support
@ 2019-07-29 13:19 Stewart Hildebrand
  2019-07-29 13:19 ` [Xen-devel] [PATCH v2 1/2] ns16550: Add compatible string for Raspberry Pi 4 Stewart Hildebrand
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Stewart Hildebrand @ 2019-07-29 13:19 UTC (permalink / raw)
  To: xen-devel
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall, Jan Beulich, Andre Przywara, Volodymyr Babchuk

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

-- 
2.22.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* [Xen-devel] [PATCH v2 1/2] ns16550: Add compatible string for Raspberry Pi 4
  2019-07-29 13:19 [Xen-devel] [PATCH v2 0/2] Raspberry Pi 4 support Stewart Hildebrand
@ 2019-07-29 13:19 ` Stewart Hildebrand
  2019-07-29 16:06   ` Andre Przywara
  2019-07-29 13:19 ` [Xen-devel] [PATCH v2 2/2] xen/arm: platform: Add Raspberry Pi platform Stewart Hildebrand
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 12+ messages in thread
From: Stewart Hildebrand @ 2019-07-29 13:19 UTC (permalink / raw)
  To: xen-devel
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall, Jan Beulich, Andre Przywara

Per the BCM2835 peripherals datasheet [1] page 10:
"The UART core is build to emulate 16550 behaviour ... The implemented
UART is not a 16650 compatible UART However as far as possible the
first 8 control and status registers are laid out like a 16550 UART. Al
16550 register bits which are not supported can be written but will be
ignored and read back as 0. All control bits for simple UART receive/
transmit operations are available."

Additionally, Linux uses the 8250/16550 driver for the aux UART [2].

Unfortunately the brcm,bcm2835-aux-uart device tree binding doesn't
have the reg-shift and reg-io-width properties [3]. Thus, the reg-shift
and reg-io-width properties are inherent properties of this UART.

Thanks to Andre Przywara for contributing the reg-shift and
reg-io-width setting snippet.

In my testing, I have relied on enable_uart=1 being set in config.txt,
a configuration file read by the Raspberry Pi's firmware. With
enable_uart=1, the firmware performs UART initialization.

[1] https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2835/BCM2835-ARM-Peripherals.pdf
[2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/tty/serial/8250/8250_bcm2835aux.c
[3] https://www.kernel.org/doc/Documentation/devicetree/bindings/serial/brcm,bcm2835-aux-uart.txt

Signed-off-by: Stewart Hildebrand <stewart.hildebrand@dornerworks.com>
---
 xen/drivers/char/ns16550.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index e518f2d790..8667de6d67 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -1585,6 +1585,12 @@ static int __init ns16550_uart_dt_init(struct dt_device_node *dev,
     if ( uart->reg_width != 1 && uart->reg_width != 4 )
         return -EINVAL;
 
+    if ( dt_device_is_compatible(dev, "brcm,bcm2835-aux-uart") )
+    {
+        uart->reg_width = 4;
+        uart->reg_shift = 2;
+    }
+
     res = platform_get_irq(dev, 0);
     if ( ! res )
         return -EINVAL;
@@ -1611,6 +1617,7 @@ static const struct dt_device_match ns16550_dt_match[] __initconst =
     DT_MATCH_COMPATIBLE("ns16550"),
     DT_MATCH_COMPATIBLE("ns16550a"),
     DT_MATCH_COMPATIBLE("snps,dw-apb-uart"),
+    DT_MATCH_COMPATIBLE("brcm,bcm2835-aux-uart"),
     { /* sentinel */ },
 };
 
-- 
2.22.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* [Xen-devel] [PATCH v2 2/2] xen/arm: platform: Add Raspberry Pi platform
  2019-07-29 13:19 [Xen-devel] [PATCH v2 0/2] Raspberry Pi 4 support Stewart Hildebrand
  2019-07-29 13:19 ` [Xen-devel] [PATCH v2 1/2] ns16550: Add compatible string for Raspberry Pi 4 Stewart Hildebrand
@ 2019-07-29 13:19 ` Stewart Hildebrand
  2019-07-31 12:03   ` Julien Grall
  2019-07-31 12:05 ` [Xen-devel] [PATCH v2 0/2] Raspberry Pi 4 support Julien Grall
  2019-07-31 12:32 ` Andre Przywara
  3 siblings, 1 reply; 12+ messages in thread
From: Stewart Hildebrand @ 2019-07-29 13:19 UTC (permalink / raw)
  To: xen-devel
  Cc: Andre Przywara, Julien Grall, Stefano Stabellini, Volodymyr Babchuk

The aux peripherals (uart1, spi1, and spi2) share an IRQ and a page of
memory. For debugging, it is helpful to use the aux UART in Xen. In
this case, Xen would try to assign spi1 and spi2 to dom0, but this
results in an error since the shared IRQ was already assigned to Xen.
Blacklist aux devices other than the UART to prevent mapping the shared
IRQ and memory range to dom0.

Signed-off-by: Stewart Hildebrand <stewart.hildebrand@dornerworks.com>
---
 xen/arch/arm/platforms/Makefile            |  1 +
 xen/arch/arm/platforms/brcm-raspberry-pi.c | 55 ++++++++++++++++++++++
 2 files changed, 56 insertions(+)
 create mode 100644 xen/arch/arm/platforms/brcm-raspberry-pi.c

diff --git a/xen/arch/arm/platforms/Makefile b/xen/arch/arm/platforms/Makefile
index 01608f89ee..8632f4115f 100644
--- a/xen/arch/arm/platforms/Makefile
+++ b/xen/arch/arm/platforms/Makefile
@@ -8,5 +8,6 @@ obj-$(CONFIG_ALL64_PLAT) += seattle.o
 obj-$(CONFIG_ALL_PLAT)   += sunxi.o
 obj-$(CONFIG_ALL64_PLAT) += thunderx.o
 obj-$(CONFIG_ALL64_PLAT) += xgene-storm.o
+obj-$(CONFIG_ALL64_PLAT) += brcm-raspberry-pi.o
 obj-$(CONFIG_MPSOC_PLATFORM)  += xilinx-zynqmp.o
 obj-$(CONFIG_MPSOC_PLATFORM)  += xilinx-zynqmp-eemi.o
diff --git a/xen/arch/arm/platforms/brcm-raspberry-pi.c b/xen/arch/arm/platforms/brcm-raspberry-pi.c
new file mode 100644
index 0000000000..e22d2b3184
--- /dev/null
+++ b/xen/arch/arm/platforms/brcm-raspberry-pi.c
@@ -0,0 +1,55 @@
+/*
+ * xen/arch/arm/platforms/brcm-raspberry-pi.c
+ *
+ * Raspberry Pi 4 Platform specific settings.
+ *
+ * Stewart Hildebrand <stewart.hildebrand@dornerworks.com>
+ * Copyright (c) 2019 DornerWorks, Ltd
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <asm/platform.h>
+
+static const char *const brcm_bcm2838_dt_compat[] __initconst =
+{
+    "brcm,bcm2838",
+    NULL
+};
+
+static const struct dt_device_match brcm_bcm2838_blacklist_dev[] __initconst =
+{
+    /*
+     * The aux SPIs share an IRQ and a page with the aux UART.
+     * If the same page gets mapped to dom0 and Xen, there is risk of
+     * dom0 writing to the UART that Xen controls.
+     */
+    DT_MATCH_COMPATIBLE("brcm,bcm2835-aux-spi"),
+    /*
+     * The aux peripheral also shares a page with the aux UART.
+     */
+    DT_MATCH_COMPATIBLE("brcm,bcm2835-aux"),
+    { /* sentinel */ },
+};
+
+PLATFORM_START(brcm_bcm2838, "Raspberry Pi 4")
+    .compatible     = brcm_bcm2838_dt_compat,
+    .blacklist_dev  = brcm_bcm2838_blacklist_dev,
+PLATFORM_END
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
-- 
2.22.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] [PATCH v2 1/2] ns16550: Add compatible string for Raspberry Pi 4
  2019-07-29 13:19 ` [Xen-devel] [PATCH v2 1/2] ns16550: Add compatible string for Raspberry Pi 4 Stewart Hildebrand
@ 2019-07-29 16:06   ` Andre Przywara
  2019-07-31 12:00     ` Julien Grall
  0 siblings, 1 reply; 12+ messages in thread
From: Andre Przywara @ 2019-07-29 16:06 UTC (permalink / raw)
  To: Stewart Hildebrand
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall, Jan Beulich, xen-devel

On Mon, 29 Jul 2019 09:19:19 -0400
Stewart Hildebrand <stewart.hildebrand@dornerworks.com> wrote:

Hi,

> Per the BCM2835 peripherals datasheet [1] page 10:
> "The UART core is build to emulate 16550 behaviour ... The implemented
> UART is not a 16650 compatible UART However as far as possible the
> first 8 control and status registers are laid out like a 16550 UART. Al
> 16550 register bits which are not supported can be written but will be
> ignored and read back as 0. All control bits for simple UART receive/
> transmit operations are available."
> 
> Additionally, Linux uses the 8250/16550 driver for the aux UART [2].
> 
> Unfortunately the brcm,bcm2835-aux-uart device tree binding doesn't
> have the reg-shift and reg-io-width properties [3]. Thus, the reg-shift
> and reg-io-width properties are inherent properties of this UART.
> 
> Thanks to Andre Przywara for contributing the reg-shift and
> reg-io-width setting snippet.
> 
> In my testing, I have relied on enable_uart=1 being set in config.txt,
> a configuration file read by the Raspberry Pi's firmware. With
> enable_uart=1, the firmware performs UART initialization.
> 
> [1] https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2835/BCM2835-ARM-Peripherals.pdf
> [2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/tty/serial/8250/8250_bcm2835aux.c
> [3] https://www.kernel.org/doc/Documentation/devicetree/bindings/serial/brcm,bcm2835-aux-uart.txt
> 
> Signed-off-by: Stewart Hildebrand <stewart.hildebrand@dornerworks.com>

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Andre Przywara <andre.przywara@arm.com>

Cheers,
Andre.

> ---
>  xen/drivers/char/ns16550.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
> index e518f2d790..8667de6d67 100644
> --- a/xen/drivers/char/ns16550.c
> +++ b/xen/drivers/char/ns16550.c
> @@ -1585,6 +1585,12 @@ static int __init ns16550_uart_dt_init(struct dt_device_node *dev,
>      if ( uart->reg_width != 1 && uart->reg_width != 4 )
>          return -EINVAL;
>  
> +    if ( dt_device_is_compatible(dev, "brcm,bcm2835-aux-uart") )
> +    {
> +        uart->reg_width = 4;
> +        uart->reg_shift = 2;
> +    }
> +
>      res = platform_get_irq(dev, 0);
>      if ( ! res )
>          return -EINVAL;
> @@ -1611,6 +1617,7 @@ static const struct dt_device_match ns16550_dt_match[] __initconst =
>      DT_MATCH_COMPATIBLE("ns16550"),
>      DT_MATCH_COMPATIBLE("ns16550a"),
>      DT_MATCH_COMPATIBLE("snps,dw-apb-uart"),
> +    DT_MATCH_COMPATIBLE("brcm,bcm2835-aux-uart"),
>      { /* sentinel */ },
>  };
>  


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] [PATCH v2 1/2] ns16550: Add compatible string for Raspberry Pi 4
  2019-07-29 16:06   ` Andre Przywara
@ 2019-07-31 12:00     ` Julien Grall
  0 siblings, 0 replies; 12+ messages in thread
From: Julien Grall @ 2019-07-31 12:00 UTC (permalink / raw)
  To: Andre Przywara, Stewart Hildebrand
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Jan Beulich, xen-devel

Hi,

On 29/07/2019 17:06, Andre Przywara wrote:
> On Mon, 29 Jul 2019 09:19:19 -0400
> Stewart Hildebrand <stewart.hildebrand@dornerworks.com> wrote:
> 
> Hi,
> 
>> Per the BCM2835 peripherals datasheet [1] page 10:
>> "The UART core is build to emulate 16550 behaviour ... The implemented
>> UART is not a 16650 compatible UART However as far as possible the
>> first 8 control and status registers are laid out like a 16550 UART. Al
>> 16550 register bits which are not supported can be written but will be
>> ignored and read back as 0. All control bits for simple UART receive/
>> transmit operations are available."
>>
>> Additionally, Linux uses the 8250/16550 driver for the aux UART [2].
>>
>> Unfortunately the brcm,bcm2835-aux-uart device tree binding doesn't
>> have the reg-shift and reg-io-width properties [3]. Thus, the reg-shift
>> and reg-io-width properties are inherent properties of this UART.
>>
>> Thanks to Andre Przywara for contributing the reg-shift and
>> reg-io-width setting snippet.
>>
>> In my testing, I have relied on enable_uart=1 being set in config.txt,
>> a configuration file read by the Raspberry Pi's firmware. With
>> enable_uart=1, the firmware performs UART initialization.
>>
>> [1] https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2835/BCM2835-ARM-Peripherals.pdf
>> [2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/tty/serial/8250/8250_bcm2835aux.c
>> [3] https://www.kernel.org/doc/Documentation/devicetree/bindings/serial/brcm,bcm2835-aux-uart.txt
>>
>> Signed-off-by: Stewart Hildebrand <stewart.hildebrand@dornerworks.com>
> 
> Reviewed-by: Andre Przywara <andre.przywara@arm.com>
> Tested-by: Andre Przywara <andre.przywara@arm.com>

Acked-by: Julien Grall <julien.grall@arm.com>

Cheers,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] [PATCH v2 2/2] xen/arm: platform: Add Raspberry Pi platform
  2019-07-29 13:19 ` [Xen-devel] [PATCH v2 2/2] xen/arm: platform: Add Raspberry Pi platform Stewart Hildebrand
@ 2019-07-31 12:03   ` Julien Grall
  2019-07-31 13:55     ` Stewart Hildebrand
  0 siblings, 1 reply; 12+ messages in thread
From: Julien Grall @ 2019-07-31 12:03 UTC (permalink / raw)
  To: Stewart Hildebrand, xen-devel
  Cc: Andre Przywara, Stefano Stabellini, Volodymyr Babchuk

Hi Stewart,

On 29/07/2019 14:19, Stewart Hildebrand wrote:
> The aux peripherals (uart1, spi1, and spi2) share an IRQ and a page of
> memory. For debugging, it is helpful to use the aux UART in Xen. In
> this case, Xen would try to assign spi1 and spi2 to dom0, but this
> results in an error since the shared IRQ was already assigned to Xen.
> Blacklist aux devices other than the UART to prevent mapping the shared
> IRQ and memory range to dom0.

Reading the commit message, it is unclear what's the impact on blacklist spi1 
and spi2. Could you expand it?

The rest of the patch looks good.

Cheers,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] [PATCH v2 0/2] Raspberry Pi 4 support
  2019-07-29 13:19 [Xen-devel] [PATCH v2 0/2] Raspberry Pi 4 support Stewart Hildebrand
  2019-07-29 13:19 ` [Xen-devel] [PATCH v2 1/2] ns16550: Add compatible string for Raspberry Pi 4 Stewart Hildebrand
  2019-07-29 13:19 ` [Xen-devel] [PATCH v2 2/2] xen/arm: platform: Add Raspberry Pi platform Stewart Hildebrand
@ 2019-07-31 12:05 ` Julien Grall
  2019-07-31 19:22   ` Julien Grall
  2019-07-31 12:32 ` Andre Przywara
  3 siblings, 1 reply; 12+ messages in thread
From: Julien Grall @ 2019-07-31 12:05 UTC (permalink / raw)
  To: Stewart Hildebrand, xen-devel
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Jan Beulich, Andre Przywara, Volodymyr Babchuk

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,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] [PATCH v2 0/2] Raspberry Pi 4 support
  2019-07-29 13:19 [Xen-devel] [PATCH v2 0/2] Raspberry Pi 4 support Stewart Hildebrand
                   ` (2 preceding siblings ...)
  2019-07-31 12:05 ` [Xen-devel] [PATCH v2 0/2] Raspberry Pi 4 support Julien Grall
@ 2019-07-31 12:32 ` Andre Przywara
  2019-07-31 15:03   ` Stewart Hildebrand
  3 siblings, 1 reply; 12+ messages in thread
From: Andre Przywara @ 2019-07-31 12:32 UTC (permalink / raw)
  To: Stewart Hildebrand
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall, Jan Beulich, xen-devel, Volodymyr Babchuk

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
> 


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] [PATCH v2 2/2] xen/arm: platform: Add Raspberry Pi platform
  2019-07-31 12:03   ` Julien Grall
@ 2019-07-31 13:55     ` Stewart Hildebrand
  2019-07-31 14:42       ` Julien Grall
  0 siblings, 1 reply; 12+ messages in thread
From: Stewart Hildebrand @ 2019-07-31 13:55 UTC (permalink / raw)
  To: Julien Grall, xen-devel
  Cc: Andre Przywara, Stefano Stabellini, Volodymyr Babchuk

On Wednesday, July 31, 2019 8:04 AM, Julien Grall <julien.grall@arm.com> wrote:
>Hi Stewart,

Hi Julien

>On 29/07/2019 14:19, Stewart Hildebrand wrote:
>> The aux peripherals (uart1, spi1, and spi2) share an IRQ and a page of
>> memory. For debugging, it is helpful to use the aux UART in Xen. In
>> this case, Xen would try to assign spi1 and spi2 to dom0, but this
>> results in an error since the shared IRQ was already assigned to Xen.
>> Blacklist aux devices other than the UART to prevent mapping the shared
>> IRQ and memory range to dom0.
>
>Reading the commit message, it is unclear what's the impact on blacklist spi1
>and spi2. Could you expand it?

Yes, good thinking. What do you think about the following (the first paragraph is unchanged, just copied for completeness):

"The aux peripherals (uart1, spi1, and spi2) share an IRQ and a page of
memory. For debugging, it is helpful to use the aux UART in Xen. In
this case, Xen would try to assign spi1 and spi2 to dom0, but this
results in an error since the shared IRQ was already assigned to Xen.
Blacklist aux devices other than the UART to prevent mapping the shared
IRQ and memory range to dom0.

Blacklisting spi1 and spi2 unfortunately makes those peripherals
unavailable for use in the system. Future work could include forwarding
the IRQ for spi1 and spi2, and trap and mediate access to the memory
range for spi1 and spi2."

Would you like me to re-send the patch, or can the message be updated on commit?

Stew

>The rest of the patch looks good.
>
>Cheers,
>
>--
>Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] [PATCH v2 2/2] xen/arm: platform: Add Raspberry Pi platform
  2019-07-31 13:55     ` Stewart Hildebrand
@ 2019-07-31 14:42       ` Julien Grall
  0 siblings, 0 replies; 12+ messages in thread
From: Julien Grall @ 2019-07-31 14:42 UTC (permalink / raw)
  To: Stewart Hildebrand, xen-devel
  Cc: Andre Przywara, Stefano Stabellini, Volodymyr Babchuk

Hi,

On 31/07/2019 14:55, Stewart Hildebrand wrote:
> On Wednesday, July 31, 2019 8:04 AM, Julien Grall <julien.grall@arm.com> wrote:
>> Hi Stewart,
> 
> Hi Julien
> 
>> On 29/07/2019 14:19, Stewart Hildebrand wrote:
>>> The aux peripherals (uart1, spi1, and spi2) share an IRQ and a page of
>>> memory. For debugging, it is helpful to use the aux UART in Xen. In
>>> this case, Xen would try to assign spi1 and spi2 to dom0, but this
>>> results in an error since the shared IRQ was already assigned to Xen.
>>> Blacklist aux devices other than the UART to prevent mapping the shared
>>> IRQ and memory range to dom0.
>>
>> Reading the commit message, it is unclear what's the impact on blacklist spi1
>> and spi2. Could you expand it?
> 
> Yes, good thinking. What do you think about the following (the first paragraph is unchanged, just copied for completeness):
> 
> "The aux peripherals (uart1, spi1, and spi2) share an IRQ and a page of
> memory. For debugging, it is helpful to use the aux UART in Xen. In
> this case, Xen would try to assign spi1 and spi2 to dom0, but this
> results in an error since the shared IRQ was already assigned to Xen.
> Blacklist aux devices other than the UART to prevent mapping the shared
> IRQ and memory range to dom0.
> 
> Blacklisting spi1 and spi2 unfortunately makes those peripherals
> unavailable for use in the system. Future work could include forwarding
> the IRQ for spi1 and spi2, and trap and mediate access to the memory
> range for spi1 and spi2."

Ok, so they are not critical to boot Dom0. Good :).

Hopefully they will learn the lesson for the next generation!

> 
> Would you like me to re-send the patch, or can the message be updated on commit?

No, I will update the commit message and commit it later on today.

With the new commit message:

Acked-by: Julien Grall <julien.grall@arm.com>

Cheers,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] [PATCH v2 0/2] Raspberry Pi 4 support
  2019-07-31 12:32 ` Andre Przywara
@ 2019-07-31 15:03   ` Stewart Hildebrand
  0 siblings, 0 replies; 12+ messages in thread
From: Stewart Hildebrand @ 2019-07-31 15:03 UTC (permalink / raw)
  To: Andre Przywara
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall, Jan Beulich, xen-devel, Volodymyr Babchuk

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


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] [PATCH v2 0/2] Raspberry Pi 4 support
  2019-07-31 12:05 ` [Xen-devel] [PATCH v2 0/2] Raspberry Pi 4 support Julien Grall
@ 2019-07-31 19:22   ` Julien Grall
  0 siblings, 0 replies; 12+ messages in thread
From: Julien Grall @ 2019-07-31 19:22 UTC (permalink / raw)
  To: Stewart Hildebrand, xen-devel
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Jan Beulich, Andre Przywara, Volodymyr Babchuk

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,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

end of thread, other threads:[~2019-07-31 19:23 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-29 13:19 [Xen-devel] [PATCH v2 0/2] Raspberry Pi 4 support Stewart Hildebrand
2019-07-29 13:19 ` [Xen-devel] [PATCH v2 1/2] ns16550: Add compatible string for Raspberry Pi 4 Stewart Hildebrand
2019-07-29 16:06   ` Andre Przywara
2019-07-31 12:00     ` Julien Grall
2019-07-29 13:19 ` [Xen-devel] [PATCH v2 2/2] xen/arm: platform: Add Raspberry Pi platform Stewart Hildebrand
2019-07-31 12:03   ` Julien Grall
2019-07-31 13:55     ` Stewart Hildebrand
2019-07-31 14:42       ` Julien Grall
2019-07-31 12:05 ` [Xen-devel] [PATCH v2 0/2] Raspberry Pi 4 support Julien Grall
2019-07-31 19:22   ` Julien Grall
2019-07-31 12:32 ` Andre Przywara
2019-07-31 15:03   ` Stewart Hildebrand

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.