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

RE: Proposal for Porting Xen to Armv8-R64 - DraftA


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Wei Chen <Wei.Chen@xxxxxxx>
  • Date: Tue, 8 Mar 2022 07:28:23 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gizHt90rMvtQzd/SsI6Q733YarjsdfP1ZD88mhvTwcQ=; b=d5OqkbSxtUG6g09prgFF+pa31d4PXxyooeS/WzopBj9vWZuCQAWn/2oPS4srAXA2X53N9f5uI7Eh6Fsfs7cSjvegTWY0vBQP52Ke3SJy1yU6ke8uoZmaH3ltWzssVp9gQpcTZFvUoLvpD/IFmZxCbLUyVqXxIi/8RkFZPyUXo2ALV5dRZ8IKzaG/6c1FSMF8q0YFzx3OkhthCAz9O2ZJTYwZSIPM/IMC7ZhShLgoukEhpqJ1hmvK/uDIUFNi7qtilPUppnAsfBR3Y8UmSitCGpy+3BZPDMYfExO+2coD2VZaIpDr2LWan/maJ/keFAO+NFDILm/noJTU+qk0lBCn5g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XCV2pPt8PCh5NahgzF2D0nytL3DuHaiVt4/JJEKIs4bA8ib8TIhwgGbzrGMvnVa8Lnb2oraKLeJY9VsEgji1zqrfrJtAAbjwkdm1yqdTqbdu6B9jyfgxxXH8OZUs7Hcp44h4+XWOIyuTwzPftPpZkYB3Ez2MtinffY/MxTW0yhTHDmHuwqEO1dmiErvnLVMJN4+ScKY8NO6Ph2kJsymhl7SbOYnxkoeAfOzsJeedgHuIutDzu36X1MQ4RtF5QZNphan2wGKRUjYThyH1ctvGZ+onXFId4r0s1FYXK8A7RTmw0UMeBrzapGwS1GfTvnmYs0RRdFpFSVfXwdcMK5okpw==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Julien Grall <julien@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Penny Zheng <Penny.Zheng@xxxxxxx>, Henry Wang <Henry.Wang@xxxxxxx>, nd <nd@xxxxxxx>
  • Delivery-date: Tue, 08 Mar 2022 07:29:11 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AdgpQxtXwh7LkfydTgiYk9bhMgU+ogBRt1sAAKse4VAAPag1gAAckyvAAMo7i2AAK6G7AAAQksLg
  • Thread-topic: Proposal for Porting Xen to Armv8-R64 - DraftA

Hi Stefano,

