Received: from eggs.gnu.org ([2001:4830:134:3::10]:43386) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhv4J-00046k-7P for qemu-devel@nongnu.org; Thu, 08 Sep 2016 04:52:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bhv4E-0001Yr-1c for qemu-devel@nongnu.org; Thu, 08 Sep 2016 04:52:22 -0400 Received: from 10.mo173.mail-out.ovh.net ([46.105.74.148]:53817) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhv4D-0001YS-RW for qemu-devel@nongnu.org; Thu, 08 Sep 2016 04:52:17 -0400 Received: from player711.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo173.mail-out.ovh.net (Postfix) with ESMTP id D15441004778 for ; Thu, 8 Sep 2016 10:52:16 +0200 (CEST) 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> <20160906004847.GB2900@voom.fritz.box> <3af4c2d9-7263-7c54-0a12-c0b4108c65bd@kaod.org> <1473198436.8689.38.camel@kernel.crashing.org> <5a384cf3-7a63-77c1-2a9b-30f81d05296e@kaod.org> <1473285193.8689.84.camel@kernel.crashing.org> From: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= Message-ID: <2db6d1df-c737-48d8-a6fa-381da58c6d44@kaod.org> Date: Thu, 8 Sep 2016 10:52:11 +0200 MIME-Version: 1.0 In-Reply-To: <1473285193.8689.84.camel@kernel.crashing.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 , David Gibson Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, Alexander Graf On 09/07/2016 11:53 PM, Benjamin Herrenschmidt wrote: > On Wed, 2016-09-07 at 17:47 +0200, C=C3=A9dric Le Goater wrote: >> =20 >> +static uint64_t pnv_lpc_xscom_mr_read(void *opaque, hwaddr addr, >> unsigned size) >> +{ >> + XScomDevice *xd =3D XSCOM_DEVICE(opaque); >> + uint64_t val =3D 0; >> + >> + pnv_lpc_xscom_read(xd, 0, xscom_to_pcb_addr(xd->chip_type, >> addr), &val); >> + return val; >> +} >> + >> +static void pnv_lpc_xscom_mr_write(void *opaque, hwaddr addr, >> + uint64_t val, unsigned size) >> +{ >> + XScomDevice *xd =3D XSCOM_DEVICE(opaque); >> + pnv_lpc_xscom_write(xd, 0, xscom_to_pcb_addr(xd->chip_type, >> addr), val); >> +} >> >=20 > I don't understand. That's not at all why I suggested or I'm missing > something. This was a preliminary hack on the full powernv tree to study the=20 question. I made the two options cohabitate in the same qemu to see=20 what were the issues and possible solutions. The result is very much what you describe below. I need to start=20 from the beginning now, and not the end, to make something cleaner. > What I suggest is that you have a memory region per-chip (which is NOT > hooked onto the main address space) which represents the PCB space. > Calling xscom_region. Hook it up to its own address_space. > > Thus, the various devices (LPC, OCC, etc...) all just register a sub- > region of that address space using the PCB addresses directly (well, > shifted left by 3 because it's 8 bytes registers but that's it). >=20 > The XSCOM "controller" AKA ADU is the one doing the bridge. It > registers an MMIO region in the main address space (SysBusDevice ?) > and from the MMIO accessors, it does the address mangling, and use > address_space_rw() to trigger accesses onto that chip's xscom_region. yes. this is what your XSCOM bridge does already. name =3D g_strdup_printf("xscom-%x", s->chip_id); memory_region_init_io(&s->mem, OBJECT(s), &xscom_ops, s, name, XSCOM_= SIZE); sysbus_init_mmio(sbd, &s->mem); sysbus_mmio_map(sbd, 0, XSCOM_BASE(s->chip_id)); Thanks, C.=20