From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Daniel Kiper <daniel.kiper@oracle.com>
Cc: jgross@suse.com, grub-devel@gnu.org, wei.liu2@citrix.com,
keir@xen.org, ian.campbell@citrix.com,
stefano.stabellini@eu.citrix.com, andrew.cooper3@citrix.com,
roy.franz@linaro.org, ning.sun@intel.com,
david.vrabel@citrix.com, jbeulich@suse.com, phcoder@gmail.com,
xen-devel@lists.xenproject.org, qiaowei.ren@intel.com,
richard.l.maliszewski@intel.com, gang.wei@intel.com,
fu.wei@linaro.org
Subject: Re: [PATCH v2 23/23] x86: add multiboot2 protocol support for relocatable images
Date: Tue, 11 Aug 2015 12:56:58 -0400 [thread overview]
Message-ID: <20150811165658.GC32231__42121.9658609063$1439312330$gmane$org@l.oracle.com> (raw)
In-Reply-To: <1437402558-7313-24-git-send-email-daniel.kiper@oracle.com>
On Mon, Jul 20, 2015 at 04:29:18PM +0200, Daniel Kiper wrote:
> Add multiboot2 protocol support for relocatable images. Only GRUB2
> with relevant patches understands that feature. Older multiboot
You may want to enumerate what those 'relevant' patches are.
> protocol (regardless of version) compatible loaders ignore it
> and everything works as usual.
>
> Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
> ---
> xen/arch/x86/boot/head.S | 46 +++++++++++++++++++++++++++++--------
> xen/arch/x86/x86_64/asm-offsets.c | 1 +
> xen/include/xen/multiboot2.h | 13 +++++++++++
> 3 files changed, 50 insertions(+), 10 deletions(-)
>
> diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
> index d484f68..2520e48 100644
> --- a/xen/arch/x86/boot/head.S
> +++ b/xen/arch/x86/boot/head.S
> @@ -81,6 +81,13 @@ multiboot1_header_end:
> /* Align modules at page boundry. */
> mb2ht_init MB2_HT(MODULE_ALIGN), MB2_HT(REQUIRED)
>
> + /* Load address preference. */
> + mb2ht_init MB2_HT(RELOCATABLE), MB2_HT(OPTIONAL), \
> + sym_phys(start), /* Min load address. */ \
We could go straight to __start?
> + 0xffffffff, /* Max load address (4 GiB - 1). */ \
> + 0x200000, /* Load address alignment (2 MiB). */ \
> + MULTIBOOT2_LOAD_PREFERENCE_HIGH
> +
> /* Console flags tag. */
> mb2ht_init MB2_HT(CONSOLE_FLAGS), MB2_HT(OPTIONAL), \
> MULTIBOOT2_CONSOLE_FLAGS_EGA_TEXT_SUPPORTED
> @@ -176,30 +183,39 @@ efi_multiboot2_proto:
> lea MB2_fixed_sizeof(%rbx),%rcx
>
> 0:
> + /* Get Xen image base address from Multiboot2 information. */
> + cmpl $MULTIBOOT2_TAG_TYPE_BASE_ADDR,MB2_tag_type(%rcx)
> + jne 1f
> +
> + mov MB2_base_addr(%rcx),%ebp
> + sub $XEN_IMG_OFFSET,%rbp
> + jmp 4f
> +
> +1:
> /* Get EFI SystemTable address from Multiboot2 information. */
> cmpl $MULTIBOOT2_TAG_TYPE_EFI64,MB2_tag_type(%rcx)
> - jne 1f
> + jne 2f
>
> mov MB2_efi64_st(%rcx),%rsi
>
> /* Do not go into real mode on EFI platform. */
> movb $1,skip_realmode(%rip)
> - jmp 3f
> + jmp 4f
>
> -1:
> +2:
> /* Get EFI ImageHandle address from Multiboot2 information. */
> cmpl $MULTIBOOT2_TAG_TYPE_EFI64_IH,MB2_tag_type(%rcx)
> - jne 2f
> + jne 3f
>
> mov MB2_efi64_ih(%rcx),%rdi
> - jmp 3f
> + jmp 4f
>
> -2:
> +3:
> /* Is it the end of Multiboot2 information? */
> cmpl $MULTIBOOT2_TAG_TYPE_END,MB2_tag_type(%rcx)
> je run_bs
>
> -3:
> +4:
> /* Go to next Multiboot2 information tag. */
> add MB2_tag_size(%rcx),%ecx
> add $(MULTIBOOT2_TAG_ALIGN-1),%rcx
> @@ -297,14 +313,23 @@ multiboot2_proto:
> lea MB2_fixed_sizeof(%ebx),%ecx
>
> 0:
> + /* Get Xen image base address from Multiboot2 information. */
> + cmpl $MULTIBOOT2_TAG_TYPE_BASE_ADDR,MB2_tag_type(%ecx)
> + jne 1f
> +
> + mov MB2_base_addr(%ecx),%ebp
> + sub $XEN_IMG_OFFSET,%ebp
> + jmp 3f
> +
> +1:
> /* Get mem_lower from Multiboot2 information. */
> cmpl $MULTIBOOT2_TAG_TYPE_BASIC_MEMINFO,MB2_tag_type(%ecx)
> - jne 1f
> + jne 2f
>
> mov MB2_mem_lower(%ecx),%edx
> - jmp trampoline_bios_setup
> + jmp 3f
>
> -1:
> +2:
> /* EFI mode is not supported via legacy BIOS path. */
> cmpl $MULTIBOOT2_TAG_TYPE_EFI32,MB2_tag_type(%ecx)
> je mb2_too_old
> @@ -316,6 +341,7 @@ multiboot2_proto:
> cmpl $MULTIBOOT2_TAG_TYPE_END,MB2_tag_type(%ecx)
> je trampoline_bios_setup
>
> +3:
> /* Go to next Multiboot2 information tag. */
> add MB2_tag_size(%ecx),%ecx
> add $(MULTIBOOT2_TAG_ALIGN-1),%ecx
> diff --git a/xen/arch/x86/x86_64/asm-offsets.c b/xen/arch/x86/x86_64/asm-offsets.c
> index b7aed49..5345a9e 100644
> --- a/xen/arch/x86/x86_64/asm-offsets.c
> +++ b/xen/arch/x86/x86_64/asm-offsets.c
> @@ -172,6 +172,7 @@ void __dummy__(void)
> DEFINE(MB2_fixed_sizeof, sizeof(multiboot2_fixed_t));
> OFFSET(MB2_tag_type, multiboot2_tag_t, type);
> OFFSET(MB2_tag_size, multiboot2_tag_t, size);
> + OFFSET(MB2_base_addr, multiboot2_tag_base_addr_t, base_addr);
> OFFSET(MB2_mem_lower, multiboot2_tag_basic_meminfo_t, mem_lower);
> OFFSET(MB2_efi64_st, multiboot2_tag_efi64_t, pointer);
> OFFSET(MB2_efi64_ih, multiboot2_tag_efi64_ih_t, pointer);
> diff --git a/xen/include/xen/multiboot2.h b/xen/include/xen/multiboot2.h
> index 09ee64e..a63c4d6 100644
> --- a/xen/include/xen/multiboot2.h
> +++ b/xen/include/xen/multiboot2.h
> @@ -59,11 +59,17 @@
> #define MULTIBOOT2_HEADER_TAG_EFI_BS 7
> #define MULTIBOOT2_HEADER_TAG_ENTRY_ADDRESS_EFI32 8
> #define MULTIBOOT2_HEADER_TAG_ENTRY_ADDRESS_EFI64 9
> +#define MULTIBOOT2_HEADER_TAG_RELOCATABLE 10
>
> /* Header tag flags. */
> #define MULTIBOOT2_HEADER_TAG_REQUIRED 0
> #define MULTIBOOT2_HEADER_TAG_OPTIONAL 1
>
> +/* Where image should be loaded (suggestion not requirement). */
> +#define MULTIBOOT2_LOAD_PREFERENCE_NONE 0
> +#define MULTIBOOT2_LOAD_PREFERENCE_LOW 1
> +#define MULTIBOOT2_LOAD_PREFERENCE_HIGH 2
Would be good for all of this (with the other MULTIBOOT2..)
to be aligned on the same column-ish.
> +
> /* Header console tag console_flags. */
> #define MULTIBOOT2_CONSOLE_FLAGS_CONSOLE_REQUIRED 1
> #define MULTIBOOT2_CONSOLE_FLAGS_EGA_TEXT_SUPPORTED 2
> @@ -90,6 +96,7 @@
> #define MULTIBOOT2_TAG_TYPE_EFI_BS 18
> #define MULTIBOOT2_TAG_TYPE_EFI32_IH 19
> #define MULTIBOOT2_TAG_TYPE_EFI64_IH 20
> +#define MULTIBOOT2_TAG_TYPE_BASE_ADDR 21
>
> /* Multiboot 2 tag alignment. */
> #define MULTIBOOT2_TAG_ALIGN 8
> @@ -120,6 +127,12 @@ typedef struct {
> typedef struct {
> u32 type;
> u32 size;
> + u32 base_addr;
> +} multiboot2_tag_base_addr_t;
> +
> +typedef struct {
> + u32 type;
> + u32 size;
> char string[0];
> } multiboot2_tag_string_t;
>
> --
> 1.7.10.4
>
Otherwise, Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
next prev parent reply other threads:[~2015-08-11 16:57 UTC|newest]
Thread overview: 116+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1437402558-7313-1-git-send-email-daniel.kiper@oracle.com>
2015-07-20 14:28 ` [PATCH v2 01/23] x86/boot: remove unneeded instruction Daniel Kiper
2015-07-20 14:28 ` [PATCH v2 02/23] x86/boot: copy only text section from *.lnk file to *.bin file Daniel Kiper
2015-07-20 14:28 ` [PATCH v2 03/23] x86: zero BSS using stosl instead of stosb Daniel Kiper
2015-07-20 14:28 ` [PATCH v2 04/23] x86/boot: call reloc() using cdecl calling convention Daniel Kiper
2015-07-20 14:29 ` [PATCH v2 05/23] x86/boot/reloc: create generic alloc and copy functions Daniel Kiper
2015-07-20 14:29 ` [PATCH v2 06/23] x86/boot: use %ecx instead of %eax Daniel Kiper
2015-07-20 14:29 ` [PATCH v2 07/23] x86/boot/reloc: Rename some variables and rearrange code a bit Daniel Kiper
2015-07-20 14:29 ` [PATCH v2 08/23] x86: add multiboot2 protocol support Daniel Kiper
2015-08-10 19:17 ` Konrad Rzeszutek Wilk
[not found] ` <20150810191747.GE13576@l.oracle.com>
2015-08-13 19:22 ` Daniel Kiper
[not found] ` <20150813192212.GI3503@olila.local.net-space.pl>
2015-08-14 10:03 ` Jan Beulich
[not found] ` <55CDD8F4020000780009AF3C@prv-mh.provo.novell.com>
2015-08-15 6:00 ` Andrew Cooper
2015-08-18 8:12 ` Jan Beulich
2015-08-18 12:00 ` Daniel Kiper
2015-08-18 14:20 ` Jan Beulich
2015-07-20 14:29 ` [PATCH v2 09/23] efi: create efi_enabled() Daniel Kiper
2015-08-10 19:20 ` Konrad Rzeszutek Wilk
2015-08-20 15:18 ` Jan Beulich
2015-08-22 12:33 ` Daniel Kiper
[not found] ` <20150822123359.GX7143@olila.local.net-space.pl>
2015-08-24 11:29 ` Jan Beulich
2015-07-20 14:29 ` [PATCH v2 10/23] efi: build xen.gz with EFI code Daniel Kiper
2015-07-20 14:29 ` [PATCH v2 11/23] efi: split out efi_init() Daniel Kiper
2015-08-10 19:25 ` Konrad Rzeszutek Wilk
2015-07-20 14:29 ` [PATCH v2 12/23] efi: split out efi_console_set_mode() Daniel Kiper
2015-07-20 14:29 ` [PATCH v2 13/23] efi: split out efi_get_gop() Daniel Kiper
2015-07-20 14:29 ` [PATCH v2 14/23] efi: split out efi_find_gop_mode() Daniel Kiper
2015-08-10 19:31 ` Konrad Rzeszutek Wilk
2015-08-20 15:48 ` Jan Beulich
2015-07-20 14:29 ` [PATCH v2 15/23] efi: split out efi_tables() Daniel Kiper
2015-08-10 19:32 ` Konrad Rzeszutek Wilk
2015-07-20 14:29 ` [PATCH v2 16/23] efi: split out efi_variables() Daniel Kiper
2015-08-10 19:34 ` Konrad Rzeszutek Wilk
2015-07-20 14:29 ` [PATCH v2 17/23] efi: split out efi_set_gop_mode() Daniel Kiper
2015-08-10 19:34 ` Konrad Rzeszutek Wilk
2015-07-20 14:29 ` [PATCH v2 18/23] efi: split out efi_exit_boot() Daniel Kiper
2015-07-20 14:29 ` [PATCH v2 19/23] x86/efi: create new early memory allocator Daniel Kiper
2015-07-20 14:29 ` [PATCH v2 20/23] x86: add multiboot2 protocol support for EFI platforms Daniel Kiper
2015-08-10 20:07 ` Konrad Rzeszutek Wilk
2015-08-11 15:23 ` Konrad Rzeszutek Wilk
2015-08-27 12:01 ` Jan Beulich
[not found] ` <55DF1836020000780009D674@prv-mh.provo.novell.com>
2015-09-22 15:21 ` Daniel Kiper
2015-09-22 15:58 ` Jan Beulich
2015-07-20 14:29 ` [PATCH v2 21/23] x86/boot: implement early command line parser in C Daniel Kiper
2015-07-20 14:29 ` [PATCH v2 22/23] x86: make Xen early boot code relocatable Daniel Kiper
2015-07-20 14:29 ` [PATCH v2 23/23] x86: add multiboot2 protocol support for relocatable images Daniel Kiper
2015-08-11 16:56 ` Konrad Rzeszutek Wilk [this message]
[not found] ` <20150811165658.GC32231@l.oracle.com>
2015-08-14 11:57 ` Daniel Kiper
[not found] ` <20150814115701.GB8034@olila.local.net-space.pl>
2015-08-14 13:43 ` Konrad Rzeszutek Wilk
[not found] ` <1437402558-7313-3-git-send-email-daniel.kiper@oracle.com>
2015-07-21 9:35 ` [PATCH v2 02/23] x86/boot: copy only text section from *.lnk file to *.bin file Jan Beulich
2015-07-21 17:23 ` Daniel Kiper
2015-07-22 5:14 ` Jan Beulich
2015-07-22 8:02 ` Jan Beulich
2015-07-22 13:31 ` Daniel Kiper
2015-07-22 14:07 ` Jan Beulich
[not found] ` <1437402558-7313-4-git-send-email-daniel.kiper@oracle.com>
2015-07-21 9:37 ` [PATCH v2 03/23] x86: zero BSS using stosl instead of stosb Jan Beulich
2015-07-21 18:23 ` Daniel Kiper
2015-07-22 5:18 ` Jan Beulich
2015-07-22 8:42 ` Andrew Cooper
2015-07-22 10:04 ` Jan Beulich
2015-07-22 11:22 ` Andrew Cooper
2015-07-22 11:48 ` Jan Beulich
2015-07-21 9:39 ` [PATCH v2 00/23] x86: multiboot2 protocol support Jan Beulich
[not found] ` <1437402558-7313-2-git-send-email-daniel.kiper@oracle.com>
2015-07-24 16:22 ` [PATCH v2 01/23] x86/boot: remove unneeded instruction Konrad Rzeszutek Wilk
[not found] ` <20150724162257.GB2220@l.oracle.com>
2015-07-27 19:46 ` Daniel Kiper
[not found] ` <20150727194608.GB3492@olila.local.net-space.pl>
2015-08-10 16:07 ` Konrad Rzeszutek Wilk
[not found] ` <1437402558-7313-5-git-send-email-daniel.kiper@oracle.com>
2015-08-10 16:33 ` [PATCH v2 04/23] x86/boot: call reloc() using cdecl calling convention Konrad Rzeszutek Wilk
2015-08-17 15:44 ` Jan Beulich
[not found] ` <1437402558-7313-7-git-send-email-daniel.kiper@oracle.com>
2015-08-10 16:36 ` [PATCH v2 06/23] x86/boot: use %ecx instead of %eax Konrad Rzeszutek Wilk
[not found] ` <1437402558-7313-8-git-send-email-daniel.kiper@oracle.com>
2015-08-10 16:40 ` [PATCH v2 07/23] x86/boot/reloc: Rename some variables and rearrange code a bit Konrad Rzeszutek Wilk
2015-08-17 15:55 ` Jan Beulich
[not found] ` <1437402558-7313-11-git-send-email-daniel.kiper@oracle.com>
2015-08-10 19:24 ` [PATCH v2 10/23] efi: build xen.gz with EFI code Konrad Rzeszutek Wilk
2015-08-20 15:39 ` Jan Beulich
2015-08-22 13:59 ` Daniel Kiper
[not found] ` <20150822135919.GY7143@olila.local.net-space.pl>
2015-08-24 11:35 ` Jan Beulich
2015-08-24 20:54 ` Daniel Kiper
[not found] ` <20150824205445.GG7143@olila.local.net-space.pl>
2015-08-25 10:50 ` Andrew Cooper
2015-08-25 12:09 ` Jan Beulich
[not found] ` <55DC485D.4030904@citrix.com>
2015-08-25 15:39 ` Daniel Kiper
[not found] ` <55DC7705020000780009CE76@prv-mh.provo.novell.com>
2015-08-25 16:31 ` Daniel Kiper
[not found] ` <20150825163141.GJ7143@olila.local.net-space.pl>
2015-08-26 6:46 ` Jan Beulich
[not found] ` <55DD7CDE020000780009D086@prv-mh.provo.novell.com>
2015-08-26 12:33 ` Daniel Kiper
[not found] ` <20150826123356.GB10861@olila.local.net-space.pl>
2015-08-26 12:40 ` Jan Beulich
[not found] ` <55DDCFD6020000780009D226@prv-mh.provo.novell.com>
2015-08-26 12:58 ` Daniel Kiper
[not found] ` <1437402558-7313-13-git-send-email-daniel.kiper@oracle.com>
2015-08-10 19:25 ` [PATCH v2 12/23] efi: split out efi_console_set_mode() Konrad Rzeszutek Wilk
[not found] ` <1437402558-7313-14-git-send-email-daniel.kiper@oracle.com>
2015-08-10 19:27 ` [PATCH v2 13/23] efi: split out efi_get_gop() Konrad Rzeszutek Wilk
[not found] ` <1437402558-7313-19-git-send-email-daniel.kiper@oracle.com>
2015-08-10 19:36 ` [PATCH v2 18/23] efi: split out efi_exit_boot() Konrad Rzeszutek Wilk
[not found] ` <1437402558-7313-20-git-send-email-daniel.kiper@oracle.com>
2015-08-10 19:49 ` [PATCH v2 19/23] x86/efi: create new early memory allocator Konrad Rzeszutek Wilk
2015-08-27 11:23 ` Jan Beulich
[not found] ` <1437402558-7313-6-git-send-email-daniel.kiper@oracle.com>
2015-08-17 15:51 ` [PATCH v2 05/23] x86/boot/reloc: create generic alloc and copy functions Jan Beulich
[not found] ` <55D21F3E020000780009B716@prv-mh.provo.novell.com>
2015-08-17 22:03 ` Daniel Kiper
[not found] ` <1437402558-7313-22-git-send-email-daniel.kiper@oracle.com>
2015-08-10 20:31 ` [PATCH v2 21/23] x86/boot: implement early command line parser in C Konrad Rzeszutek Wilk
2015-08-11 14:43 ` Konrad Rzeszutek Wilk
2015-08-27 12:43 ` Jan Beulich
[not found] ` <55DF221B020000780009D6C6@prv-mh.provo.novell.com>
2015-09-22 17:03 ` Daniel Kiper
[not found] ` <20150922170332.GH3501@olila.local.net-space.pl>
2015-09-23 7:25 ` Jan Beulich
[not found] ` <1437402558-7313-23-git-send-email-daniel.kiper@oracle.com>
2015-08-11 16:48 ` [PATCH v2 22/23] x86: make Xen early boot code relocatable Konrad Rzeszutek Wilk
[not found] ` <20150811164806.GB32231@l.oracle.com>
2015-08-14 11:52 ` Daniel Kiper
[not found] ` <20150814115205.GA8034@olila.local.net-space.pl>
2015-08-14 12:49 ` Jan Beulich
[not found] ` <55CDFFEE020000780009B0B0@prv-mh.provo.novell.com>
2015-08-14 13:59 ` Daniel Kiper
[not found] ` <20150814135904.GC8034@olila.local.net-space.pl>
2015-08-14 14:32 ` Jan Beulich
[not found] ` <55CE1805020000780009B1C0@prv-mh.provo.novell.com>
2015-08-14 14:37 ` Daniel Kiper
[not found] ` <20150814143729.GE8034@olila.local.net-space.pl>
2015-08-14 15:12 ` Jan Beulich
2015-08-14 15:20 ` Konrad Rzeszutek Wilk
2015-08-27 13:12 ` Jan Beulich
[not found] ` <55DF28E6020000780009D6E4@prv-mh.provo.novell.com>
2015-08-27 15:10 ` Daniel Kiper
[not found] ` <20150827151054.GI10944@olila.local.net-space.pl>
2015-08-27 15:29 ` Jan Beulich
[not found] ` <55DF48FB020000780009D83F@prv-mh.provo.novell.com>
2015-08-27 17:56 ` Ben Hildred
2015-08-27 18:04 ` Andrew Cooper
[not found] ` <55DF5125.20708@citrix.com>
2015-08-28 6:54 ` Jan Beulich
[not found] ` <55E021C4020000780009DA95@prv-mh.provo.novell.com>
2015-08-28 11:59 ` Andrew Cooper
[not found] ` <CAKcyEGpdnJUXA=uW4cNdcLn9xS7fUDowzzCbhn6c1yTh4WkPGg@mail.gmail.com>
2015-08-28 8:22 ` Jan Beulich
[not found] ` <55E03676020000780009DAFB@prv-mh.provo.novell.com>
2015-08-28 13:42 ` Konrad Rzeszutek Wilk
[not found] ` <20150828134214.GC2412@l.oracle.com>
2015-08-28 14:16 ` Jan Beulich
2015-08-31 19:49 ` Daniel Kiper
[not found] ` <20150831194956.GJ4530@olila.local.net-space.pl>
2015-09-01 6:59 ` Jan Beulich
2015-08-28 14:24 ` Jan Beulich
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='20150811165658.GC32231__42121.9658609063$1439312330$gmane$org@l.oracle.com' \
--to=konrad.wilk@oracle.com \
--cc=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=wei.liu2@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 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).