[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] ARM:Booting xen on pine64 board



Thanks All

I will try the patch suggested by Julien and update you.

As of now I am running dom0(Linux 4.11-rc5) without early printk enabled in xen which is working absolutely fine.


On Wed, Apr 5, 2017 at 2:32 AM, Julien Grall <julien.grall@xxxxxxx> wrote:
Hi,

On 04/04/2017 21:45, Stefano Stabellini wrote:
> On Tue, 4 Apr 2017, Andre Przywara wrote:
>> Hi,
>>
>> On 04/04/17 20:02, Stefano Stabellini wrote:
>>> Also CC'ing Andre that I think has a pine64.
>>>
>>> On Tue, 4 Apr 2017, Stefano Stabellini wrote:
>>>> On Sat, 1 Apr 2017, bharat gohil wrote:
>>>>> Hello
>>>>
>>>> Hello Bharat, thanks for your email.
>>>>
>>>>
>>>>> I am trying to boot xen(debug build) on pine64 ARM64 based board but its hangs at following position,
>>>>>
>>>>> - UART enabled -
>>>>> - CPU 00000000 booting -
>>>>> - Current EL 00000008 -
>>>>> - Xen starting at EL2 -
>>>>> - Zero BSS -
>>>>> - Setting up control registers -
>>>>> - Turning on paging -
>>>>> - Ready -
>>>>> (XEN) Checking for initrd in /chosen
>>>>> (XEN) RAM: 0000000041000000 - 000000007fffffff
>>>>> (XEN)
>>>>> (XEN) MODULE[0]: 000000007e200000 - 000000007e202000 Device Tree
>>>>> (XEN) MODULE[1]: 000000007e400000 - 000000007ef46a00 Kernel       console=hvc0 ro root=/dev/mmcblk0p2 clk_ignore_unused rootwait
>>>>> (XEN)  RESVD[0]: 000000007e200000 - 000000007e202000
>>>>> (XEN)
>>>>> (XEN) Command line: dtuart=serial0 earlyprint loglvl=all conswitch=x dom0_mem=128M
>>>>> (XEN) Placing Xen at 0x000000007fc00000-0x000000007fe00000
>>>>> (XEN) Update BOOTMOD_XEN from 000000007fe00000-000000007fefad81 => 000000007fc00000-000000007fcfad81
>>>>> (XEN) Booting using Device Tree
>>>>> (XEN) Domain heap initialised
>>>>> (XEN) Platform: Generic System
>>>>> (XEN) Looking for dtuart at "serial0", options ""
>>>>>  Xen 4.9-unstable
>>>>> (XEN) Xen version 4.9-unstable (bgohil@) (aarch64-linux-gnu-gcc (Linaro GCC 6.2-2016.11) 6.2.1 20161016) debug=n  Tue Mar 28 16:12:32 IST 2017
>>>>> (XEN) Latest ChangeSet: Fri Mar 24 14:19:47 2017 +0100 git:5b08f85
>>>>> (XEN) Processor: 410fd034: "ARM Limited", variant: 0x0, part 0xd03, rev 0x4
>>>>> (XEN) 64-bit Execution:
>>>>> (XEN)   Processor Features: 0000000000002222 0000000000000000
>>>>> (XEN)     Exception Levels: EL3:64+32 EL2:64+32 EL1:64+32 EL0:64+32
>>>>> (XEN)     Extensions: FloatingPoint AdvancedSIMD
>>>>> (XEN)   Debug Features: 0000000010305106 0000000000000000
>>>>> (XEN)   Auxiliary Features: 0000000000000000 0000000000000000
>>>>> (XEN)   Memory Model Features: 0000000000001122 0000000000000000
>>>>> (XEN)   ISA Features:  0000000000011120 0000000000000000
>>>>> (XEN) 32-bit Execution:
>>>>> (XEN)   Processor Features: 00000131:00011011
>>>>> (XEN)     Instruction Sets: AArch32 A32 Thumb Thumb-2 Jazelle
>>>>> (XEN)     Extensions: GenericTimer Security
>>>>> (XEN)   Debug Features: 03010066
>>>>> (XEN)   Auxiliary Features: 00000000
>>>>> (XEN)   Memory Model Features: 10201105 40000000 01260000 02102211
>>>>> (XEN)  ISA Features: 02101110 13112111 21232042 01112131 00011142 00011121
>>>>> (XEN) Using PSCI-0.2 for SMP bringup
>>>>> (XEN) SMP: Allowing 4 CPUs
>>>>> (XEN) Generic Timer IRQ: phys=30 hyp=26 virt=27 Freq: 24000 KHz
>>>>> (XEN) GICv2 initialization:
>>>>> (XEN)         gic_dist_addr=0000000001c81000
>>>>> (XEN)         gic_cpu_addr=0000000001c82000
>>>>> (XEN)         gic_hyp_addr=0000000001c84000
>>>>> (XEN)         gic_vcpu_addr=0000000001c86000
>>>>> (XEN)         gic_maintenance_irq=25
>>>>> (XEN) GICv2: 224 lines, 4 cpus, secure (IID 0200143b).
>>>>> (XEN) Using scheduler: SMP Credit Scheduler (credit)
>>>>>
>>>>> but when I boot dtuart=<unknown value> say duart=xyz instead of dtuart=serial0, xen booted successfully but Dom0 crash while probing 'serial0' driver.
>>>>>
>>>>> If I remove 'serial0' node from device tree, Dom0 boot successfully but unable to enter input into 'hvc' console.
>>>>>
>>>>> what could be wrong here or missing something?
>>>>
>>>> What is your dom0 command line? Are you passing console=hvc0?
>>>>
>>>> It looks like pine64 is using an allwinner sun50i-uart, for which we
>>>> don't have a proper driver in Xen yet. That is probably the reason why
>>>> you can see some output from Xen, but you cannot type anything in later
>>>> in Dom0 (which is sent to Xen via the HVC console).  Please send a patch
>>>> to add a simple sun50i-uart driver (see xen/drivers/char/). Given that
>>>> both Xen and Linux are GPLv2, you can import code from Linux if you find
>>>> it appropriate.
>>
>> The UART is exactly the same as in the other Allwinner SoCs, so there is
>> no need for a new UART driver.
>> Another issue inherited from the 32-bit Allwinner chips is that the
>> first four UARTs share a page, so they have to be blacklisted, as Xen
>> can't properly separate them.
>> You might want to look at xen/arch/arm/platforms/sunxi.c. Not sure if
>> this needs to be tied in arm64 somehow.
>
> No, it doesn't, it should work on arm64 out of the box. But the platform
> compatible string is different: "sun7i-a20" in sunxi.c and "sun50iw1p1"
> on the pine64 dts. If the board is exactly the same, then we only need
> to add "sun50iw1p1" to sunxi_dt_compat.
>
> What do you do to boot it with Xen?

