Skip to content

s390x: Make the s390-ccw BIOS relocatable

Thomas Huth qemu-devel 2 versions – Applied

Status from this message: Applied to s390-next.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 4 repliesApplied
  2. v1 RFC2 patches 3 repliesSuperseded

Changes in v2 from the cover letter

- Fixed endianess issues in the ELF relocation function

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/2elf-loader: Provide the possibility to relocate s390 ELF fileshw/core/loader.c include/elf.h include/hw/elf_ops.h+82 -03 replies
2/2s390/bios: Make the s390-ccw.img relocatablehw/s390x/ipl.c pc-bios/s390-ccw/Makefile+27 -70 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchAlexander Graf
1/2A-b
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [Qemu-devel] [PATCH v2 0/2] s390x: Make the s390-ccw BIOS relocatable

Currently, our s390-ccw.img sits at the fix address 126 MiB in memory. This has two big disadvantages: 1) We can not start guests with less than 128 MiB RAM and 2) if the guest uses a really huge ramdisk > 126 MiB, the s390-ccw BIOS gets overwritten and the boot silently crashes.

These two patches now fix these problems by relocating the s390-ccw BIOS to the end of the RAM. The basic idea here is to compile the BIOS with the "-fpie" compiler option to create position independent code. Sounds easy at a first glance - however, with -fpie, we only get position independent _code_ - and a so called GOT (global offset table) which contains absolute references to global variables again (this is normally needed for supporting dynamic libraries - in our s390-ccw BIOS, it's just bad luck that we get a GOT).

So to be able to really move around our s390-ccw.img in RAM, we've got to relocate the entries in the GOT, too. This is what the first patch is good for. I've changed the ELF loader there to parse the reloc section of the ELF file. I only included the bare minimum of relocation types (R_390_RELATIVE) in the patch so far, but this can easily be extended in case we need more (with different compiler version etc.).

The second patch then adds the required changes to the s390-ccw BIOS Makefile and our s390 ipl code in QEMU.

v2:
- Fixed endianess issues in the ELF relocation function

Thomas Huth (2):
elf-loader: Provide the possibility to relocate s390 ELF files s390/bios: Make the s390-ccw.img relocatable

 hw/core/loader.c          |    2 +
 hw/s390x/ipl.c            |   23 ++++++++++++-
 include/elf.h             |    2 +
 include/hw/elf_ops.h      |   78 +++++++++++++++++++++++++++++++++++++++++++++
 pc-bios/s390-ccw/Makefile |   11 +++---
 5 files changed, 109 insertions(+), 7 deletions(-)