From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Gibson Subject: Re: [kvm-unit-tests PATCH v4 12/17] powerpc/ppc64: adapt arm's setup Date: Thu, 18 Feb 2016 11:05:13 +1100 Message-ID: <20160218000513.GG5239@voom.redhat.com> References: <1455544166-19766-1-git-send-email-drjones@redhat.com> <1455544166-19766-13-git-send-email-drjones@redhat.com> <20160217021158.GE5239@voom.redhat.com> <20160217124540.2i3ews7k3odq5yvd@hawk.localdomain> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="TmwHKJoIRFM7Mu/A" Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, thuth@redhat.com, dgibson@redhat.com, agraf@suse.de, lvivier@redhat.com, pbonzini@redhat.com To: Andrew Jones Return-path: Received: from ozlabs.org ([103.22.144.67]:32853 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161914AbcBRARr (ORCPT ); Wed, 17 Feb 2016 19:17:47 -0500 Content-Disposition: inline In-Reply-To: <20160217124540.2i3ews7k3odq5yvd@hawk.localdomain> Sender: kvm-owner@vger.kernel.org List-ID: --TmwHKJoIRFM7Mu/A Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Feb 17, 2016 at 01:45:40PM +0100, Andrew Jones wrote: > On Wed, Feb 17, 2016 at 01:11:58PM +1100, David Gibson wrote: > > On Mon, Feb 15, 2016 at 02:49:21PM +0100, Andrew Jones wrote: > > > Copy arm's setup code (also DT based) over to powerpc, adapting > > > it a bit. Also bring over arm's setup selftest, giving powerpc > > > its first test. > > >=20 > > > Signed-off-by: Andrew Jones > > > Reviewed-by: Thomas Huth > > > Tested-by: Laurent Vivier > > > --- > > > lib/powerpc/asm/setup.h | 36 +++++++++++++++ > > > lib/powerpc/setup.c | 119 ++++++++++++++++++++++++++++++++++++++= ++++++++++ > > > lib/ppc64/asm/setup.h | 1 + > > > powerpc/Makefile.common | 1 + > > > powerpc/cstart64.S | 16 +++++++ > > > powerpc/selftest.c | 63 +++++++++++++++++++++++-- > > > 6 files changed, 233 insertions(+), 3 deletions(-) > > > create mode 100644 lib/powerpc/asm/setup.h > > > create mode 100644 lib/powerpc/setup.c > > > create mode 100644 lib/ppc64/asm/setup.h > > >=20 > > > diff --git a/lib/powerpc/asm/setup.h b/lib/powerpc/asm/setup.h > > > new file mode 100644 > > > index 0000000000000..0b9f04b4b7289 > > > --- /dev/null > > > +++ b/lib/powerpc/asm/setup.h > > > @@ -0,0 +1,36 @@ > > > +#ifndef _ASMPOWERPC_SETUP_H_ > > > +#define _ASMPOWERPC_SETUP_H_ > > > +/* > > > + * Copyright (C) 2016, Red Hat Inc, Andrew Jones > > > + * > > > + * This work is licensed under the terms of the GNU LGPL, version 2. > > > + */ > > > +#include > > > +#include /* phys_addr_t */ > > > + > > > +#define NR_CPUS 8 /* arbitrarily set for now */ > > > +extern u32 cpus[NR_CPUS]; > > > +extern int nr_cpus; > > > + > > > +#define NR_MEM_REGIONS 8 > > > +#define MR_F_PRIMARY (1U << 0) > > > +struct mem_region { > > > + phys_addr_t start; > > > + phys_addr_t end; > > > + unsigned int flags; > > > +}; > > > +extern struct mem_region mem_regions[NR_MEM_REGIONS]; > > > +extern phys_addr_t __physical_start, __physical_end; > > > + > > > +#define PHYSICAL_START (__physical_start) > > > +#define PHYSICAL_END (__physical_end) > > > + > > > +#ifdef __powerpc64__ > > > +#define L1_CACHE_SHIFT 7 > > > +#else > > > +#define L1_CACHE_SHIFT 5 > > > +#endif > >=20 > > These aren't necessarily true for all systems, although it's probably > > right for all BE, BookS systems supporting KVM at present. It would > > be better to get the cache alignment from the device tree if possible. >=20 > Ah, I hadn't considered being able to do that. I presume I can expect > i-cache-line-size to always =3D=3D d-cache-line-size, right? In theory, no. In practice, I don't think I've ever seen a machine with them different, at least not anything even vaguely recent. > > Also, is this correct for LE, which I imagine you'll want to support > > soon (I don't recall if __powerpc64__ is defined for both BE and LE > > systems). >=20 > This use of __powerpc64__ will go away with the above change, but I > have another one in rtas.c. I don't know if it's valid for LE, but > I'd prefer to ignore LE for now, and then create a new series that > modifies everything necessary for enabling both BE and LE compiles. Ok. --=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 --TmwHKJoIRFM7Mu/A Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWxQq5AAoJEGw4ysog2bOShxIP/2snom3/1KYzX5F+vx6jQt9o xTmGcINc8YiXzN/Q6RuUZU8WOQp9P4V+V3na111L0IStYPXb79zRnlTAyJ/i30GJ hMDjlOLsUw2prfVSxIyY4kBSYgUrIS2zAsuOVGihlfYOMbV1r8jFLZtmBG/n4hxb OMaYEUY1Gb1Gn+nCDHhawLXBYo/8hvOyDCZ2BT0E09Xkvi8iCxmwTPdMfcBYAF9T TPmapMbBg4LGvfDGJdxKdb4PEIUCgAzVhw3tSwVIAHPrtiN3LzFv1aXKtb5XHBRw NpGRfbXHXEh+cV7tk1/NDn9DvC4IYSNbZXc87PGz5Rad53Xvev7T5QrgTOaU/Y/E y5bGcnnEzv9TDdmqXsyt2eRNoKpAPaovQG/8VJKxCS9F80/8/YUrB/NEBMka5HLF 9jqvPeaR6FO1Pab4vJLZ2GUt+T0BcAyWCmL4YlgWhzq20kdbtRdBDlzfEKAhVwAi OZcNwU4930/2eN3mD+Odtqg2kTsxGKxfO1ydt390bIPp/ZvAzaDTguIo4BIdf0y/ 2RzNdlxzTzeVybSYCL7KMsJFR2XBiYkZA2rdzuU0tZrPTCt2XQs6VNvVpeC8QN2x 1HebGJHWD5CWKvGuAKFxx6on4GigbzFMb6F4Phto3hjCpGiPFx9eQn+uaFCsTjXN y2jZkYynaQydKQobMS/p =TlsI -----END PGP SIGNATURE----- --TmwHKJoIRFM7Mu/A--