I played with the Pine64 and Xen last year. There are some work to do in
order to get Xen booting on the board. It is not fully complete as I lacked
of time. For instance the clock frequency has been hardcoded in the ns16550
driver (the UART for pine64 is a derivation of ns16550)...

Below the changes I had to made to get DOM0 booting. IIRC I was struggling
to get the input working. The UART is the same as the cubietruck, but
somehow it behaves differently (not sure why) and therefore there is some
missing pieces in the driver.

I hope this helps.

Cheers,

diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S
index 5c28c20..af4db28 100644
--- a/xen/arch/arm/arm64/head.S
+++ b/xen/arch/arm/arm64/head.S
@@ -115,7 +115,7 @@ efi_head:
         add     x13, x18, #0x16
         b       real_start           /* branch to kernel start */
         .quad   0x80000              /* Image load offset from start of RAM */
-        .quad   0                    /* reserved */
+        .quad   _end - start        /* reserved */
         .quad   0                    /* reserved */
         .quad   0                    /* reserved */
         .quad   0                    /* reserved */
diff --git a/xen/arch/arm/platforms/Makefile b/xen/arch/arm/platforms/Makefile
index 3689eec..99d6ab1 100644
--- a/xen/arch/arm/platforms/Makefile
+++ b/xen/arch/arm/platforms/Makefile
@@ -3,7 +3,7 @@ obj-$(CONFIG_ARM_32) += brcm.o
 obj-$(CONFIG_ARM_32) += exynos5.o
 obj-$(CONFIG_ARM_32) += midway.o
 obj-$(CONFIG_ARM_32) += omap5.o
-obj-$(CONFIG_ARM_32) += sunxi.o
+obj-y += sunxi.o
 obj-$(CONFIG_ARM_32) += rcar2.o
 obj-$(CONFIG_ARM_64) += seattle.o
 obj-$(CONFIG_ARM_64) += xgene-storm.o
diff --git a/xen/arch/arm/platforms/sunxi.c b/xen/arch/arm/platforms/sunxi.c
index 0ba7b3d..cee31c7 100644
--- a/xen/arch/arm/platforms/sunxi.c
+++ b/xen/arch/arm/platforms/sunxi.c
@@ -52,6 +52,7 @@ static void sunxi_reset(void)
 static const char * const sunxi_dt_compat[] __initconst =
 {
     "allwinner,sun7i-a20",
+    "allwinner,sun50i-a64",
     NULL
 };

diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index b2b5f56..9933c7e 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -461,6 +461,8 @@ static int ns16550_ioport_invalid(struct ns16550 *uart)
     return ns_read_reg(uart, UART_IER) == 0xff;
 }

+#include <xen/early_printk.h>
+
 static void ns16550_interrupt(
     int irq, void *dev_id, struct cpu_user_regs *regs)
 {
@@ -476,7 +478,17 @@ static void ns16550_interrupt(
         if ( (lsr & uart->lsr_mask) == uart->lsr_mask )
             serial_tx_interrupt(port, regs);
         if ( lsr & UART_LSR_DR )
+        {
+            early_puts("Receive data\n");
             serial_rx_interrupt(port, regs);
+        }
+    }
+
+    if ( uart->dw_usr_bsy &&
+         (ns_read_reg(uart, UART_IIR) & UART_IIR_BSY) == UART_IIR_BSY)
+    {
+        ns_read_reg(uart, UART_USR);
+        return;
     }
 }

@@ -1217,7 +1229,7 @@ static int __init ns16550_uart_dt_init(struct dt_device_node *dev,

     ns16550_init_common(uart);

-    uart->baud      = BAUD_AUTO;
+    uart->baud      = 115200;
     uart->data_bits = 8;
     uart->parity    = UART_PARITY_NONE;
     uart->stop_bits = 1;

>

--
Julien Grall



--
Regards,
Bharat Gohil
Sr.Software Engineer
+919427054633
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.