Skip to contentSkip to conversation

support for cubieboard2 / sunxi processors

PATCH Superseded Ian Campbell 3 participants 21 messages Sep 20, 2013 – Oct 11, 2013 Arm/Allwinner sunXi SoC support

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover support for cubieboard2 / sunxi processors

See http://www.gossamer-threads.com/lists/xen/devel/297170 for some information on how to get this going.

I've rebased and addressed the review comments.

With this rebase I've picked up some patches from Julien which were required to do things properly, so the gic v7 and device blacklisting patches have been changed to use the proper mechanisms.

Previously I was able to boot to a panic due to not finding a root filesystem. This seems to have regressed and now it hangs during dom0 boot. I'm not sure why this is but I think it is because I've rebased my dom0 kernel and not something in this series. I don't think this needs to block this series though, especially since the APM guys want bits of it (specifically the ns16550 DT stuff).

Progress has been made on the upstream SATA support, but nothing is actually in place yet.

Ian.

#1 lore raw

PATCH v3 1/7 xen/arm: Implement ioremap.

Common code uses this, it expects an uncached mapping.

---
 xen/arch/arm/mm.c |    5 +++++
 1 file changed, 5 insertions(+)
xen/arch/arm/mm.c +5 -0
index 69c157a..4521c8d 100644
@@ -694,6 +694,11 @@ void *ioremap_attr(paddr_t pa, size_t len, unsigned int attributes)
     return (__vmap(&pfn, nr, 1, 1, attributes) + offs);
 }
 
