All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Daniel Kiper <daniel.kiper@oracle.com>,
	 xen-devel@lists.xenproject.org, grub-devel@gnu.org
Cc: jgross@suse.com, keir@xen.org, ian.campbell@citrix.com,
	phcoder@gmail.com, stefano.stabellini@eu.citrix.com,
	roy.franz@linaro.org, ning.sun@intel.com,
	david.vrabel@citrix.com, jbeulich@suse.com,
	qiaowei.ren@intel.com, richard.l.maliszewski@intel.com,
	gang.wei@intel.com, fu.wei@linaro.org
Subject: Re: [PATCH 18/18] x86: add multiboot2 protocol support for EFI platforms
Date: Tue, 10 Feb 2015 22:41:05 +0000	[thread overview]
Message-ID: <54DA8901.7050603@citrix.com> (raw)
In-Reply-To: <20150210212749.GG2227@olila.local.net-space.pl>

On 10/02/2015 21:27, Daniel Kiper wrote:
> On Fri, Jan 30, 2015 at 06:54:22PM +0100, Daniel Kiper wrote:
>> Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
>> ---
>>  xen/arch/x86/boot/head.S          |  174 +++++++++++++++++++++++++++++++++++--
>>  xen/arch/x86/efi/efi-boot.h       |   29 +++++++
>>  xen/arch/x86/setup.c              |   23 ++---
>>  xen/arch/x86/x86_64/asm-offsets.c |    2 +
>>  xen/common/efi/boot.c             |   11 +++
>>  5 files changed, 222 insertions(+), 17 deletions(-)
> After some testing we have found at least one machine on which this thing
> does not work. It is Dell PowerEdge R820 with latest firmware. Machine
> crashes/stops because early 32-bit code is not relocatable and must live
> under 0x100000 address. (side note: I am surprised how it worked without
> any issue until now; Multiboot protocol, any version, does not guarantee
> that OS image will be loaded at specified/requested address; So, it looks
> that there are not any legacy BIOS machines with e.g. 1 MiB - 2 MiB region
> reserved in the wild or they are not very common; Am I missing something?).
> Sadly, this region is used by BS, so, GRUB2 loads Xen higher (at least
> above 64 MiB). Please look at memory map on this machine:
>
> Type       Start            End              # Pages          Attributes
> BS_Data    0000000000010000-000000000009FFFF 0000000000000090 000000000000000F
> BS_Data    0000000000100000-0000000003FFFFFF 0000000000003F00 000000000000000F
> Available  0000000004000000-000000000FFFEFFF 000000000000BFFF 000000000000000F
> BS_Code    000000000FFFF000-000000001006CFFF 000000000000006E 000000000000000F
> Available  000000001006D000-00000000B3E73FFF 00000000000A3E07 000000000000000F
>
> [...]
>
> Additionally, early Xen boot code maps only first 16 MiB of memory. Hence,
> it means that jump into __high_start fails immediately.
>
> Now I see two solutions for these issues:
>
> 1) We can make early 32-bit code relocatable. We may use something similar
>    to xen/arch/x86/boot/trampoline.S:bootsym_rel(). Additionally, I think
>    that early code should not blindly map first 16 MiB of memory. It should
>    map first 1 MiB of memory and then 16 MiB of memory starting from
>    xen_phys_start. This way we also fix long standing bug in early code
>    which I described earlier.
>
> 2) We can jump from EFI x86-64 mode directly into "Xen x86-64 mode" like
>    it is done in case of EFI loader. However, then we must duplicate multiboot2
>    protocol implementation in x86-64 mode (if we wish that multiboot2 protocol
>    can be used on legacy BIOS and EFI platforms; I think that we should support
>    this protocol on both for users convenience). Additionally, we must use
>    a workaround to relocate trampoline if boot services uses memory below 1 MiB
>    (please check commit c1f2dfe8f6a559bc28935f24e31bb33d17d9713d, x86/EFI: make
>    trampoline allocation more flexible, for more details).
>
> I prefer #1 because this way we do not duplicate multiboot2 protocol implementation
> (one for legacy BIOS and EFI) and we avoid issues with trampoline relocation when
> low memory is occupied by boot services and/or 1:1 EFI page tables.
>
> Daniel
>
> PS I have just realized that commit c1f2dfe8f6a559bc28935f24e31bb33d17d9713d
>    will not work if trampoline code will overwrite some of EFI 1:1 page tables.
>    Dell PowerEdge R820 store part of 1:1 page tables below 1 MiB. Xen loaded
>    by native EFI loader boots but it is only lucky coincidence that it does
>    not overwrite used entries. So, I tend to go and choose #1 even more.

