From: Ian Campbell Subject: Re: [PATCH v3 2/6] xen: arm: Handle 4K aligned hypervisor load address. Date: Mon, 21 Jul 2014 14:46:11 +0100 Message-ID: <1405950371.5877.13.camel@kazak.uk.xensource.com> References: <1405947513.25022.59.camel@kazak.uk.xensource.com> <1405947600-26047-1-git-send-email-ian.campbell@citrix.com> <1405947600-26047-2-git-send-email-ian.campbell@citrix.com> <20140721132014.GC40391@deinos.phlegethon.org> <1405949358.5877.9.camel@kazak.uk.xensource.com> <20140721133807.GD40391@deinos.phlegethon.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20140721133807.GD40391@deinos.phlegethon.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Tim Deegan Cc: stefano.stabellini@eu.citrix.com, julien.grall@linaro.org, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Mon, 2014-07-21 at 15:38 +0200, Tim Deegan wrote: > At 14:29 +0100 on 21 Jul (1405949358), Ian Campbell wrote: > > On Mon, 2014-07-21 at 15:20 +0200, Tim Deegan wrote: > > > At 13:59 +0100 on 21 Jul (1405947596), Ian Campbell wrote: > > > > +virtphys_clash: > > > > + /* Identity map clashes with boot_third, which we cannot handle yet */ > > > > + PRINT("Unable to build boot page tables - virt and phys addresses clash.\r\n") > > > > > > Please tag this string "- Like so -\r\n" to match the other early output > > > from the boot assembler. > > > > OK. (I may do it on commit unless other comments necessitate a resend) > > Sure. > > > > Presumably we could get around this by making a 4k mapping when the 2M > > > mapping would clash (at the cost of some extra code)? > > > > It might be workable. > > > > We'd have to steal the slot from boot_third to point to 4K worth of 1:1 > > mapping instead of the expected 4K of virtual mapping and then put back > > the virt mapping right after switching to the virtually mapped PC before > > we touch anything mapped via that slot i.e. before touching anything > > after _end_boot. Doing it at the same time as we establish the fixmap > > and dtb mappings would do the trick, I think. > > > > I'd previously concluded this wasn't possible, but don't recall why. > > What am I missing this time? > > We'd be in trouble if we used the slot that covers the boot_third > table itself. We could work around that, e.g. by using a linear PT to > update the mapping, but it's getting a bit intricate. That's not the issue I foresaw, but it is an issue. A linear PT would be a problem if the virt address we picked clashed with the load address. We might be able to get away with mapping boot_third twice, one at it's normal virt address and again at some address just after _end, then using whichever one doesn't clash with the 1:1. > At that point > I'd be inclined to look at ways to get up into C while still PIC and > doing the pagetable build & trampoline from there. Having played with this for grub purposes I don't really trust -fPIC very much on ARM. Although that was trying to be doubly clever so maybe it's OK for more traditional uses. Ian.