Re: [PATCH 0/3] x86_64 EFI runtime service support

Eric W. Biederman
2007-08-22T14:42:18Z

Andi Kleen <ak@suse.de> writes:

> On Tue, Aug 21, 2007 at 11:43:38PM -0700, Yinghai Lu wrote:
>> On 8/21/07, Andi Kleen <ak@suse.de> wrote:
>> > > current LinuxBIOS's path: the elfboot in LinuxBIOS will prepare the
>> > > e820 table, and jump to startup_32 in kernel. is that not good and
>> > > simple?
>> >
>> > The problem is that the zero page cannot be changed at all in this
>> > setup. Or rather it can be only changed by breaking LinuxBios.
>>
>> So you want to construct e820 table in x86_boot_params from LinuxBIOS
>> memmap in head64.c?
>
> The short term fix is probably to just add a version number to
> the zero page and make sure new changes only add stuff to the
> end and the kernel has reasonable compat code for old versions.
>
> Then LinuxBIOS would need to be changed to supply that version number.

To clear up a small misconception. It isn't LinuxBIOS but the LinuxBIOS
bootloaders that need to be changed. A subtle distinction.

> Perhaps it could also include a checksum just to detect old BIOS
> that don't supply a version number.
>
> Long term I'm not sure. Adding LinuxBIOS specific tables also doesn't
> sound very attractive.

Second thinking of this as the empty_zero_page is probably the wrong
mental model of how things work.

At least until HPA's recent changes bzImage is organized as follows:

bootsector (512 bytes)
Various boot protocol variables.
Some filled in or read by bootloaders
some filled in by the real mode code.
real mode code.
32bit Data+Code to load at 1MB.

The empty zero page really is the first 4K or whatever of
the current setup.S. Any sane bootloader loading the bzImage
will just load the 16bit portion and overwrite the variables
it knows how to fill in.

To ensure there was enough space the code did:

> trampoline: call start_of_setup
> .align 16
> # The offset at this point is 0x240
> .space (0xeff-0x240+1) # E820 & EDD space (ending at 0xeff)

We already have the boot protocol revision and if this is something we
are going to support that should be enough of a revision field. If
the bootloader can't support what the kernel is doing the bootloader
should just give up. We have major and minor fields there so we can
distinguish between compatible and incompatible changes as well.

Further that arrangement ensures all of the data fields are initialized.

Further there is no 4K limit when used that way except as a convention
and as an implementation detail. The bootloaders don't care. The
have to load all of the 16bit real mode section.

I need to review HPA changes a little more from his rewrite in C.
I think he messed up with the guarantee of initialization in that
rewrite, but I'm not quite certain.

Eric