[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Xen boot failure on QEMU (WAS: Re: [PATCH v3] xen:arm: Populate arm64 image header)



On Tue, 9 Oct 2018 09:58:14 +0100
Peter Maydell <peter.maydell@xxxxxxxxxx> wrote:

Hi,

> On 8 October 2018 at 19:00, Julien Grall <julien.grall@xxxxxxx> wrote:
> > Per the Linux arm64 booting protocol [1], the load offset can
> > definitely be 0. The bootloader (here QEMU) should not assume a
> > specific text offset, Linux actually provides an option to
> > randomize the text offset in order to test that assumption (see
> > ARM64_RANDOMIZE_TEXT_OFFSET).
> >
> > I have CCed Stefano and Peter who could give more details on how
> > QEMU is handling the Image protocol.  
> 
> QEMU's code to handle this is in hw/arm/boot.c/load_aarch64_image().
> We do have code to handle reading the text offset from the Image
> header. The error message
> rom: requested regions overlap (rom bootloader.
> free=0x00000000400d0150, addr=0x0000000040000000)
> 
> suggests that we have correctly pulled the text offset from the
> Image file, but it overlaps with something else. Specifically,
> for the virt board we write our startup "bootloader" (about
> a dozen insns of assembly that do the job of jumping to the kernel)
> at the very bottom of RAM, so you can't use that bit of RAM for
> the image. In theory boot.c could notice that the image is where
> it would by default put the bootloader code and move that somewhere
> else (it is IIRC position-independent), but that would be quite
> complicated code for a corner case, and it doesn't help you with
> existing deployed versions of QEMU anyway.

While the latter is true, QEMU still violates the kernel arm64
booting protocol:
"The Image must be placed text_offset bytes from a 2MB aligned base
address anywhere in usable system RAM and called there."

I tried some values yesterday, just from those experiments it seems
like any 4K aligned values would work for Xen. So what about the
following:
- We use a 4K text_offset for Xen, to work with existing QEMUs.
- QEMU switches the kernel image load address to
  DRAM + 2MB + text_offset, when it sees that text_offset is smaller
  than the "startup bootloader" size.
That way people can upgrade either of Xen or QEMU to fix the problem,
and QEMU becomes more kernel boot protocol compliant.

Happy to provide the trivial Xen patch ;-)

Cheers,
Andre.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.