From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59297) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YUzV8-0000c6-Uk for qemu-devel@nongnu.org; Mon, 09 Mar 2015 11:21:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YUzV3-0003Rq-Pq for qemu-devel@nongnu.org; Mon, 09 Mar 2015 11:21:50 -0400 Received: from e06smtp15.uk.ibm.com ([195.75.94.111]:47092) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YUzV3-0003Rg-HX for qemu-devel@nongnu.org; Mon, 09 Mar 2015 11:21:45 -0400 Received: from /spool/local by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 9 Mar 2015 15:21:44 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id B497F219004D for ; Mon, 9 Mar 2015 15:21:32 +0000 (GMT) Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t29FLfK244236944 for ; Mon, 9 Mar 2015 15:21:41 GMT Received: from d06av01.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t29FLec2013226 for ; Mon, 9 Mar 2015 09:21:41 -0600 Message-ID: <54FDBA84.4020200@de.ibm.com> Date: Mon, 09 Mar 2015 16:21:40 +0100 From: Christian Borntraeger MIME-Version: 1.0 References: <1425895973-15239-1-git-send-email-thuth@linux.vnet.ibm.com> In-Reply-To: <1425895973-15239-1-git-send-email-thuth@linux.vnet.ibm.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 0/2] s390x: Make the s390-ccw BIOS relocatable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Thomas Huth , qemu-devel@nongnu.org Cc: cornelia.huck@de.ibm.com, agraf@suse.de Am 09.03.2015 um 11:12 schrieb Thomas Huth: > 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(-) > Applied to s390-next. Thanks