I have to admit to also being surprised at the fragility of the Xen, and
how it cannot function if _start isn't loaded on the 1MB boundary.

Given that there is provably one system in the wild which causes us to
fall over this limitation, it clearly needs fixing.

I would also agree that making the entry point relocatable is the
correct way forwards.  However, you cannot use something like
bootsym_rel() as that requires infrastructure to patch the references
(observe the loop over __trampoline_rel_{start,end} just before the call
to cmdline_parse_early())

This can probably be achieved by having a small bit of hand-written PIC
which puts an appropriate offset into %ds.

~Andrew


  reply	other threads:[~2015-02-10 22:41 UTC|newest]

Thread overview: 166+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-30 17:54 [PATCH 00/18] x86: multiboot2 protocol support Daniel Kiper
2015-01-30 17:54 ` [PATCH 01/18] x86/boot/reloc: mask out MBI_BOOTDEV from mbi flags Daniel Kiper
2015-01-30 17:54 ` Daniel Kiper
2015-01-30 17:59   ` [Xen-devel] " Andrew Cooper
2015-01-30 17:59   ` Andrew Cooper
2015-01-30 17:54 ` [PATCH 02/18] x86/boot/reloc: create generic alloc and copy functions Daniel Kiper
2015-01-30 18:02   ` Andrew Cooper
2015-01-30 18:02   ` Andrew Cooper
2015-02-03 10:13   ` Jan Beulich
2015-02-03 10:13   ` Jan Beulich
2015-01-30 17:54 ` Daniel Kiper
2015-01-30 17:54 ` [PATCH 03/18] x86/boot: use %ecx instead of %eax Daniel Kiper
2015-01-30 17:54 ` Daniel Kiper
2015-02-03 10:02   ` Jan Beulich
2015-02-03 17:43     ` Daniel Kiper
2015-02-03 17:43     ` Daniel Kiper
2015-02-03 10:02   ` Jan Beulich
2015-01-30 17:54 ` [PATCH 04/18] xen/x86: add multiboot2 protocol support Daniel Kiper
2015-01-30 18:11   ` Andrew Cooper
2015-01-30 18:11   ` Andrew Cooper
2015-02-20 16:06   ` Jan Beulich
2015-03-27 10:56     ` Daniel Kiper
2015-03-27 10:56     ` Daniel Kiper
2015-03-27 11:20       ` Jan Beulich
2015-03-27 12:22         ` Daniel Kiper
2015-03-27 12:22         ` Daniel Kiper
2015-03-27 12:42           ` Jan Beulich
2015-03-27 12:42           ` Jan Beulich
2015-03-27 11:20       ` Jan Beulich
2015-01-30 17:54 ` Daniel Kiper
2015-01-30 17:54 ` [PATCH 05/18] efi: split efi_enabled to efi_platform and efi_loader Daniel Kiper
2015-01-30 17:54 ` Daniel Kiper
2015-02-20 16:17   ` Jan Beulich
2015-02-20 16:17   ` Jan Beulich
2015-03-27 13:32     ` Daniel Kiper
2015-03-27 13:32     ` Daniel Kiper
2015-03-27 13:43       ` Jan Beulich
2015-03-27 13:53         ` Andrew Cooper
2015-03-27 14:04           ` Jan Beulich
2015-03-27 14:09             ` Lennart Sorensen
2015-03-27 14:19               ` [Xen-devel] " Jan Beulich
2015-03-27 14:21                 ` Lennart Sorensen
2015-03-27 14:21                 ` Lennart Sorensen
2015-03-27 14:19               ` Jan Beulich
2015-03-27 14:09             ` Lennart Sorensen
2015-03-27 14:04           ` Jan Beulich
2015-03-27 13:53         ` Andrew Cooper
2015-03-27 13:43       ` Jan Beulich
2015-03-02 17:21   ` Stefano Stabellini
2015-03-02 18:43     ` Roy Franz
2015-03-02 23:40       ` Roy Franz
2015-03-03  8:49         ` Jan Beulich
2015-03-03  8:49         ` Jan Beulich
2015-03-02 23:40       ` Roy Franz
2015-03-02 17:21   ` Stefano Stabellini
2015-01-30 17:54 ` [PATCH 06/18] x86: remove commented out stale references to efi_enabled Daniel Kiper
2015-01-30 17:54 ` [PATCH 07/18] efi: run EFI specific code on EFI platform only Daniel Kiper
2015-02-20 16:47   ` Jan Beulich
2015-02-20 16:47   ` Jan Beulich
2015-01-30 17:54 ` [PATCH 08/18] efi: build xen.gz with EFI code Daniel Kiper
2015-03-02 16:14   ` Jan Beulich
2015-03-02 16:14   ` Jan Beulich
2015-03-27 11:14     ` Daniel Kiper
2015-03-27 11:14     ` Daniel Kiper
2015-03-27 11:46       ` Jan Beulich
2015-03-27 11:54         ` Andrew Cooper
2015-03-27 11:54         ` Andrew Cooper
2015-03-27 11:46       ` Jan Beulich
2015-01-30 17:54 ` [PATCH 09/18] efi: create efi_init() Daniel Kiper
2015-01-30 17:54 ` [PATCH 10/18] efi: create efi_console_set_mode() Daniel Kiper
2015-01-30 17:54 ` [PATCH 11/18] efi: create efi_get_gop() Daniel Kiper
2015-01-30 17:54 ` [PATCH 12/18] efi: create efi_find_gop_mode() Daniel Kiper
2015-01-30 17:54 ` Daniel Kiper
2015-01-30 17:54 ` [PATCH 13/18] efi: create efi_tables() Daniel Kiper
2015-01-30 17:54 ` [PATCH 14/18] efi: create efi_variables() Daniel Kiper
2015-01-30 17:54 ` [PATCH 15/18] efi: create efi_set_gop_mode() Daniel Kiper
2015-01-30 17:54 ` [PATCH 16/18] efi: create efi_exit_boot() Daniel Kiper
2015-03-02 16:45   ` Jan Beulich
2015-03-27 12:00     ` Daniel Kiper
2015-03-27 12:00     ` Daniel Kiper
2015-03-27 12:10       ` Jan Beulich
2015-03-27 12:10       ` Jan Beulich
2015-03-27 12:43         ` Daniel Kiper
2015-03-27 13:17           ` Ian Campbell
2015-03-27 13:17           ` Ian Campbell
2015-03-27 12:43         ` Daniel Kiper
2015-03-02 16:45   ` Jan Beulich
2015-01-30 17:54 ` [PATCH 17/18] x86/efi: create new early memory allocator Daniel Kiper
2015-03-02 17:23   ` Jan Beulich
2015-03-02 17:23   ` Jan Beulich
2015-03-02 20:25     ` Roy Franz
2015-03-03  8:04       ` Jan Beulich
2015-03-03  9:39         ` Daniel Kiper
2015-03-03  9:39         ` Daniel Kiper
2015-03-03  8:04       ` Jan Beulich
2015-03-27 12:57     ` Daniel Kiper
2015-03-27 13:35       ` Jan Beulich
2015-03-27 14:28         ` Daniel Kiper
2015-03-27 14:28         ` Daniel Kiper
2015-03-27 13:35       ` Jan Beulich
2015-03-27 12:57     ` Daniel Kiper
2015-01-30 17:54 ` [PATCH 18/18] x86: add multiboot2 protocol support for EFI platforms Daniel Kiper
2015-01-30 19:06   ` Andrew Cooper
2015-01-30 23:43     ` Daniel Kiper
2015-01-30 23:43     ` Daniel Kiper
2015-01-31  0:47       ` Andrew Cooper
2015-01-31  0:47       ` Andrew Cooper
2015-01-30 19:06   ` Andrew Cooper
2015-02-10 21:27   ` Daniel Kiper
2015-02-10 21:27   ` Daniel Kiper
2015-02-10 22:41     ` Andrew Cooper [this message]
2015-02-10 22:41     ` Andrew Cooper
2015-02-11  8:20     ` Jan Beulich
2015-02-14 17:23       ` Andrei Borzenkov
2015-02-14 17:23       ` Andrei Borzenkov
2015-02-15 21:00         ` Daniel Kiper
2015-02-15 21:00         ` Daniel Kiper
2015-02-11  8:20     ` Jan Beulich
2015-03-17 10:32   ` Jan Beulich
2015-03-17 12:47     ` Daniel Kiper
2015-03-17 12:47     ` Daniel Kiper
2015-03-27 13:06     ` Daniel Kiper
2015-03-27 13:06     ` Daniel Kiper
2015-03-27 13:36       ` Jan Beulich
2015-03-27 14:26         ` Daniel Kiper
2015-03-27 14:34           ` Jan Beulich
2015-03-27 14:57             ` Daniel Kiper
2015-03-27 15:06               ` Jan Beulich
2015-03-27 15:06               ` Jan Beulich
2015-03-27 15:10                 ` Daniel Kiper
2015-03-27 15:10                 ` Daniel Kiper
2015-03-27 14:57             ` Daniel Kiper
2015-03-27 14:26         ` Daniel Kiper
2015-03-27 13:36       ` Jan Beulich
2015-03-17 10:32   ` Jan Beulich
2015-01-30 18:04 ` [PATCH 00/18] x86: multiboot2 protocol support Daniel Kiper
2015-01-30 18:04 ` Daniel Kiper
2015-01-31  7:22 ` João Jerónimo
2015-02-02  9:28 ` Jan Beulich
2015-02-02  9:28 ` Jan Beulich
2015-02-03 17:14   ` Daniel Kiper
2015-02-04  9:04     ` Andrew Cooper
2015-02-04  9:04     ` Andrew Cooper
2015-02-04  9:51       ` Jan Beulich
2015-02-05 10:59         ` Andrew Cooper
2015-02-05 10:59         ` Andrew Cooper
2015-02-05 11:50         ` Vladimir 'phcoder' Serbinenko
2015-02-05 12:00           ` Jan Beulich
2015-02-05 12:00           ` Jan Beulich
2015-02-05 11:50         ` Vladimir 'phcoder' Serbinenko
2015-02-04  9:51       ` Jan Beulich
2015-02-03 17:14   ` Daniel Kiper
2015-02-09 17:59 ` Daniel Kiper
2015-02-10  9:05   ` Jan Beulich
2015-02-10  9:05   ` Jan Beulich
2015-02-09 17:59 ` Daniel Kiper
2015-03-03 12:10 ` Ian Campbell
2015-03-03 12:10 ` Ian Campbell
2015-03-03 12:36   ` Daniel Kiper
2015-03-03 12:39     ` Ian Campbell
2015-03-03 12:39     ` Ian Campbell
2015-03-03 12:51       ` Daniel Kiper
2015-03-03 12:51       ` Daniel Kiper
2015-03-03 12:36   ` Daniel Kiper
2015-03-27 10:59 ` Daniel Kiper
2015-03-27 10:59 ` Daniel Kiper

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=54DA8901.7050603@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=daniel.kiper@oracle.com \
    --cc=david.vrabel@citrix.com \
    --cc=fu.wei@linaro.org \
    --cc=gang.wei@intel.com \
    --cc=grub-devel@gnu.org \
    --cc=ian.campbell@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=jgross@suse.com \
    --cc=keir@xen.org \
    --cc=ning.sun@intel.com \
    --cc=phcoder@gmail.com \
    --cc=qiaowei.ren@intel.com \
    --cc=richard.l.maliszewski@intel.com \
    --cc=roy.franz@linaro.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.