Received: from eggs.gnu.org ([2001:4830:134:3::10]:51504) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bh4cK-0002HR-TC for qemu-devel@nongnu.org; Mon, 05 Sep 2016 20:52:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bh4cG-0003aJ-Ob for qemu-devel@nongnu.org; Mon, 05 Sep 2016 20:51:59 -0400 Date: Tue, 6 Sep 2016 10:48:47 +1000 From: David Gibson Message-ID: <20160906004847.GB2900@voom.fritz.box> References: <1472661255-20160-1-git-send-email-clg@kaod.org> <1472661255-20160-4-git-send-email-clg@kaod.org> <20160905033909.GA3816@voom.fritz.box> <1473059513.2313.44.camel@kernel.crashing.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="gj572EiMnwbLXET9" Content-Disposition: inline In-Reply-To: <1473059513.2313.44.camel@kernel.crashing.org> Subject: Re: [Qemu-devel] [PATCH v2 3/7] ppc/pnv: Add XSCOM infrastructure List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Benjamin Herrenschmidt Cc: =?iso-8859-1?Q?C=E9dric?= Le Goater , qemu-ppc@nongnu.org, qemu-devel@nongnu.org, Alexander Graf --gj572EiMnwbLXET9 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 05, 2016 at 05:11:53PM +1000, Benjamin Herrenschmidt wrote: > On Mon, 2016-09-05 at 13:39 +1000, David Gibson wrote: > > > +static XScomDevice *xscom_find_target(XScomState *s, uint32_t > > pcb_addr, > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 uint32_t *range) > > > +{ > > > +=A0=A0=A0 BusChild *bc; > > > + > > > +=A0=A0=A0 QTAILQ_FOREACH(bc, &s->bus->bus.children, sibling) { > > > +=A0=A0=A0=A0=A0=A0=A0 DeviceState *qd =3D bc->child; > > > +=A0=A0=A0=A0=A0=A0=A0 XScomDevice *xd =3D XSCOM_DEVICE(qd); > > > +=A0=A0=A0=A0=A0=A0=A0 unsigned int i; > > > + > > > +=A0=A0=A0=A0=A0=A0=A0 for (i =3D 0; i < MAX_XSCOM_RANGES; i++) { > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if (xd->ranges[i].addr <=3D pcb_ad= dr && > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (xd->ranges[i].addr + = xd->ranges[i].size) > > > pcb_addr) { > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 *range =3D i; > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 return xd; > > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 } > > > +=A0=A0=A0=A0=A0=A0=A0 } > > > +=A0=A0=A0 } > >=20 > > Hmm.. you could set up a SCOM local address space using the > > infrastructure in memory.c, rather than doing your own dispatch. >=20 > There are pros and cons to this approach. The memory.c stuff comes with > quite a lot of baggage, not all of it very shinny to be honest ;-) I > still *hate* how it forces upon us a whole 128-bit integer arithmetic > library just so that it can represent 1_0000_0000_0000_0000 ...=A0 Ugh, yeah. I tried to argue against this when it first came in, but was overruled. > It would be make more sense to use inclusive start/end instead and > stick to 64-bits. >=20 > That being said, we could do that. We'd have to shift the XSCOM > addresses left by 3 since each address is an 8 bytes reigster and > forbid non-8-bytes accesses. Ok. I'm not particularly fussed either way. --=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 --gj572EiMnwbLXET9 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBAgAGBQJXzhJvAAoJEGw4ysog2bOSvCwP/3jr6J8S+iAoai7rJy3Y4KXb 3lPlPNc5aLTHbkxevoS4hS5MUZl8hs5wkN795osYWClzUDFU9zUI4vjd3MdAVubG IPSbI/3eLg/FhkinjypBYIeAA+R5Ogly4oJnVmbXesnRm0xmE1p0WSKwXDTfetJH ThBK+39wc7C4y6Etp4WO40s0gOc50scNe9LQKAwKQ4gjJw3m59vqMlAJBE39x1Hu eURhLCjErEClZ0ivKsMITz7f9RF9qFxqdV7anCNUsGOXRxDEeky4lyczPmW+WWyX 6jN3efBKZUAoMGdvda4UyA8ZS2jdLFGOWGt7d1RYvr715HX0uUEMBgDh2yiHDdl7 ZH1sd2GvWcDTh9EZiqxY+FBafAD9pW7dA9Crc6ehAUigWTciLy6HVtAUFBTJ66Ne nOLTxdeRVWPdGkspj/PdLwWlOofxL8zLLuz1RmCUlOCZTlVLq1FUCQ5R01Z3ck0g X/Ch7Kgcz23IfwzrvyXsA9crq1NhZxDymE1sCubWYUqy4WDx1o1Yw6oiPFT2/ESK 2BdLEJ7huRIBiGyywFxC7+hUd6T5+8SOVL7XWombj5IN4kbY2k46PIqwG5P35wnt NYFpwsDL+LvHcjUct8DJt2kAIZlrVZo9MGzNB1x0bMT0YUo23f+xcJLuLfkZfdyw CPLmEOwz+3Z3ZpH8+GtU =8FZx -----END PGP SIGNATURE----- --gj572EiMnwbLXET9--