From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53653) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTV7y-0002mf-Bw for qemu-devel@nongnu.org; Thu, 05 Mar 2015 07:43:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YTV7t-0004I0-98 for qemu-devel@nongnu.org; Thu, 05 Mar 2015 07:43:46 -0500 Received: from e06smtp12.uk.ibm.com ([195.75.94.108]:53360) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTV7t-0004HS-0c for qemu-devel@nongnu.org; Thu, 05 Mar 2015 07:43:41 -0500 Received: from /spool/local by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 5 Mar 2015 12:43:38 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 6C8EB1B08070 for ; Thu, 5 Mar 2015 12:43:53 +0000 (GMT) Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t25ChZrp9961802 for ; Thu, 5 Mar 2015 12:43:35 GMT Received: from d06av02.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t25ChWWk024772 for ; Thu, 5 Mar 2015 05:43:33 -0700 Message-ID: <54F84F70.8070006@de.ibm.com> Date: Thu, 05 Mar 2015 13:43:28 +0100 From: Christian Borntraeger MIME-Version: 1.0 References: <1425553341-566-1-git-send-email-thuth@linux.vnet.ibm.com> <54F83993.6050906@suse.de> In-Reply-To: <54F83993.6050906@suse.de> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH RFC 0/2] s390x: Make the s390-ccw BIOS relocatable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf , Thomas Huth , qemu-devel@nongnu.org, Paolo Bonzini Am 05.03.2015 um 12:10 schrieb Alexander Graf: > > > On 05.03.15 12:02, Thomas Huth wrote: >> 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. >> >> Now I'd like to get some feedback on this approach: Is it ok to extend >> the ELF loader this way? Does anybody have better/nicer ideas to solve >> the problem of a relocatable BIOS? >> >> Thanks for any insights! > > I think the approach is perfectly valid and good :) Yes, looks good. It relocated much higher, but not beyond 2GB, and it can now handle guests < 128MB. I can take these patches via the s390 tree. Would be good if somebody else (Paolo,Alex ??) could Ack the change in include/hw/elf_ops.h. Christian