+void *ioremap(paddr_t pa, size_t len)
+{
+    return ioremap_attr(pa, len, PAGE_HYPERVISOR_NOCACHE);
+}
+
 static int create_xen_table(lpae_t *entry)
 {
     void *p;
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH v3 3/7 ns16550: make usable on ARM

In reply to Ian Campbell

There are several aspects to this:
- Correctly conditionalise use of PCI
- Correctly conditionalise use of IO ports
- Add discovery via device tree
- Support different registers shift/stride and widths
- Add vuart hooks.

---
v2: Use __initdata
Implement unknown register access sizes as write ignore, read all 1s. Coding style fixes
Comment on reg_width meaning
Fix ifdef placement
io_size does not need 64-bits

---
 config/arm32.mk            |    1 +
 xen/Rules.mk               |    3 +
 xen/arch/x86/Rules.mk      |    1 +
 xen/drivers/char/ns16550.c |  193 +++++++++++++++++++++++++++++++++++++++++---
 4 files changed, 186 insertions(+), 12 deletions(-)
config/arm32.mk +1 -0
index 76e229d..aa79d22 100644
@@ -12,6 +12,7 @@ CFLAGS += -marm
 HAS_PL011 := y
 HAS_EXYNOS4210 := y
 HAS_OMAP := y
+HAS_NS16550 := y
 
 # Use only if calling $(LD) directly.
 LDFLAGS_DIRECT += -EL
xen/Rules.mk +3 -0
index 736882a..df1428f 100644
@@ -60,6 +60,9 @@ CFLAGS-$(lock_profile)  += -DLOCK_PROFILE
 CFLAGS-$(HAS_ACPI)      += -DHAS_ACPI
 CFLAGS-$(HAS_GDBSX)     += -DHAS_GDBSX
 CFLAGS-$(HAS_PASSTHROUGH) += -DHAS_PASSTHROUGH
+CFLAGS-$(HAS_DEVICE_TREE) += -DHAS_DEVICE_TREE
+CFLAGS-$(HAS_PCI)       += -DHAS_PCI
+CFLAGS-$(HAS_IOPORTS)   += -DHAS_IOPORTS
 CFLAGS-$(frame_pointer) += -fno-omit-frame-pointer -DCONFIG_FRAME_POINTER
 
 ifneq ($(max_phys_cpus),)
xen/arch/x86/Rules.mk +1 -0
index eb11b5b..c93d2af 100644
@@ -1,6 +1,7 @@
 ########################################
 # x86-specific definitions
 
+HAS_IOPORTS := y
 HAS_ACPI := y
 HAS_VGA  := y
 HAS_VIDEO  := y
xen/drivers/char/ns16550.c +181 -12

391 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#3 lore raw

PATCH v3 4/7 ns16550: support DesignWare 8250

In reply to Ian Campbell

This hardware has an additional feature which signals an error if you try to write LCR while the UART is busy. We need to clear this error during setup, otherwise LCR.DLAB doesn't get set and we cannot read/write the divisor.

This has been tested on the cubieboard2

---
v2: Remove pointless cast.

---
 xen/drivers/char/ns16550.c  |   14 ++++++++++++++
 xen/include/xen/8250-uart.h |    2 ++
 2 files changed, 16 insertions(+)
xen/drivers/char/ns16550.c +14 -0
index 45da924..5892eb7 100644
@@ -61,6 +61,7 @@ static struct ns16550 {
     struct timer resume_timer;
     unsigned int timeout_ms;
     bool_t intr_works;
+    bool_t dw_usr_bsy;
 #ifdef HAS_PCI
     /* PCI card parameters. */
     unsigned int pb_bdf[3]; /* pci bridge BDF */
@@ -237,6 +238,16 @@ static void ns16550_setup_preirq(struct ns16550 *uart)
     /* No interrupts. */
     ns_write_reg(uart, UART_IER, 0);
 
+    if ( uart->dw_usr_bsy &&
+         (ns_read_reg(uart, UART_IIR) & UART_IIR_BSY) == UART_IIR_BSY )
+    {
+        /* DesignWare 8250 detects if LCR is written while the UART is
+         * busy and raises a "busy detect" interrupt. Read the UART
+         * Status Register to clear this state.
+         */
+        ns_read_reg(uart, UART_USR);
+    }
+
     /* Line control and baud-rate generator. */
     ns_write_reg(uart, UART_LCR, lcr | UART_LCR_DLAB);
     if ( uart->baud != BAUD_AUTO )
@@ -787,6 +798,8 @@ static int __init ns16550_uart_dt_init(struct dt_device_node *dev,
     /* The common bit of the driver mostly deals with irq not dt_irq. */
     uart->irq = uart->dt_irq.irq;
 
+    uart->dw_usr_bsy = dt_device_is_compatible(dev, "snps,dw-apb-uart");
+
     uart->vuart.base_addr = uart->io_base;
     uart->vuart.size = uart->io_size;
     uart->vuart.data_off = UART_THR <<uart->reg_shift;
@@ -804,6 +817,7 @@ static int __init ns16550_uart_dt_init(struct dt_device_node *dev,
 static const char const *ns16550_dt_compat[] __initconst =
 {
     "ns16550",
+    "snps,dw-apb-uart",
     NULL
 };
 
xen/include/xen/8250-uart.h +2 -0
index 8693d15..a682bae 100644
@@ -32,6 +32,7 @@
 #define UART_MCR          0x04    /* Modem control        */
 #define UART_LSR          0x05    /* line status          */
 #define UART_MSR          0x06    /* Modem status         */
+#define UART_USR          0x1f    /* Status register (DW) */
 #define UART_DLL          0x00    /* divisor latch (ls) (DLAB=1) */
 #define UART_DLM          0x01    /* divisor latch (ms) (DLAB=1) */
 
@@ -48,6 +49,7 @@
 #define UART_IIR_RDA      0x04    /*  - rx data recv'd    */
 #define UART_IIR_THR      0x02    /*  - tx reg. empty     */
 #define UART_IIR_MSI      0x00    /*  - MODEM status      */
+#define UART_IIR_BSY      0x07    /*  - busy detect (DW) */
 
 /* FIFO Control Register */
 #define UART_FCR_ENABLE   0x01    /* enable FIFO          */
Signature · 1 line
1.7.10.4
#4 lore raw

PATCH v3 5/7 xen/arm: Support Cortex-A7 GIC

In reply to Ian Campbell

---
v3: use DT_MATCH_GIC

---
 xen/include/asm-arm/gic.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
xen/include/asm-arm/gic.h +2 -1
index 92a3349..2bc4219 100644
@@ -135,7 +135,8 @@
 #ifndef __ASSEMBLY__
 #include <xen/device_tree.h>
 
-#define DT_MATCH_GIC    DT_MATCH_COMPATIBLE("arm,cortex-a15-gic")
+#define DT_MATCH_GIC    DT_MATCH_COMPATIBLE("arm,cortex-a15-gic"), \
+                        DT_MATCH_COMPATIBLE("arm,cortex-a7-gic")
 
 extern int domain_vgic_init(struct domain *d);
 extern void domain_vgic_free(struct domain *d);
Signature · 1 line
1.7.10.4
Acked-by on v3 5/7
#5 lore raw

Re: [PATCH 5/7] xen/arm: Support Cortex-A7 GIC

Quoted 1 line · Ian Campbell
Quoted 21 lines

---
v3: use DT_MATCH_GIC

---
  xen/include/asm-arm/gic.h |    3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
xen/include/asm-arm/gic.h +2 -1
index 92a3349..2bc4219 100644
@@ -135,7 +135,8 @@
  #ifndef __ASSEMBLY__
  #include <xen/device_tree.h>
 
-#define DT_MATCH_GIC    DT_MATCH_COMPATIBLE("arm,cortex-a15-gic")
+#define DT_MATCH_GIC    DT_MATCH_COMPATIBLE("arm,cortex-a15-gic"), \
+                        DT_MATCH_COMPATIBLE("arm,cortex-a7-gic")
 
  extern int domain_vgic_init(struct domain *d);
  extern void domain_vgic_free(struct domain *d);
Signature · 1 line
Julien Grall
#6 lore raw

PATCH v3 6/7 xen/arm: Basic support for sunxi/sun7i platform.

In reply to Ian Campbell

Specifically cubieboard2

---
 xen/arch/arm/platforms/Makefile |    1 +
 xen/arch/arm/platforms/sunxi.c  |   42 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+)
 create mode 100644 xen/arch/arm/platforms/sunxi.c
xen/arch/arm/platforms/Makefile +1 -0
index 4aa82e8..8c77ace 100644
@@ -2,3 +2,4 @@ obj-y += vexpress.o
 obj-y += exynos5.o
 obj-y += midway.o
 obj-y += omap5.o
+obj-y += sunxi.o
xen/arch/arm/platforms/sunxi.c new file +42 -0

42 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#7 lore raw

Re: [PATCH 6/7] xen/arm: Basic support for sunxi/sun7i platform.

Quoted 37 lines · Ian Campbell

Specifically cubieboard2

---
  xen/arch/arm/platforms/Makefile |    1 +
  xen/arch/arm/platforms/sunxi.c  |   42 +++++++++++++++++++++++++++++++++++++++
  2 files changed, 43 insertions(+)

create mode 100644 xen/arch/arm/platforms/sunxi.c

xen/arch/arm/platforms/Makefile +1 -0
index 4aa82e8..8c77ace 100644
@@ -2,3 +2,4 @@ obj-y += vexpress.o
  obj-y += exynos5.o
  obj-y += midway.o
  obj-y += omap5.o
+obj-y += sunxi.o
xen/arch/arm/platforms/sunxi.c new file +13 -0
new file mode 100644
index 0000000..ee0f39b
@@ -0,0 +1,42 @@
+/*
+ * xen/arch/arm/platforms/sunxi.c
+ *
+ * SUNXI (AllWinner A20/A31) specific settings
+ *
+ * Copyright (c) 2013 Citrix Systems.
+ *
+ * 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,

xen/arch/arm/platforms/sunxi.c line 23

Quoted 10 lines
xen/arch/arm/platforms/sunxi.c new file +10 -0
+ * 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/p2m.h>
+#include <xen/config.h>
+#include <asm/platform.h>
+#include <xen/mm.h>
+#include <xen/device_tree.h>

Do we need all these includes? asm/platform.h should be enough.

xen/arch/arm/platforms/sunxi.c line 25

Quoted 2 lines
xen/arch/arm/platforms/sunxi.c new file +2 -0
+
+static const char const *sunxi_dt_compat[] __initdata =

It should be __initconst.

Quoted 18 lines
xen/arch/arm/platforms/sunxi.c new file +17 -0
+{
+    "allwinner,sun7i-a20",
+    NULL
+};
+
+PLATFORM_START(sunxi, "Allwinner A20")
+    .compatible = sunxi_dt_compat,
+PLATFORM_END
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
Signature · 1 line
Julien Grall
#8 lore raw

Re: [PATCH 6/7] xen/arm: Basic support for sunxi/sun7i platform.

Quoted 42 lines · Julien Grall
Quoted 41 lines · Ian Campbell

Specifically cubieboard2

---
  xen/arch/arm/platforms/Makefile |    1 +
  xen/arch/arm/platforms/sunxi.c  |   42 +++++++++++++++++++++++++++++++++++++++
  2 files changed, 43 insertions(+)

create mode 100644 xen/arch/arm/platforms/sunxi.c

xen/arch/arm/platforms/Makefile +1 -0
index 4aa82e8..8c77ace 100644
@@ -2,3 +2,4 @@ obj-y += vexpress.o
  obj-y += exynos5.o
  obj-y += midway.o
  obj-y += omap5.o
+obj-y += sunxi.o
xen/arch/arm/platforms/sunxi.c new file +17 -0
new file mode 100644
index 0000000..ee0f39b
@@ -0,0 +1,42 @@
+/*
+ * xen/arch/arm/platforms/sunxi.c
+ *
+ * SUNXI (AllWinner A20/A31) specific settings
+ *
+ * Copyright (c) 2013 Citrix Systems.
+ *
+ * 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.
+ */
Quoted 8 lines

xen/arch/arm/platforms/sunxi.c line 23

Quoted 6 lines
xen/arch/arm/platforms/sunxi.c new file +6 -0
+
+#include <asm/p2m.h>
+#include <xen/config.h>
+#include <asm/platform.h>
+#include <xen/mm.h>
+#include <xen/device_tree.h>

Do we need all these includes? asm/platform.h should be enough.

Probably not, many of them are a hangover from the previous hacky version or copied from whichever file I started from ;-)

Quoted 5 lines

xen/arch/arm/platforms/sunxi.c line 25

Quoted 3 lines
xen/arch/arm/platforms/sunxi.c new file +2 -0
+
+static const char const *sunxi_dt_compat[] __initdata =

It should be __initconst.

Ack.

Quoted 20 lines
Quoted 18 lines
xen/arch/arm/platforms/sunxi.c new file +17 -0
+{
+    "allwinner,sun7i-a20",
+    NULL
+};
+
+PLATFORM_START(sunxi, "Allwinner A20")
+    .compatible = sunxi_dt_compat,
+PLATFORM_END
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
#9 lore raw

Re: [PATCH 6/7] xen/arm: Basic support for sunxi/sun7i platform.

In reply to Julien Grall
Quoted 4 lines · Julien Grall

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+static const char const *sunxi_dt_compat[] __initdata =

It should be __initconst.

Together with the 7/7 patch (uart blacklisting) doing this causes:

        sunxi.c:21:26: error: sunxi_dt_compat causes a section type conflict with sunxi_blacklist_dev
         static const char const *sunxi_dt_compat[] __initconst =
                                  ^
        sunxi.c:27:37: note: ‘sunxi_blacklist_dev’ was declared here
         static const struct dt_device_match sunxi_blacklist_dev[] __initconst =
                                             ^

I'm not sure why this would be, but I notice that vexpress and exynos5 both use __initdata for their dt_compat lists and __initconst for their blacklists.

Any thoughts?

google flags up a bunch of similar sounds gcc bugs, but they are all for older versions than the 4.8 (linaro 2013.08 FWIW) that I'm using.

I'm inclined to keep using __initdata for the dt_compat list as all the other platforms do.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#10 lore raw

Re: [PATCH 6/7] xen/arm: Basic support for sunxi/sun7i platform.

Quoted 14 lines · Ian Campbell
Quoted 4 lines · Julien Grall

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+static const char const *sunxi_dt_compat[] __initdata =

It should be __initconst.

Together with the 7/7 patch (uart blacklisting) doing this causes:

        sunxi.c:21:26: error: sunxi_dt_compat causes a section type conflict with sunxi_blacklist_dev
         static const char const *sunxi_dt_compat[] __initconst =
                                  ^
        sunxi.c:27:37: note: ‘sunxi_blacklist_dev’ was declared here
         static const struct dt_device_match sunxi_blacklist_dev[] __initconst =
                                             ^
Quoted 5 lines

I'm not sure why this would be, but I notice that vexpress and exynos5 both use __initdata for their dt_compat lists and __initconst for their blacklists.

Any thoughts?

It's because the const should be after * in sunxi_dt_compat ie

static const char * const sunxi_dt_compat[] __initconst =

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#11 lore raw

Re: [PATCH 6/7] xen/arm: Basic support for sunxi/sun7i platform.

Quoted 3 lines · Julien Grall

It's because the const should be after * in sunxi_dt_compat ie

static const char * const sunxi_dt_compat[] __initconst =

That did the trick. I'll fix the others too.

Ian.

#12 lore raw

PATCH v3 7/7 xen/arm: Blacklist some sun7i UARTs

In reply to Ian Campbell

These are in the same page as the UART which is used as the Xen console. We are not currently smart enough to avoid passing them through to the guest, accidentally giving the guest access to the Xen console UART.

---
v3: Use blacklist dev hook

---
 xen/arch/arm/platforms/sunxi.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)
xen/arch/arm/platforms/sunxi.c +14 -0
index ee0f39b..3a0ed68 100644
@@ -28,8 +28,22 @@ static const char const *sunxi_dt_compat[] __initdata =
     NULL
 };
 
