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

Re: [Xen-devel] Problems building and running Xen on Hikey960

Hi Matthew,

On 28/11/2018 06:43, Matthew Daley wrote:
> On Mon, 26 Nov 2018 at 14:07, Matthew Daley <mattd@xxxxxxxxxxx> wrote:
>> On Fri, 23 Nov 2018 at 09:51, Julien Grall <julien.grall@xxxxxxx> wrote:
>>> Hi Matthew,
>>> Sorry for the late answer and thank you for testing the patch.
>>> On 11/13/18 10:43 PM, Matthew Daley wrote:
>>>> On Tue, 13 Nov 2018 at 02:01, Julien Grall <julien.grall@xxxxxxx> wrote:
>>>>> On 11/11/18 1:15 AM, Matthew Daley wrote:
>>>> I gave this a go but unfortunately the same problem occurs (error
>>>> -9s). Just to check nothing weird is happening I added a printk to
>>>> check the value of __pa(init_secondary) in call_psci_cpu_on, giving
>>>> 0xdfe00180.
>>> I have posted a patch that disables completely the relocation [1]. Could
>>> you have a try and see whether it works now?
>>> Cheers,
>>> [1] https://lists.xen.org/archives/html/xen-devel/2018-11/msg02638.html
>>> --
>>> Julien Grall
>> Hi Julien,
>> Unfortunately with this patch it appears to freeze after the call to 
>> switch_ttbr(ttbr).
>> - Matthew
> So looking at setup_pagetables, my understanding is that it sets up a
> 2MiB mapping for Xen's .text section (before then splitting it into
> 4KiB pages). However, GRUB is loading Xen in RAM at 0xB8736000 for me.
> This isn't 2MiB aligned (and isn't in low memory either!), so I can't
> see how this would work; it still requires relocation or a more
> granular mapping, no?

I missed the fact that we configure the PE/COFF header with 4KB alignment.
Therefore UEFI is free to load Xen at any address 4KB aligned.

I managed to reproduce it on some UEFI platform and came up with
the following patch:

commit 6b268dd4ae2b433ab7314347bada3889a483a8a5
Author: Julien Grall <julien.grall@xxxxxxx>
Date:   Wed Nov 28 12:59:27 2018 +0000

    xen/arm64: Request UEFI to load Xen at a 2MB aligned address
    At the moment, UEFI will load Xen at a 4KB aligned address while
    bootloader using the Image format will load at 2MB aligned address.
    Using 2MB aligned address will help to simplify Xen boot process. So
    also switch UEFI to load at 2MB aligned address.
    Signed-off-by: Julien Grall <julien.grall@xxxxxxx>
        This patch should allow us to remove a lot of code in the head.S to
        cater the 4KB case.

diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S
index 4589a37874..0d1b1202fa 100644
--- a/xen/arch/arm/arm64/head.S
+++ b/xen/arch/arm/arm64/head.S
@@ -175,7 +175,7 @@ optional_header:
         .quad   0                               /* ImageBase */
-        .long   0x1000                          /* SectionAlignment (4 KByte) 
+        .long   0x200000                        /* SectionAlignment (2 MByte) 
         .long   0x8                             /* FileAlignment */
         .short  0                               /* MajorOperatingSystemVersion 
         .short  0                               /* MinorOperatingSystemVersion 

So now arm64 always request to be loaded at 2MB aligned address. However it 
that arm32 only request 4KB alignment. I will rework the patch to use 4KB 
when setting up Xen.


Julien Grall

Xen-devel mailing list



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