From: Julien Grall <julien.grall@linaro.org>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: stefano.stabellini@eu.citrix.com, tim@xen.org, xen-devel@lists.xen.org
Subject: Re: [PATCH 2/5] xen: arm: Handle 4K aligned hypervisor load address.
Date: Tue, 15 Jul 2014 13:03:58 +0100 [thread overview]
Message-ID: <53C518AE.4020808@linaro.org> (raw)
In-Reply-To: <1405422612.9794.19.camel@kazak.uk.xensource.com>
On 15/07/14 12:10, Ian Campbell wrote:
> On Tue, 2014-07-15 at 12:07 +0100, Julien Grall wrote:
>>
>> On 15/07/14 12:03, Julien Grall wrote:
>>>
>>>
>>> On 15/07/14 10:13, Ian Campbell wrote:
>>>> On Mon, 2014-07-14 at 23:33 +0100, Julien Grall wrote:
>>>>> Hi Ian,
>>>>>
>>>>> On 14/07/14 17:39, Ian Campbell wrote:
>>>>>> Currently the boot page tables map Xen at XEN_VIRT_START using a 2MB
>>>>>> section
>>>>>> mapping. This means that the bootloader must load Xen at a 2MB
>>>>>> aligned address.
>>>>>> Unfortunately this is not the case with UEFI on the Juno platform
>>>>>> where Xen
>>>>>> fails to boot. Furthermore the Linux boot protocol (which Xen claims
>>>>>> to adhere
>>>>>> to) does not have this restriction, therefore this is our bug and
>>>>>> not the
>>>>>> bootloader's.
>>>>>>
>>>>>> Fix this by adding third level pagetables to the boot time
>>>>>> pagetables, allowing
>>>>>> us to map a Xen which is aligned only to a 4K boundary. This only
>>>>>> affects the
>>>>>> boot time page tables since Xen will later relocate itself to a 2MB
>>>>>> aligned
>>>>>> address. Strictly speaking the non-boot processors could make use of
>>>>>> this and
>>>>>> use a section mapping, but it is simpler if all processors follow
>>>>>> the same boot
>>>>>> path.
>>>>>
>>>>> OOI, did you think about the solution to copy Xen to a 2MB aligned
>>>>> address before setup the early page table?
>>>>
>>>> I did but I was worried about clobbering something useful, like a boot
>>>> module.
>>>>
>>>>> It would avoid to use third level page table during boot
>>>>
>>>> This isn't really that expensive, and it's marked __init so it goes away
>>>> after boot.
>>>>
>>>>> but will
>>>>> introduce an extra copy of Xen (only for the boot processor).
>>>>>
>>>>> FYI, it's what Linux does.
>>>>
>>>> Interesting, how does it choose the address? Just by rounding down the
>>>> loading address?
>>>
>>> For ARM32 yes.
>>>
>>> For ARM64, I don't find anything about relocating the Image. AFAIU, they
>>> use a field in the header to specify at which offset we need to load the
>>> kernel from the RAM base address.
>>>
>>> On Xen, this field is set to 0, which means loading at any address. So I
>>> suspect for ARM64 we can change this offset and avoid to modify page
>>> table code.
>>
>> Hrm... I misread the documentation for this part.
>>
>> "The image must be placed at the specified offset (currently 0x80000)
>> from the start of the system RAM and called there. The start of the
>> system RAM must be aligned to 2MB."
>>
>
> Regardless of this being more flexible in what load addresses we accept
> is relatively easy, has no impact after boot and the code is already
> written.
I stopped to count the number of patch I completely reworked after the
first version...
I think this is adding complexity in the assembly code and restriction
(see your panic) where the bootloader load Xen in the memory. Even
though, the restriction where already there but hidden by the fact we
are using 2MB mapping.
This could be replaced by:
ARM32: adding a couple of assembly lines to relocate down to a 2MB
address.
ARM64: using the offset in the Image, unless if we released
bootloader is not able to correctly cope with it.
Regards,
--
Julien Grall
next prev parent reply other threads:[~2014-07-15 12:03 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-14 16:38 [PATCH 0/5] xen: arm: various improvements to boot time page table handling Ian Campbell
2014-07-14 16:39 ` [PATCH 1/5] xen: arm: correct whitespace/comments and use #defines in head.S Ian Campbell
2014-07-14 18:37 ` Julien Grall
2014-07-14 16:39 ` [PATCH 2/5] xen: arm: Handle 4K aligned hypervisor load address Ian Campbell
2014-07-14 22:33 ` Julien Grall
2014-07-15 9:13 ` Ian Campbell
2014-07-15 11:03 ` Julien Grall
2014-07-15 11:07 ` Julien Grall
2014-07-15 11:10 ` Ian Campbell
2014-07-15 12:03 ` Julien Grall [this message]
2014-07-15 15:18 ` Ian Campbell
2014-07-16 15:18 ` Julien Grall
2014-07-16 16:54 ` Ian Campbell
2014-07-16 15:41 ` Julien Grall
2014-07-16 16:53 ` Ian Campbell
2014-07-16 17:49 ` Julien Grall
2014-07-17 9:38 ` Ian Campbell
2014-07-14 16:39 ` [PATCH 3/5] xen: arm: Do not use level 0 section mappings in boot page tables Ian Campbell
2014-07-14 16:39 ` [PATCH 4/5] xen: arm: avoid unnecessary aliasing " Ian Campbell
2014-07-17 11:37 ` Ian Campbell
2014-07-14 16:39 ` [PATCH 5/5] xen: arm: flush TLB after overwriting 1:1 mapping " Ian Campbell
2014-07-16 18:11 ` Julien Grall
2014-07-17 9:30 ` Ian Campbell
2014-07-18 13:37 ` Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53C518AE.4020808@linaro.org \
--to=julien.grall@linaro.org \
--cc=Ian.Campbell@citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).