+static const struct dt_device_match sunxi_blacklist_dev[] __initconst =
+{
+    /*
+     * These UARTs share a page with the Xen console UART, so we don't
+     * want to map them through.
+     */
+    DT_MATCH_PATH("/soc@01c00000/serial@01c28000"),
+    DT_MATCH_PATH("/soc@01c00000/serial@01c28400"),
+    DT_MATCH_PATH("/soc@01c00000/serial@01c28800"),
+    DT_MATCH_PATH("/soc@01c00000/serial@01c28c00"),
+    { /* sentinel */ },
+};
+
 PLATFORM_START(sunxi, "Allwinner A20")
     .compatible = sunxi_dt_compat,
+    .blacklist_dev = sunxi_blacklist_dev,
 PLATFORM_END
 
 /*
Signature · 1 line
1.7.10.4
#13 lore raw

Re: [PATCH 7/7] xen/arm: Blacklist some sun7i UARTs

Quoted 19 lines · Ian Campbell

These are in the same page as the UART which is used as the Xen console. We are not currently smart enough to avoid passing them through to the guest, accidentally giving the guest access to the Xen console UART.

---
v3: Use blacklist dev hook

---
  xen/arch/arm/platforms/sunxi.c |   14 ++++++++++++++
  1 file changed, 14 insertions(+)
xen/arch/arm/platforms/sunxi.c +0 -0
index ee0f39b..3a0ed68 100644
@@ -28,8 +28,22 @@ static const char const *sunxi_dt_compat[] __initdata =
      NULL
  };
 

xen/arch/arm/platforms/sunxi.c static const char const *sunxi_dt_compat[] __initdata = · line 40

Quoted 10 lines
xen/arch/arm/platforms/sunxi.c +10 -0
+static const struct dt_device_match sunxi_blacklist_dev[] __initconst =
+{
+    /*
+     * These UARTs share a page with the Xen console UART, so we don't
+     * want to map them through.
+     */
+    DT_MATCH_PATH("/soc@01c00000/serial@01c28000"),
+    DT_MATCH_PATH("/soc@01c00000/serial@01c28400"),
+    DT_MATCH_PATH("/soc@01c00000/serial@01c28800"),
+    DT_MATCH_PATH("/soc@01c00000/serial@01c28c00"),

