Re: [Xen-devel] [PATCH v4 4/5] x86: add multiboot2 protocol support for EFI platforms

2017-01-19 Thread Jan Beulich
>>> On 19.01.17 at 12:37,  wrote:
> On Thu, Jan 19, 2017 at 02:09:37AM -0700, Jan Beulich wrote:
>> >>> On 18.01.17 at 20:51,  wrote:
>> > Are we strictly guaranteed to have the entire image, including multiboot
>> > tags, loaded below 4GB virtual even in the 64bit case? Even on non-EFI
>> > capable grub2's ?
>>
>> I can't speak for GrUB, but I've recently learned that EFI alone
>> doesn't appear to make such guarantees, and also doesn't look
>> to have ways to request such address restricted loading of an
> 
> Why? Due to lack of memory below 4 GiB, it being reserved for
> something, EFI implementation bugs or anything else?

I don't know the precise reason in that specific case, but I did go
through the spec again after I had read that report, and I wasn't
able to find anything regarding mandated or optional address
restrictions. My recollection of there being such a restriction must
have been based on the EFI sample implementation and/or the
EDK.

Jan


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v4 4/5] x86: add multiboot2 protocol support for EFI platforms

2017-01-19 Thread Daniel Kiper
On Thu, Jan 19, 2017 at 02:09:37AM -0700, Jan Beulich wrote:
> >>> On 18.01.17 at 20:51,  wrote:
> > On 18/01/17 14:17, Doug Goldstein wrote:
> >> +.Lefi_multiboot2_proto:
> >> +/* Zero EFI SystemTable and EFI ImageHandle addresses. */
> >> +xor %esi,%esi
> >> +xor %edi,%edi
> >> +
> >> +/* Skip Multiboot2 information fixed part. */
> >> +lea (MB2_fixed_sizeof+MULTIBOOT2_TAG_ALIGN-1)(%rbx),%ecx
> >> +and $~(MULTIBOOT2_TAG_ALIGN-1),%ecx
> >
> > Are we strictly guaranteed to have the entire image, including multiboot
> > tags, loaded below 4GB virtual even in the 64bit case? Even on non-EFI
> > capable grub2's ?
>
> I can't speak for GrUB, but I've recently learned that EFI alone

GRUB is able to enforce 4 GiB restriction. At least right now.
However, I am afraid that sooner or later machines will appear
in the wild which do not have memory below 4 GiB (well, they must
have some below 1 MiB but everything above is not a must as I know)
or everything will be reserved/used by EFI boot/runtime services, etc.
Then GRUB will also fail and we will be forced to extend multiboot2
proto further. However, it looks that current solution should not
change much then.

> doesn't appear to make such guarantees, and also doesn't look
> to have ways to request such address restricted loading of an

Why? Due to lack of memory below 4 GiB, it being reserved for
something, EFI implementation bugs or anything else?

Daniel

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v4 4/5] x86: add multiboot2 protocol support for EFI platforms

2017-01-19 Thread Jan Beulich
>>> On 18.01.17 at 20:51,  wrote:
> On 18/01/17 14:17, Doug Goldstein wrote:
>> +.Lefi_multiboot2_proto:
>> +/* Zero EFI SystemTable and EFI ImageHandle addresses. */
>> +xor %esi,%esi
>> +xor %edi,%edi
>> +
>> +/* Skip Multiboot2 information fixed part. */
>> +lea (MB2_fixed_sizeof+MULTIBOOT2_TAG_ALIGN-1)(%rbx),%ecx
>> +and $~(MULTIBOOT2_TAG_ALIGN-1),%ecx
> 
> Are we strictly guaranteed to have the entire image, including multiboot
> tags, loaded below 4GB virtual even in the 64bit case? Even on non-EFI
> capable grub2's ?

I can't speak for GrUB, but I've recently learned that EFI alone
doesn't appear to make such guarantees, and also doesn't look
to have ways to request such address restricted loading of an
image. Hence there'll be work needed to make at least xen.efi
cope with being loaded above that boundary.

Jan


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v4 4/5] x86: add multiboot2 protocol support for EFI platforms

2017-01-18 Thread Doug Goldstein
On 1/18/17 2:51 PM, Andrew Cooper wrote:
> On 18/01/17 14:17, Doug Goldstein wrote:
>> diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
>> index d423fd8..ac93df0 100644
>> --- a/xen/arch/x86/boot/head.S
>> +++ b/xen/arch/x86/boot/head.S
>> @@ -89,6 +89,13 @@ multiboot2_header_start:
>> 0, /* Number of the lines - no preference. */ \
>> 0  /* Number of bits per pixel - no preference. */
>>  
>> +/* Inhibit bootloader from calling ExitBootServices(). */
> 
> /* Request that ExitBootServices() not be called. */
> 
> This tag doesn't make any guarantees.
>

Agreed. The multiboot2 spec is clear in that regard. I have tested the
case when the bootloader ignores this and it does work.

>> +.code64
>> +
>> +__efi64_start:
> 
> __mb2_efi64_start:
> 
> This entry point is distinct from the PE efi64 entry point in
> common/efi/boot.c

I agree here as well. It does need one other update however. On line 97.

/* EFI64 entry point. */
mb2ht_init MB2_HT(ENTRY_ADDRESS_EFI64), MB2_HT(OPTIONAL), \
   sym_phys(__efi64_start)

I can reroll the series or if people are comfortable with committing
this then the change can be done then.
-- 
Doug Goldstein



signature.asc
Description: OpenPGP digital signature
___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v4 4/5] x86: add multiboot2 protocol support for EFI platforms

2017-01-18 Thread Andrew Cooper
On 18/01/17 14:17, Doug Goldstein wrote:
> diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
> index d423fd8..ac93df0 100644
> --- a/xen/arch/x86/boot/head.S
> +++ b/xen/arch/x86/boot/head.S
> @@ -89,6 +89,13 @@ multiboot2_header_start:
> 0, /* Number of the lines - no preference. */ \
> 0  /* Number of bits per pixel - no preference. */
>  
> +/* Inhibit bootloader from calling ExitBootServices(). */

/* Request that ExitBootServices() not be called. */

This tag doesn't make any guarantees.

> +.code64
> +
> +__efi64_start:

__mb2_efi64_start:

This entry point is distinct from the PE efi64 entry point in
common/efi/boot.c

> +cld
> +
> +/* VGA is not available on EFI platforms. */
> +movl   $0,vga_text_buffer(%rip)
> +
> +/* Check for Multiboot2 bootloader. */
> +cmp $MULTIBOOT2_BOOTLOADER_MAGIC,%eax
> +je  .Lefi_multiboot2_proto
> +
> +/* Jump to not_multiboot after switching CPU to x86_32 mode. */
> +lea not_multiboot(%rip),%edi
> +jmp x86_32_switch
> +
> +.Lefi_multiboot2_proto:
> +/* Zero EFI SystemTable and EFI ImageHandle addresses. */
> +xor %esi,%esi
> +xor %edi,%edi
> +
> +/* Skip Multiboot2 information fixed part. */
> +lea (MB2_fixed_sizeof+MULTIBOOT2_TAG_ALIGN-1)(%rbx),%ecx
> +and $~(MULTIBOOT2_TAG_ALIGN-1),%ecx

Are we strictly guaranteed to have the entire image, including multiboot
tags, loaded below 4GB virtual even in the 64bit case? Even on non-EFI
capable grub2's ?

~Andrew

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel