From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43450) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHjye-0006FM-KR for qemu-devel@nongnu.org; Mon, 27 Jun 2016 23:46:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bHjya-0006t7-L6 for qemu-devel@nongnu.org; Mon, 27 Jun 2016 23:46:19 -0400 Date: Tue, 28 Jun 2016 12:58:26 +1000 From: David Gibson Message-ID: <20160628025826.GV4242@voom.fritz.box> References: <1466704050-15108-1-git-send-email-nikunj@linux.vnet.ibm.com> <1466704050-15108-11-git-send-email-nikunj@linux.vnet.ibm.com> <20160627043645.GI4242@voom.fritz.box> <87d1n33qly.fsf@abhimanyu.i-did-not-set--mail-host-address--so-tickle-me> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Lez9QO3Seu3ycz0M" Content-Disposition: inline In-Reply-To: <87d1n33qly.fsf@abhimanyu.i-did-not-set--mail-host-address--so-tickle-me> Subject: Re: [Qemu-devel] [PATCH v1 10/11] ppc/xics: Add "native" XICS subclass List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Nikunj A Dadhania Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, clg@kaod.org, Benjamin Herrenschmidt --Lez9QO3Seu3ycz0M Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jun 27, 2016 at 03:23:13PM +0530, Nikunj A Dadhania wrote: > David Gibson writes: >=20 > > [ Unknown signature status ] > > On Thu, Jun 23, 2016 at 11:17:29PM +0530, Nikunj A Dadhania wrote: > >> From: Benjamin Herrenschmidt > >>=20 > >> This provides MMIO based ICP access as found on POWER8 > >>=20 > >> Signed-off-by: Benjamin Herrenschmidt > >> Signed-off-by: Nikunj A Dadhania > >> --- > >> default-configs/ppc64-softmmu.mak | 3 +- > >> hw/intc/Makefile.objs | 1 + > >> hw/intc/xics_native.c | 295 +++++++++++++++++++++++++++++= +++++++++ > >> include/hw/ppc/xics.h | 14 ++ > >> 4 files changed, 312 insertions(+), 1 deletion(-) > >> create mode 100644 hw/intc/xics_native.c > >>=20 > >> diff --git a/default-configs/ppc64-softmmu.mak b/default-configs/ppc64= -softmmu.mak > >> index c4be59f..315e30b 100644 > >> --- a/default-configs/ppc64-softmmu.mak > >> +++ b/default-configs/ppc64-softmmu.mak > >> @@ -48,8 +48,9 @@ CONFIG_PLATFORM_BUS=3Dy > >> CONFIG_ETSEC=3Dy > >> CONFIG_LIBDECNUMBER=3Dy > >> # For pSeries > >> -CONFIG_XICS=3D$(CONFIG_PSERIES) > >> +CONFIG_XICS=3D$(or $(CONFIG_PSERIES),$(CONFIG_POWERNV)) > >> CONFIG_XICS_SPAPR=3D$(CONFIG_PSERIES) > >> +CONFIG_XICS_NATIVE=3D$(CONFIG_POWERNV) > >> CONFIG_XICS_KVM=3D$(and $(CONFIG_PSERIES),$(CONFIG_KVM)) > > > > I don't think you've introduced CONFIG_POWERNV in your patches so far, > > making this a bit weird. >=20 > I had kept this patch for completeness and review. We can push this once > the POWERNV bits trickles in. >=20 > > > >> # For PReP > >> CONFIG_MC146818RTC=3Dy > >> diff --git a/hw/intc/Makefile.objs b/hw/intc/Makefile.objs > >> index 530df2e..f8bbeda 100644 > >> --- a/hw/intc/Makefile.objs > >> +++ b/hw/intc/Makefile.objs > >> @@ -31,6 +31,7 @@ obj-$(CONFIG_RASPI) +=3D bcm2835_ic.o bcm2836_contro= l.o > >> obj-$(CONFIG_SH4) +=3D sh_intc.o > >> obj-$(CONFIG_XICS) +=3D xics.o > >> obj-$(CONFIG_XICS_SPAPR) +=3D xics_spapr.o > >> +obj-$(CONFIG_XICS_NATIVE) +=3D xics_native.o > >> obj-$(CONFIG_XICS_KVM) +=3D xics_kvm.o > >> obj-$(CONFIG_ALLWINNER_A10_PIC) +=3D allwinner-a10-pic.o > >> obj-$(CONFIG_S390_FLIC) +=3D s390_flic.o > >> diff --git a/hw/intc/xics_native.c b/hw/intc/xics_native.c > >> new file mode 100644 > >> index 0000000..26e45cc > >> --- /dev/null > >> +++ b/hw/intc/xics_native.c > >> @@ -0,0 +1,295 @@ > >> +/* > >> + * QEMU PowerPC hardware System Emulator > >> + * > >> + * Native version of ICS/ICP > >> + * > >> + * Copyright (c) 2010,2011 David Gibson, IBM Corporation. > > > > Surely this should have yours or Ben's copyright in addition to mine. >=20 > Sure, will add Ben's copyright. >=20 > >> + * Permission is hereby granted, free of charge, to any person obtain= ing a copy > >> + * of this software and associated documentation files (the "Software= "), to deal > >> + * in the Software without restriction, including without limitation = the rights > >> + * to use, copy, modify, merge, publish, distribute, sublicense, and/= or sell > >> + * copies of the Software, and to permit persons to whom the Software= is > >> + * furnished to do so, subject to the following conditions: > >> + * > >> + * The above copyright notice and this permission notice shall be inc= luded in > >> + * all copies or substantial portions of the Software. > >> + * > >> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EX= PRESS OR > >> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTAB= ILITY, > >> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT = SHALL > >> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES = OR OTHER > >> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, AR= ISING FROM, > >> + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEAL= INGS IN > >> + * THE SOFTWARE. > >> + * > >> + */ > >> + > >> +#include "qemu/osdep.h" > >> +#include "hw/hw.h" > >> +#include "trace.h" > >> +#include "qemu/timer.h" > >> +#include "hw/ppc/xics.h" > >> +#include "qapi/visitor.h" > >> +#include "qapi/error.h" > >> + > >> +#include > >> + > >> +/* #define DEBUG_MM(fmt...) printf(fmt) */ > >> +#define DEBUG_MM(fmt...) do { } while (0) > >> + > >> +static void xics_native_initfn(Object *obj) > >> +{ > >> + XICSState *xics =3D XICS_NATIVE(obj); > >> + > >> + QLIST_INIT(&xics->ics); > >> +} > >> + > >> +static uint64_t icp_mm_read(void *opaque, hwaddr addr, unsigned width) > >> +{ > >> + XICSState *s =3D opaque; > >> + int32_t cpu_id, server; > >> + uint32_t val; > >> + ICPState *ss; > >> + bool byte0 =3D (width =3D=3D 1 && (addr & 0x3) =3D=3D 0); > >> + > >> + cpu_id =3D (addr & (ICP_MM_SIZE - 1)) >> 12; > >> + server =3D get_cpu_index_by_dt_id(cpu_id); > > > > Shouldn't each ICP instance register its own MMIO window? >=20 > That is how the hardware works. Moreover, there is an SCOM that controls > ICP BAR. We might support moving the ICP BAR at some stage so I'd rather > keep it consistent. Ok. >=20 > [...] >=20 > >> + > >> +#define _FDT(exp) \ > >> + do { \ > >> + int ret =3D (exp); \ > >> + if (ret < 0) { \ > >> + fprintf(stderr, "qemu: error creating device tree: %s: %s= \n", \ > >> + #exp, fdt_strerror(ret)); \ > >> + exit(1); \ > >> + } \ > >> + } while (0) > > > > Ugh, I have got to find time to push by qdt cleanup stuff again. >=20 > Yes, those are nice set of patches. >=20 > > Not within scope for this patch obviously, though. > > > >> =20 > >> #define XICS_IPI 0x2 > >> #define XICS_BUID 0x1 > >> @@ -84,6 +89,7 @@ struct XICSState { > >> uint32_t nr_irqs; > >> ICPState *ss; > >> QLIST_HEAD(, ICSState) ics; > >> + MemoryRegion icp_mmio; > > > > This is only used by XICSNative, so it should be in a structure just > > for the subclass, not in the common struct. >=20 > Sure. >=20 > >> }; > >> =20 > >> #define TYPE_ICP "icp" > >> @@ -115,8 +121,13 @@ struct ICPState { > >> uint8_t mfrr; > >> qemu_irq output; > >> bool cap_irq_xics_enabled; > >> + uint32_t links[3]; > > > > Likewise here. >=20 > Ok. >=20 > Regards > Nikunj >=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 --Lez9QO3Seu3ycz0M Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXcefSAAoJEGw4ysog2bOSHoAP/i3+/zurWJF+hgSVWI4/Wt0Z MjF3+RomPMBeaXjv/+gNULrF69jZVackglTiEqb4z1fr2XzLggYY7LjzKIfXNN9p E6u2wsGuFUqfhHmuVOJ/TZuO4hPICvSjFzuqFeOiYVjsn0Ix/QuNCS3kKJ1B727n AcF8uaTrm5v6CEj7p3mUkk/4pqc0V0HHWpxrXPPmMVkFb+35mddR/RwfgJzFRbCV GSB7eiSUcz9o8km+TnaIrH8MXPL1m8Ba0jmH1Gm0cXuqm9KhRqo+SMpg8juCiejx ih+1mFOzzy1BlX6HZPokaNVtqld64RpYOKC1R/a+t4hFu/FZqwNbHrLI8zFFJdes PN0zDI6P2vXYzK/RPDupcB5SoiKYWRVD16NYrYakh0ceGVR5wSLflXB0Iv2PykYd I7qagAn8Lpc+yaF/LXmEZpJd3MauMP4m+sFTQY3PX5WBBzpZ+p0aSZjExmkJNNuw NG0BipFqhB0g3NgYXHqgDErTBtWkQJmHDfs8X8T7WcHf51gkCO++V0couLyHUjRc ujMolYdRdeyjjD+aQdC1G4eJPqnk0/C1Isu2mrtl+rL/UpVZXNdYccNQKd9/lSS0 WU0DZzlUE+hYgoxDp4AA6N9rCjKILwwZztRZkCB6nmcjegLzhjQMER1QfAqRPW6y IMYU/t2izj34Q+V1yIAf =gRhp -----END PGP SIGNATURE----- --Lez9QO3Seu3ycz0M--