Can we blacklist all the UARTs via a DT_MATCH_COMPATIBLE? It's better than relying on the path that can be changed easily in the device tree.

Quoted 10 lines
xen/arch/arm/platforms/sunxi.c +4 -0
+    { /* sentinel */ },
+};
+
  PLATFORM_START(sunxi, "Allwinner A20")
      .compatible = sunxi_dt_compat,
+    .blacklist_dev = sunxi_blacklist_dev,
  PLATFORM_END
 
  /*
Signature · 1 line
Julien Grall
#14 lore raw

Re: [PATCH 7/7] xen/arm: Blacklist some sun7i UARTs

Quoted 11 lines · Julien Grall

xen/arch/arm/platforms/sunxi.c static const char const *sunxi_dt_compat[] __initdata = · line 40

Quoted 8 lines
xen/arch/arm/platforms/sunxi.c +8 -0
+    /*
+     * These UARTs share a page with the Xen console UART, so we don't
+     * want to map them through.
+     */
+    DT_MATCH_PATH("/soc@01c00000/serial@01c28000"),
+    DT_MATCH_PATH("/soc@01c00000/serial@01c28400"),
+    DT_MATCH_PATH("/soc@01c00000/serial@01c28800"),
+    DT_MATCH_PATH("/soc@01c00000/serial@01c28c00"),

