From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59687) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZH3CP-0006n8-0g for qemu-devel@nongnu.org; Mon, 20 Jul 2015 01:01:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZH3CK-0001kg-Sv for qemu-devel@nongnu.org; Mon, 20 Jul 2015 01:01:08 -0400 Received: from ozlabs.org ([103.22.144.67]:34369) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZH3CK-0001jP-Il for qemu-devel@nongnu.org; Mon, 20 Jul 2015 01:01:04 -0400 Date: Mon, 20 Jul 2015 15:01:05 +1000 From: David Gibson Message-ID: <20150720050105.GF19189@voom.fritz.box> References: <1437134200-13086-1-git-send-email-drjones@redhat.com> <1437134200-13086-3-git-send-email-drjones@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="HCdXmnRlPgeNBad2" Content-Disposition: inline In-Reply-To: <1437134200-13086-3-git-send-email-drjones@redhat.com> Subject: Re: [Qemu-devel] [RFC PATCH 2/2] spapr: -kernel: allow linking with specified addr List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andrew Jones Cc: dgibson@redhat.com, thuth@redhat.com, qemu-devel@nongnu.org, agraf@suse.de --HCdXmnRlPgeNBad2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jul 17, 2015 at 01:56:40PM +0200, Andrew Jones wrote: > I've started playing with adding ppc support to kvm-unit-tests, > using spapr for the machine model. I wanted to link the unit test > at 0x400000 to match qemu's load address, making the unit test > startup code simpler, but ended up with 0x800000 instead, due to > how translate_kernel_address works. The translation makes sense > for how Linux kernels are linked (always at 0xc0000000 or > 0xc000000000000000), but for the unit test case we need to avoid > adding the offset. >=20 > Signed-off-by: Andrew Jones > --- > Big RFC because I don't know if the "always at 0xc..." statement > is 100% true for Linux, nor if this patch would break other stuff... Yeah, I'm pretty dubious about this too, especially since I don't entirely grasp what the load_elf() translation function is all about anyway. At least 32-bit Linux on powerpc can have a different link offset - it's actually a config option. I can't see any practical purpose for a link address that has any bits in the 0xfffffff mask though. That said, I suspect making your unit test assume a fixed load address may not be the best idea - qemu or SLOF could change in future to move things about, so it might be more robust to have your test copy itself to address it wants to be at before executing. >=20 > hw/ppc/spapr.c | 3 +++ > 1 file changed, 3 insertions(+) >=20 > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index c1cbf3387ae0c..4f1548f5168db 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -832,6 +832,9 @@ static void spapr_finalize_fdt(sPAPRMachineState *spa= pr, > =20 > static uint64_t translate_kernel_address(void *opaque, uint64_t addr) > { > + if ((addr & 0x0fffffff) =3D=3D addr) { > + return addr; > + } > return (addr & 0x0fffffff) + KERNEL_LOAD_ADDR; > } > =20 --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --HCdXmnRlPgeNBad2 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJVrICRAAoJEGw4ysog2bOSTS4QANFgcdEuK7VHJOBfaRNF+en1 nFHH3kjgocrF7uMk+pITCJUbS3MaagEsnwzQaDGOgDg3x8GOLiEjYyrwjCIca2Ec 6tLad0XtwMr34wuhEIEgFoKrf0ScXeUgibiDyyGusZlSYhCCtC9+tE/8RKf96Vr1 pHaMObGrSC8yAv8rKPgnxTlhOxByHDghzyIVr6DTgzR+OdMzVS8JpJOyyj9PiHmX uqAp2NLBmRgmDLbBoanCxvLd3VYKUwpZ0N7om5AJ+aBO5Fz8W0eYmdXjWBRtXX5X eCz56L6TUCcHmLUhIcVDgrSAGmk254YFHoNLu7+1mpn/s3Cni0W3BDE5ZTt8N3c2 2pdlQEZ2To/lIK0Ga3Z+QdF+hwPfp3G0tXGwLmxAEgXAYxhxOzfaUbKbYLfoqNdm QsZAkdKmVR+z7WMhMCRaRztYnQ19n8+pSXhbWiEx0QkOs6C8KF922os6oXSD8cXT Q8F1HsEZccXK1QjnAR7U05HJBYKFsAYP7RlAK3FYQZ4yYwUrrp8EMGGLzRS/9Sfw rBZU56nkTF7SXcAQ0c1LlZXM0D1M6j6yNWDciyHozq3vgKOtHGbQzBKVuW5ipXIs D7OiQAFa5WrRnXxvHFPqS9q48F2W2prrulbs2Z0zquOYug4aPLmifD6HK5s2TddX c8A1mRncBVFxnhiL9Sh0 =8WX3 -----END PGP SIGNATURE----- --HCdXmnRlPgeNBad2--