From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36061) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgjOh-0000TW-Ag for qemu-devel@nongnu.org; Sun, 04 Sep 2016 22:12:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bgjOf-0008KC-0K for qemu-devel@nongnu.org; Sun, 04 Sep 2016 22:12:30 -0400 Date: Mon, 5 Sep 2016 11:45:05 +1000 From: David Gibson Message-ID: <20160905014505.GD2587@voom.fritz.box> References: <1470388537-2908-1-git-send-email-clg@kaod.org> <1470388537-2908-4-git-send-email-clg@kaod.org> <20160816023900.GC14530@voom.fritz.box> <330ecf9d-6750-4b5f-ea5d-660e3f6a11d0@kaod.org> <20160829143021.GF2166@littlecatz> <1472537735.2388.32.camel@kernel.crashing.org> <168c7ae5-588d-23c6-7e51-79299c06431f@kaod.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="bjuZg6miEcdLYP6q" Content-Disposition: inline In-Reply-To: <168c7ae5-588d-23c6-7e51-79299c06431f@kaod.org> Subject: Re: [Qemu-devel] [PATCH 3/3] ppc/pnv: add a PowerNVCPUCore object List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?iso-8859-1?Q?C=E9dric?= Le Goater Cc: Benjamin Herrenschmidt , qemu-ppc@nongnu.org, Alexander Graf , qemu-devel@nongnu.org --bjuZg6miEcdLYP6q Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 30, 2016 at 09:23:40AM +0200, C=E9dric Le Goater wrote: > On 08/30/2016 08:15 AM, Benjamin Herrenschmidt wrote: > > On Mon, 2016-08-29 at 10:30 -0400, David Gibson wrote: > >> > >> Possibly. In fact, I'm planning to eliminate cpu->cpu_dt_id at some > >> point, in favour of having the machine type construct the id when it > >> actually builds the dt. It's not really a cpu level construct. >=20 > >From my understanding, cs->cpu_index is becoming the main CPU identifier. > sPAPRCPUCore assigns it : >=20 > cs->cpu_index =3D cc->core_id + i Uh.. yes and no. It's the main internal identifier, and it's become stable at least on platforms which support cpu hotplug. This means that it should be possible to derive any other platform specific identifiers from cpu_index in a consistent way. However, cpu_index values must still lie in the range 0..max_cpus-1, which means it's not suitable for directly representing non-contiguous platform identifiers. > which I reused in PnvCPUCore to hold the real HW identifiers.=20 > ppc_get_vcpu_by_dt_id() can also safely use cs->cpu_index I think.=20 Well, there's a different function for getting a cpu by cpu_index. > So pnv mostly work without ->cpu_dt_id but there is : >=20 > > On PowerNV it is as it's equal to the PIR, the HW interrupt server, > > etc... >=20 > xics in the way ... Now that pnv uses real hw core ids, it is=20 > interesting to see how lost it gets without a cpu with index=3D0 ... >=20 > The most obvious issue is the way we look for the ICPState of a cpu : >=20 > ICPState *ss =3D &xics->ss[cs->cpu_index]; >=20 > how about introducing a helper like (this one I hacked) : >=20 > +ICPState *xics_find_icp(XICSState *xics, int cpu_index) > +{ > + int i; > + > + for (i =3D 0 ; i < xics->nr_servers; i++) { > + ICPState *ss =3D &xics->ss[i]; > + if (ss->cs && ss->cs->cpu_index =3D=3D cpu_index) > + return ss; > + } > + > + return NULL; > +} That's probably reasonable. > + >=20 > That might have been already discussed on the mailing list ?=20 >=20 > Thanks, >=20 > C. >=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 --bjuZg6miEcdLYP6q Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBAgAGBQJXzM4gAAoJEGw4ysog2bOSWWkP/3/8q1DbefdUxT36vUzIHZiT vXmoELSciXx6258U0t0cGNnMx8hvSHFLKBUCS7LdQk7a1dZZOsZPhV5f6N1SiHnk ZT4fagIfsnI5ObxGFX/IvJ63hpnYsjnd9WWvbilOBMHVMxAJ2nLdP1KafuwPUJaz 3OwXD3GDvjhSmv+PdLFGuy+oE/8CKE7u/lL2pAy2NYU+NrZrSYFjGlY5CX7xton/ /5GWbd5fPdFf1pttnGFG1f6Ipy7okajDfIcA2KtzZRtpnCp2r3jdunx650pCBVYW MN3+Ze9oEvhkZmmHiQD0Tv6GM0ySD0NR1demeCeTRm701f4YC+nxDQswmijg7gkU S+zcgYuvS4FDLMso0bHIA4+AAv64tvsk6q+8u8wOchbx0KiGuxfE89GmmxEIB1DH GjFbPpoc+2CSzS83rR38zHwJ47AyftFF8hwN1a+H4Pm7yoIw9/JcQcUrdzoyNapB dHCtLJd+JXXc2K+UHv/G+7ge3okW9C5Y4AJR8BkUHoA67lAZLJR2ojS2yC5C6FNB 4IBQNGKtYs7jBmML5mx+wf+mwANzSAjy1Rvh9+3kyapG+4yEpoMi1aoJz5XIde4t s7C8vbi9q5YB0aHtets9wMiJDWT0Z++hrDM83gTBhlYjbwzCVNCdpPz7fceXNDRF Y79liE1yHhQmR53F+Zov =wc77 -----END PGP SIGNATURE----- --bjuZg6miEcdLYP6q--