Can we blacklist all the UARTs via a DT_MATCH_COMPATIBLE? It's better than relying on the path that can be changed easily in the device tree.

There are other UARTS (at 0x1c29xxx) which could safely be exposed to dom0. Perhaps it is better to just blacklist the whole lot though.

Ultimately this is just a hack for the fact that Xen is not currently smart enough to figure out which devices conflict in this way...

Ian.

#15 lore raw

Re: [PATCH 7/7] xen/arm: Blacklist some sun7i UARTs

Quoted 11 lines · Ian Campbell
Quoted 9 lines · Julien Grall
Quoted 8 lines
xen/arch/arm/platforms/sunxi.c +8 -0
+    /*
+     * These UARTs share a page with the Xen console UART, so we don't
+     * want to map them through.
+     */
+    DT_MATCH_PATH("/soc@01c00000/serial@01c28000"),
+    DT_MATCH_PATH("/soc@01c00000/serial@01c28400"),
+    DT_MATCH_PATH("/soc@01c00000/serial@01c28800"),
+    DT_MATCH_PATH("/soc@01c00000/serial@01c28c00"),
Quoted 5 lines
Quoted 2 lines

Can we blacklist all the UARTs via a DT_MATCH_COMPATIBLE? It's better than relying on the path that can be changed easily in the device tree.

