Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759478AbcDMJCM (ORCPT ); Wed, 13 Apr 2016 05:02:12 -0400 Received: from smtp.citrix.com ([66.165.176.89]:21759 "EHLO SMTP.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753404AbcDMJCG (ORCPT ); Wed, 13 Apr 2016 05:02:06 -0400 X-IronPort-AV: E=Sophos;i="5.24,479,1454976000"; d="scan'208";a="346766721" Date: Wed, 13 Apr 2016 11:02:02 +0200 From: Roger Pau =?iso-8859-1?Q?Monn=E9?= To: Andy Lutomirski CC: Juergen Gross , "Luis R. Rodriguez" , David Vrabel , Julien Grall , Stefano Stabellini , Andrew Cooper , Boris Ostrovsky , Matt Fleming , Charles Arndol , Jim Fehlig , Jan Beulich , Daniel Kiper , "H. Peter Anvin" , X86 ML , Gary Lin , Borislav Petkov , joeyli , Jeffrey Cheung , Michael Chang , =?utf-8?Q?Vojt=C4=9Bch_Pavl=C3=ADk?= , "linux-kernel@vger.kernel.org" , "xen-devel@lists.xenproject.org" , "Linus Torvalds" Subject: Re: HVMLite / PVHv2 - using x86 EFI boot entry Message-ID: <20160413090202.bg2vfdl3iol7eedv@mac> References: <20160406024027.GX1990@wotan.suse.de> <5704D978.1050101@citrix.com> <20160408204032.GR1990@wotan.suse.de> <570B3228.90400@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.0-neo (2016-04-07) X-DLP: MIA1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4734 Lines: 94 On Tue, Apr 12, 2016 at 02:02:52PM -0700, Andy Lutomirski wrote: > On Sun, Apr 10, 2016 at 10:12 PM, Juergen Gross wrote: > > On 08/04/16 22:40, Luis R. Rodriguez wrote: > >> On Wed, Apr 06, 2016 at 10:40:08AM +0100, David Vrabel wrote: > >>> On 06/04/16 03:40, Luis R. Rodriguez wrote: > >>>> > >>>> * You don't need full EFI emulation > >>> > >>> I think needing any EFI emulation inside Xen (which is where it would > >>> need to be for dom0) is not suitable because of the increase in > >>> hypervisor ABI. > >> > >> Is this because of timing on architecture / design of HVMLite, or > >> a general position that the complexity to deal with EFI emulation > >> is too much for Xen's taste ? > > > > The Xen hypervisor should be as small as possible. Adding an EFI > > emulator will be adding quite some code. This should be done after a > > very thorough evaluation only. > > > >> ARM already went the EFI entry way for domU -- it went the OVMF route, > >> would such a possibility be possible for x86 domU HVMLite ? If not why > >> not, I mean it would seem to make sense to at least mimic the same type > >> of early boot environment, and perhaps there are some lessons to be > >> learned from that effort too. > > > > The final solution must be appropriate for dom0, too. So don't try > > to limit the discussion to domU. If dom0 isn't going to be acceptable > > there will no need to discuss domU. > > > >> Are there some lessons to be learned with ARM's effort? What are they? > >> If that could be re-done again with any type of cleaner path, what > >> could that be that could help the x86 side ? > >> > >> Although emulating EFI may require work, some folks have pointed out > >> that the amount of work may not be that much. If that is done can > >> we instead rely on the same code to replace OVMF to support both > >> Xen ARM and Xen HVMLite on x86 ? What would be the pros / cons of > >> this ? > >> > >>> I also still do not understand your objection to the current tiny stub. > >> > >> Its more of a hypothetical -- can an EFI entry be used instead given > >> it already does exactly what the new small entry does ? Its also rather > >> odd to add a new entry without evaluating fully a possible alternative > >> that would provide the same exact mechanism. > > > > The interface isn't the new entry only. It should be evaluated how much > > of the early EFI boot path would be common to the HVMlite one. What > > would be gained by using the same entry but having two different boot > > paths after it? You still need a way to distinguish between bare metal > > EFI and HVMlite. And Xen needs a way to find out whether a kernel is > > supporting HVMlite to boot it in the correct mode. > > > >> A full technical unbiased evaluation of the different approaches is what I'd > >> hope we could strive to achieve through discussion and peer review, thinking > >> and prioritizing ultimately what is best to minimize the impact on Linux > >> and also help take advantage of the best features possible through both > >> means. Thinking long term, not immediate short term. > > > > Sure. > > FWIW, someone just pointed me to u-boot's EFI implementation. > u-boot's lib/efi_loader contains a tiny (<3k LOC, 10kB compiled) UEFI > implementation that's sufficient to boot a Linux EFI payload. I guess this is a pretty minimal EFI implementation, is this something standard, or just an EFI implementation tailored to Linux needs? (ie: is there any standard EFI flag to signal this kind of minimal EFI environment?) > An argument against making Xen's default domU entry use UEFI is that > it might become unnecessarily awkward to do something like > chainloading to OVMF. But maybe OVMF can be compiled as a UEFI > binary :) With my FreeBSD committer hat: The FreeBSD kernel doesn't contain an EFI entry point, it just contains one single entry point that's used for both legacy BIOS and EFI. Then the FreeBSD loader is the one that contains the different entry points. I would really like to avoid adding an EFI entry point and the PE header to the FreeBSD kernel. The current trampoline in FreeBSD to tie the Xen entry point into the native path contains 96 lines of assembly (half of them are actually comments) and 66 lines of C. I think adding an EFI entry point is going to add a lot more of code than this, and we would probably need changes to the build system in order to assembly the PE header and the ELF headers together. IMHO, if we want to boot PVH using EFI the right solution is to use OVMF (or any other UEFI firmware) and port it so it's able to run as a PVH guest. I guess it should even be possible to use it for Dom0, although I think this is cumbersome. Roger.