> -----Original Message-----
> From: Xen-devel <xen-devel-bounces@xxxxxxxxxxxxxxxxxxxx> On Behalf Of
> Stefano Stabellini
> Sent: 2022年3月8日 6:58
> To: Wei Chen <Wei.Chen@xxxxxxx>
> Cc: Julien Grall <julien@xxxxxxx>; xen-devel@xxxxxxxxxxxxxxxxxxxx; Stefano
> Stabellini <sstabellini@xxxxxxxxxx>; Bertrand Marquis
> <Bertrand.Marquis@xxxxxxx>; Penny Zheng <Penny.Zheng@xxxxxxx>; Henry Wang
> <Henry.Wang@xxxxxxx>; nd <nd@xxxxxxx>
> Subject: RE: Proposal for Porting Xen to Armv8-R64 - DraftA
> 
> On Mon, 7 Mar 2022, Wei Chen wrote:
> > > > On 01/03/2022 07:51, Wei Chen wrote:
> > > > >>> ### 1.2. Xen Challenges with PMSA Virtualization
> > > > >>> Xen is PMSA unaware Type-1 Hypervisor, it will need
> modifications to
> > > > run
> > > > >>> with an MPU and host multiple guest OSes.
> > > > >>>
> > > > >>> - No MMU at EL2:
> > > > >>>       - No EL2 Stage 1 address translation
> > > > >>>           - Xen provides fixed ARM64 virtual memory layout as
> basis
> > > of
> > > > >> EL2
> > > > >>>             stage 1 address translation, which is not applicable
> on
> > > > MPU
> > > > >> system,
> > > > >>>             where there is no virtual addressing. As a result,
> any
> > > > >> operation
> > > > >>>             involving transition from PA to VA, like ioremap,
> needs
> > > > >> modification
> > > > >>>             on MPU system.
> > > > >>>       - Xen's run-time addresses are the same as the link time
> > > > addresses.
> > > > >>>           - Enable PIC (position-independent code) on a real-
> time
> > > > target
> > > > >>>             processor probably very rare.
> > > > >>
> > > > >> Aside the assembly boot code and UEFI stub, Xen already runs at
> the
> > > > same
> > > > >> address as it was linked.
> > > > >>
> > > > >
> > > > > But the difference is that, base on MMU, we can use the same link
> > > > address
> > > > > for all platforms. But on MPU system, we can't do it in the same
> way.
> > > >
> > > > I agree that we currently use the same link address for all the
> > > > platforms. But this is also a problem when using MMU because EL2 has
> a
> > > > single TTBR.
> > > >
> > > > At the moment we are switching page-tables with the MMU which is not
> > > > safe. Instead we need to turn out the MMU off, switch page-tables
> and
> > > > then turn on the MMU. This means we need to have an identity mapping
> of
> > > > Xen in the page-tables. Assuming Xen is not relocated, the identity
> > > > mapping may clash with Xen (or the rest of the virtual address map).
> > > >
> > >
> > > Is this the same reason we create a dummy reloc section for EFI loader?
> > >
> > > > My initial idea was to enable PIC and update the relocation at boot
> > > > time. But this is a bit cumbersome to do. So now I am looking to
> have a
> > > > semi-dynamic virtual layout and find some place to relocate part of
> Xen
> > > > to use for CPU bring-up.
> > > >
> > > > Anyway, my point is we possibly could look at PIC if that could
> allow
> > > > generic Xen image.
> > > >
> > >
> > > I understand your concern. IMO, PIC is possible to do this, but
> obviously,
> > > it's not a small amount of work. And I want to hear some suggestions
> from
> > > Stefano, because he also has some solutions in previous thread.
> > >
> >
> > Can you have a look at the PIC discussion between Julien and me?
> > I think we may need some inputs from your view.
> 
> If we have to have a build-time device tree anyway, we could
> automatically generate the link address, together with other required
> addresses. There would little benefit to do PIC if we have to have a
> build-time device tree in any case.
> 
> On the other hand, if we could get rid of the build-time device tree
> altogether, then yes doing PIC provides some benefits. It would allow us
> to have single Xen binary working on multiple Cortex-R boards. However,
> I don't think that would be important from a user perspective. People
> will not install Ubuntu on a Cortex-R and apt-get xen.  The target is
> embedded: users will know from the start the board they will target, so
> it would not be a problem for them to build Xen for a specific board.
> ImageBuilder (or something like it) will still be required to generate
> boot scripts and boot info. In other words, although it would be
> convenient to produce a generic binary, it is not a must-have feature
> and I would consider it low-priority compared to others.

I tend to agree with your opinion. We can get some benefit from PIC,
but the priority may be low. We have encountered a problem when we're
trying to use EFI loader to boot xen.efi on v8R. Due to lack of relocation
capability, the EFI loader could not launch xen.efi on V8R. But Xen EFI
boot capability is a requirement of Arm EBBR [1]. In order to support Xen
EFI boot on V8R, may be we still need a partially supported PIC. Only some
boot code support PIC to make EFI relocation happy. This boot code will
help Xen to check its loaded address and relocate Xen image to Xen's
run-time address if need.

How about we place PIC support to TODO list for further discussion,
I don't think we can include so many items in day1 : ) 

[1]https://arm-software.github.io/ebbr/index.html

Cheers,
Wei Chen



 


Rackspace

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