There are other UARTS (at 0x1c29xxx) which could safely be exposed to dom0. Perhaps it is better to just blacklist the whole lot though.

These UARTs also share the same page, what prevents the user to use these UARTs?

I have noticed that all the UARTs, except UART0, have a property : status = "disabled". So Xen won't map the UART in dom0 memory.

Quoted 2 lines

Ultimately this is just a hack for the fact that Xen is not currently smart enough to figure out which devices conflict in this way...

After my comment above, do we really need to blacklist all the other UARTs? As we only support the cubieboard 2, if we only want a hack, I think we can safely avoid this patch for now.

Signature · 1 line
Julien Grall
#16 lore raw

Re: [PATCH 7/7] xen/arm: Blacklist some sun7i UARTs

Quoted 12 lines · Julien Grall
Quoted 11 lines · Ian Campbell
Quoted 9 lines · Julien Grall
Quoted 8 lines
xen/arch/arm/platforms/sunxi.c +8 -0
+    /*
+     * These UARTs share a page with the Xen console UART, so we don't
+     * want to map them through.
+     */
+    DT_MATCH_PATH("/soc@01c00000/serial@01c28000"),
+    DT_MATCH_PATH("/soc@01c00000/serial@01c28400"),
+    DT_MATCH_PATH("/soc@01c00000/serial@01c28800"),
+    DT_MATCH_PATH("/soc@01c00000/serial@01c28c00"),
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Can we blacklist all the UARTs via a DT_MATCH_COMPATIBLE? It's better than relying on the path that can be changed easily in the device tree.

