From: David Woodhouse <dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
To: Matt Fleming <matt.fleming-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
Matthew Garrett <mjg59-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org>,
"H. Peter Anvin" <hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>,
linux-efi <linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH] Fix efifb initialisation when the only GOP device implements ConOut.
Date: Mon, 07 Jan 2013 17:51:20 +0000 [thread overview]
Message-ID: <1357581080.2844.17.camel@shinybook.infradead.org> (raw)
In-Reply-To: <1357578923.8203.72.camel-ZqTwcBeJ+wsBof6jY8KHXm7IUlhRatedral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 2565 bytes --]
On Mon, 2013-01-07 at 17:15 +0000, Matt Fleming wrote:
> On Mon, 2013-01-07 at 02:04 +0000, David Woodhouse wrote:
> > On Sun, 2013-01-06 at 00:13 +0000, David Woodhouse wrote:
> > > When booting under OVMF we have precisely one GOP device, and it
> > > implements the ConOut protocol.
> > >
> > > We break out of the loop when we look at it... and then promptly abort
> > > because 'first_gop' never gets set.
> >
> > Hmmm. I've just fixed OVMF so that when qemu is invoked with the
> > '-kernel' argument, it uses the EFI handover protocol. And now graphics
> > is broken on kernels *without* this patch. I can't even initialise the
> > graphics info in OVMF (as it does for non-EFI handover) because the
> > kernel helpfully zeroes it all out before failing to set it up
> > correctly.
> >
> > Does it make sense to bump the boot protocol to 2.12 to indicate that
> > this bug is fixed, and then let things like OVMF use the EFI handover
> > protocol only for boot protocol >= 2.12? Or is there a better way...?
>
> Bumping the boot protocol seems like a sensible idea.
>
> Peter, any objection to that?
I'd like to fix the 32-bit EFI entry point first. Although the PE entry
point helpfully adds 4 to $esp to effectively pop the unwanted return
address off the stack, the EFI entry point at 0x30 doesn't. So I'm doing
this for now to test OVMF, while I work out why the EFI stub is then
crashing in the PCI ROM handling:
--- a/arch/x86/boot/compressed/head_32.S
+++ b/arch/x86/boot/compressed/head_32.S
@@ -50,8 +50,10 @@ ENTRY(startup_32)
pushl %eax
pushl %esi
pushl %ecx
+ pushl %ecx
.org 0x30,0x90
+ add $0x4, %esp
call efi_main
cmpl $0, %eax
movl %eax, %esi
On fact, the whole 32-bit vs 64-bit entry point seems entirely
confusing.
It seems that a bootloader needs to *know* whether it's loading a 64-bit
or a 32-bit kernel image. A quick check shows that grub is always
running non-EFI kernels in 32-bit mode, at the 32-bit entry point. So
that's fine. But for the EFI stub, a 64-bit grub unconditionally jumps
to the undocumented¹ 0x200 + handover_offset, while a 32-bit grub omits
the 0x200. So if you attempt to boot a 64-bit kernel from a 32-bit grub,
or vice versa, it's just going to crash.
What is the bootloader *supposed* to do?
--
dwmw2
¹ Not strictly true. It's documented as "THIS MAY CHANGE. BOOTLOADERS
SHALL USE THE ELF HEADERS TO FIND IT" in .../boot/compressed/head_64.S
[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 6171 bytes --]
next prev parent reply other threads:[~2013-01-07 17:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1357431222.9270.73.camel@shinybook.infradead.org>
[not found] ` <1357431222.9270.73.camel-Fexsq3y4057IgHVZqg5X0TlWvGAXklZc@public.gmane.org>
2013-01-07 17:08 ` [PATCH] Fix efifb initialisation when the only GOP device implements ConOut Matt Fleming
[not found] ` <1357524250.9270.86.camel@shinybook.infradead.org>
[not found] ` <1357524250.9270.86.camel-Fexsq3y4057IgHVZqg5X0TlWvGAXklZc@public.gmane.org>
2013-01-07 17:15 ` Matt Fleming
[not found] ` <1357578923.8203.72.camel-ZqTwcBeJ+wsBof6jY8KHXm7IUlhRatedral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-01-07 17:51 ` David Woodhouse [this message]
[not found] ` <1357581080.2844.17.camel-Fexsq3y4057IgHVZqg5X0TlWvGAXklZc@public.gmane.org>
2013-01-07 17:58 ` Matthew Garrett
[not found] ` <20130107175846.GA385-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org>
2013-01-07 18:36 ` David Woodhouse
[not found] ` <1357583795.2844.18.camel-Fexsq3y4057IgHVZqg5X0TlWvGAXklZc@public.gmane.org>
2013-01-07 18:43 ` Matthew Garrett
[not found] ` <20130107184320.GA1400-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org>
2013-01-07 19:12 ` David Woodhouse
[not found] ` <1357585971.2844.22.camel-Fexsq3y4057IgHVZqg5X0TlWvGAXklZc@public.gmane.org>
2013-01-07 19:16 ` Matthew Garrett
[not found] ` <20130107191648.GA2229-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org>
2013-01-07 19:45 ` David Woodhouse
[not found] ` <1357524456.9270.90.camel@shinybook.infradead.org>
[not found] ` <1357524456.9270.90.camel-Fexsq3y4057IgHVZqg5X0TlWvGAXklZc@public.gmane.org>
2013-01-07 18:58 ` [PATCH] Specify ELF ABI for EFI handover protocol Matt Fleming
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=1357581080.2844.17.camel@shinybook.infradead.org \
--to=dwmw2-wegcikhe2lqwvfeawa7xhq@public.gmane.org \
--cc=hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org \
--cc=linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=matt.fleming-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=mjg59-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org \
--cc=x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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