Received: from eggs.gnu.org ([2001:4830:134:3::10]:47250) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmNCY-0000rR-OV for qemu-devel@nongnu.org; Tue, 20 Sep 2016 11:43:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmNCT-00058N-QT for qemu-devel@nongnu.org; Tue, 20 Sep 2016 11:43:17 -0400 Received: from 2.mo1.mail-out.ovh.net ([178.32.119.250]:46920) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmNCT-00058C-Kv for qemu-devel@nongnu.org; Tue, 20 Sep 2016 11:43:13 -0400 Received: from player758.ha.ovh.net (b7.ovh.net [213.186.33.57]) by mo1.mail-out.ovh.net (Postfix) with ESMTP id 6398F78CA for ; Tue, 20 Sep 2016 17:43:10 +0200 (CEST) References: <1474275250-26433-1-git-send-email-clg@kaod.org> <20160920132531.GH20488@umbus> From: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= Message-ID: <74954ad0-a139-a9fe-e45c-a4efbd69dfcf@kaod.org> Date: Tue, 20 Sep 2016 17:43:05 +0200 MIME-Version: 1.0 In-Reply-To: <20160920132531.GH20488@umbus> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC PATCH] ppc/xics: introduce helpers to find an ICP from some (CPU) index List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson Cc: qemu-ppc@nongnu.org, Bharata B Rao , Nikunj A Dadhania , qemu-devel@nongnu.org On 09/20/2016 03:25 PM, David Gibson wrote: > On Mon, Sep 19, 2016 at 10:54:10AM +0200, C=E9dric Le Goater wrote: >> Today, the CPU index is used to index the icp array under xics. This >> works correctly when the indexes are sync but that is an assumption >> that could break future implementations. For instance, the PowerNV >> platform CPUs use real HW ids and they are not contiguous. >> >> Let's introduce some helpers to hide the underlying structure of the >> ICP array. The criteria to look for an ICPstate is still the CPU index >> but it is decorrelated from the array index. >> >> This is an RFC to see what people think. It is used on the powernv >> branch but it won't apply as it is on upstream. It should certainly be >> optimised when a large number of CPUs are configured. >> >> Signed-off-by: C=E9dric Le Goater >=20 > Hm, so. >=20 > First, I think the helpers to get the right icp state are a good idea, > regardless of anything else. I'm happy to go ahead with a patch which > introduces just that, because it will make future revisions easier. yes. that would be a first step, to hide the underlying implementation.=20 > But, the rest of the changes seem to be predicated on allowing > non-contiguous cpu_index values. Maybe we want to do that eventually, > but we're a pretty long way off at present, doing so involves work in > libvirt as well as qemu itself, and it's not clear we actually want > it. OK. The pir being used in most places in the code, this is not a big problem, and even this part in the core object : + env->spr[SPR_PIR] =3D cs->cpu_index; could be easily worked out. I was just lazy.=20 So the only area where we are using cpu_index is in xics for the=20 ICPState indexing. > I think for the time being you'd be better off keeping the simple > array of icp states indexed by contiguous (barring cpu hotplug) > cpu_index values, and dissociating the physical IDs (PIR =3D=3D interru= pt > server number =3D=3D DT id, IIUC) from the cpu_index. Obviously you'll > need helpers to convert between cpu_index and physical ID at the > machine level. If we keep the helper idea but transform them into XICSStateClass=20 methods, we can define customs ops in xics_native and handle the=20 conversion real-id <-> icp id there. I think a simple array under=20 xics_native would do. I will try that in v4. Thanks, C.=20