There are other UARTS (at 0x1c29xxx) which could safely be exposed to dom0. Perhaps it is better to just blacklist the whole lot though.

These UARTs also share the same page, what prevents the user to use these UARTs?

Nothing, but because they don't share a page with the xen UART they don't cause it to get exposed to dom0.

Quoted 2 lines

I have noticed that all the UARTs, except UART0, have a property :
status = "disabled". So Xen won't map the UART in dom0 memory.

That bit is new since I initially wrote this patch.

Quoted 6 lines
Quoted 2 lines

Ultimately this is just a hack for the fact that Xen is not currently smart enough to figure out which devices conflict in this way...

After my comment above, do we really need to blacklist all the other UARTs? As we only support the cubieboard 2, if we only want a hack, I think we can safely avoid this patch for now.

There are quite a few Allwinner A20 based devices out there, e.g. I've got a MELE M5 which I ultimately hope will work too, so I'd be reluctant to hardcode cubie specifics.

Probably just blacklisting all the UARTs is the easiest way to go for now -- typically only one of them is usefully exposed on the systems I've seen anyway and most of the others are pin muxed with something more useful, like an MMC device.

Ian.

#17 lore raw

Re: [PATCH 7/7] xen/arm: Blacklist some sun7i UARTs

Quoted 16 lines · Ian Campbell
Quoted 15 lines · Julien Grall
Quoted 14 lines · Ian Campbell
Quoted 11 lines · Julien Grall

xen/arch/arm/platforms/sunxi.c static const char const *sunxi_dt_compat[] __initdata = · line 40

Quoted 8 lines
xen/arch/arm/platforms/sunxi.c +8 -0
+    /*
+     * These UARTs share a page with the Xen console UART, so we don't
+     * want to map them through.
+     */
+    DT_MATCH_PATH("/soc@01c00000/serial@01c28000"),
+    DT_MATCH_PATH("/soc@01c00000/serial@01c28400"),
+    DT_MATCH_PATH("/soc@01c00000/serial@01c28800"),
+    DT_MATCH_PATH("/soc@01c00000/serial@01c28c00"),

Can we blacklist all the UARTs via a DT_MATCH_COMPATIBLE? It's better than relying on the path that can be changed easily in the device tree.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

There are other UARTS (at 0x1c29xxx) which could safely be exposed to dom0. Perhaps it is better to just blacklist the whole lot though.

These UARTs also share the same page, what prevents the user to use these UARTs?

Nothing, but because they don't share a page with the xen UART they don't cause it to get exposed to dom0.

My question wasn't clear. What does prevent the user to use another UART for Xen?

Signature · 1 line
Julien Grall
#18 lore raw

Re: [PATCH 7/7] xen/arm: Blacklist some sun7i UARTs

Quoted 15 lines · Julien Grall
Quoted 14 lines · Ian Campbell
Quoted 13 lines · Julien Grall
Quoted 12 lines · Ian Campbell
Quoted 10 lines · Julien Grall

xen/arch/arm/platforms/sunxi.c static const char const *sunxi_dt_compat[] __initdata = · line 40

Quoted 8 lines
xen/arch/arm/platforms/sunxi.c +8 -0
+    /*
+     * These UARTs share a page with the Xen console UART, so we don't
+     * want to map them through.
+     */
+    DT_MATCH_PATH("/soc@01c00000/serial@01c28000"),
+    DT_MATCH_PATH("/soc@01c00000/serial@01c28400"),
+    DT_MATCH_PATH("/soc@01c00000/serial@01c28800"),
+    DT_MATCH_PATH("/soc@01c00000/serial@01c28c00"),

Can we blacklist all the UARTs via a DT_MATCH_COMPATIBLE? It's better than relying on the path that can be changed easily in the device tree.

Quoted 9 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

There are other UARTS (at 0x1c29xxx) which could safely be exposed to dom0. Perhaps it is better to just blacklist the whole lot though.

These UARTs also share the same page, what prevents the user to use these UARTs?

Nothing, but because they don't share a page with the xen UART they don't cause it to get exposed to dom0.

My question wasn't clear. What does prevent the user to use another UART for Xen?

Nothing "prevents" it. That is the problem. If several UARTs are on the same page, Xen cannot safely isolate its UART from dom0/domU.

~Andrew

#19 lore raw

Re: [PATCH 7/7] xen/arm: Blacklist some sun7i UARTs

Quoted 20 lines · Andrew Cooper
Quoted 19 lines · Julien Grall
Quoted 18 lines · Ian Campbell
Quoted 17 lines · Julien Grall
Quoted 10 lines · Ian Campbell
Quoted 8 lines · Julien Grall
Quoted 8 lines
(quoted diff) +8 -0
+    /*
+     * These UARTs share a page with the Xen console UART, so we don't
+     * want to map them through.
+     */
+    DT_MATCH_PATH("/soc@01c00000/serial@01c28000"),
+    DT_MATCH_PATH("/soc@01c00000/serial@01c28400"),
+    DT_MATCH_PATH("/soc@01c00000/serial@01c28800"),
+    DT_MATCH_PATH("/soc@01c00000/serial@01c28c00"),
Quoted 4 lines
Quoted 2 lines

Can we blacklist all the UARTs via a DT_MATCH_COMPATIBLE? It's better than relying on the path that can be changed easily in the device tree.

There are other UARTS (at 0x1c29xxx) which could safely be exposed to dom0. Perhaps it is better to just blacklist the whole lot though.

These UARTs also share the same page, what prevents the user to use these UARTs?

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Nothing, but because they don't share a page with the xen UART they don't cause it to get exposed to dom0.

My question wasn't clear. What does prevent the user to use another UART for Xen?

Nothing "prevents" it. That is the problem. If several UARTs are on the same page, Xen cannot safely isolate its UART from dom0/domU.

He meant one of the other UARTs not on the same page as the primary one. The answer is "not much".

However UART0 @ 0x1c28000 is the "debug" UART which is the one typically wired up in a useful way on these platforms. The others are pin-muxed with other functionality, such as MMC, LCD etc and are more often used as such (I'm sure there will be exceptions).

That said Julien is probably right that the best solution is to just blacklist all 8 UARTs.

Ian.

#20 lore raw
In reply to Ian Campbell
Quoted 6 lines · Ian Campbell

Previously I was able to boot to a panic due to not finding a root filesystem. This seems to have regressed and now it hangs during dom0 boot. I'm not sure why this is but I think it is because I've rebased my dom0 kernel and not something in this series. I don't think this needs to block this series though, especially since the APM guys want bits of it (specifically the ns16550 DT stuff).

I've applied the first 5:
45b1870 xen/arm: Implement ioremap.
204cb1e xen/arm: replace io{read,write}{l,b} with {read,write}{l,b} 7c1de00 ns16550: make usable on ARM
50417cd ns16550: support DesignWare 8250
7b3c792 xen/arm: Support Cortex-A7 GIC

Which in particular includes the ns16550 dt stuff that others are looking for.