From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35416) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwI24-0004pr-Ix for qemu-devel@nongnu.org; Mon, 17 Oct 2016 20:13:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwI23-00018I-5A for qemu-devel@nongnu.org; Mon, 17 Oct 2016 20:13:28 -0400 Date: Tue, 18 Oct 2016 10:44:42 +1100 From: David Gibson Message-ID: <20161017234442.GX25390@umbus.fritz.box> References: <1476736394-560-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ubBGeysJ7fFOU9Y9" Content-Disposition: inline In-Reply-To: <1476736394-560-1-git-send-email-clg@kaod.org> Subject: Re: [Qemu-devel] [PATCH] ppc/xics: Add xics to the monitor "info pic" command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?iso-8859-1?Q?C=E9dric?= Le Goater Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, Benjamin Herrenschmidt --ubBGeysJ7fFOU9Y9 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 17, 2016 at 10:33:14PM +0200, C=E9dric Le Goater wrote: > From: Benjamin Herrenschmidt >=20 > Useful to debug interrupt problems. >=20 > Signed-off-by: Benjamin Herrenschmidt > [clg: - updated for qemu-2.7 > - added a test on ->irqs as it is not necessarily allocated > (PHB3_MSI) > - removed static variable g_xics and replace with a loop on all > children to find the xics objects. > - rebased on InterruptStatsProvider interface ] > Signed-off-by: C=E9dric Le Goater Applied to ppc-for-2.8. > --- > hw/intc/xics.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 49 insertions(+) >=20 > diff --git a/hw/intc/xics.c b/hw/intc/xics.c > index f40b00003a45..7fac964fbd27 100644 > --- a/hw/intc/xics.c > +++ b/hw/intc/xics.c > @@ -35,6 +35,8 @@ > #include "hw/ppc/xics.h" > #include "qemu/error-report.h" > #include "qapi/visitor.h" > +#include "monitor/monitor.h" > +#include "hw/intc/intc.h" > =20 > int xics_get_cpu_index_by_dt_id(int cpu_dt_id) > { > @@ -90,6 +92,47 @@ void xics_cpu_setup(XICSState *xics, PowerPCCPU *cpu) > } > } > =20 > +static void xics_common_pic_print_info(InterruptStatsProvider *obj, > + Monitor *mon) > +{ > + XICSState *xics =3D XICS_COMMON(obj); > + ICSState *ics; > + uint32_t i; > + > + for (i =3D 0; i < xics->nr_servers; i++) { > + ICPState *icp =3D &xics->ss[i]; > + > + if (!icp->output) { > + continue; > + } > + monitor_printf(mon, "CPU %d XIRR=3D%08x (%p) PP=3D%02x MFRR=3D%0= 2x\n", > + i, icp->xirr, icp->xirr_owner, > + icp->pending_priority, icp->mfrr); > + } > + > + QLIST_FOREACH(ics, &xics->ics, list) { > + monitor_printf(mon, "ICS %4x..%4x %p\n", > + ics->offset, ics->offset + ics->nr_irqs - 1, ics); > + > + if (!ics->irqs) { > + continue; > + } > + > + for (i =3D 0; i < ics->nr_irqs; i++) { > + ICSIRQState *irq =3D ics->irqs + i; > + > + if (!(irq->flags & XICS_FLAGS_IRQ_MASK)) { > + continue; > + } > + monitor_printf(mon, " %4x %s %02x %02x\n", > + ics->offset + i, > + (irq->flags & XICS_FLAGS_IRQ_LSI) ? > + "LSI" : "MSI", > + irq->priority, irq->status); > + } > + } > +} > + > /* > * XICS Common class - parent for emulated XICS and KVM-XICS > */ > @@ -190,8 +233,10 @@ static void xics_common_initfn(Object *obj) > static void xics_common_class_init(ObjectClass *oc, void *data) > { > DeviceClass *dc =3D DEVICE_CLASS(oc); > + InterruptStatsProviderClass *ic =3D INTERRUPT_STATS_PROVIDER_CLASS(o= c); > =20 > dc->reset =3D xics_common_reset; > + ic->print_info =3D xics_common_pic_print_info; > } > =20 > static const TypeInfo xics_common_info =3D { > @@ -201,6 +246,10 @@ static const TypeInfo xics_common_info =3D { > .class_size =3D sizeof(XICSStateClass), > .instance_init =3D xics_common_initfn, > .class_init =3D xics_common_class_init, > + .interfaces =3D (InterfaceInfo[]) { > + { TYPE_INTERRUPT_STATS_PROVIDER }, > + { } > + }, > }; > =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 --ubBGeysJ7fFOU9Y9 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYBWJqAAoJEGw4ysog2bOSgGUQALucJ3lWoX5zhonhX0wEYz94 f6l49U/l8q+YEfEsPgsG6ZaA+3BKLK84sgFs/wQtCnmrzoHO7E/uRsFLIidfV0Xi CnToOEbjpbFljTPn4RMkcpiUkDIjXEnmmyp5zJe0ueWY7ufb9/1u0tLkvPXp1Qw0 C1QayIrKD5kWSd5TcHktBtfdJgRuBV0nY8sZrO9HQczqrm2rxzRe7k1bDZgg+krk KgcIOITV/36+OStzo+GxH4pAJ3wk5JSZQHC1OiI1KN/PTImOU5a9qEObgCxd90TT pWJQ2rt3pyvk2QDEFSHjthj1dBxCqYDsjHdNbn1Glwabx55XL7ND4nm2BDMtGg5e u+CbJeoyvIq7J23+dH6QJxK8HXGCpBAbU3FpZG3c+tpNcUG1MoozVx1b9b7k7JoU ZNKX/trMWwVAlnG0sqRxzyudi49TXrz83zXT7gga/DGu85RtlUmSJTwHE/Q9mJTu rpOx4X4ZYbeLpS+1XhGjl//fVeWlSjXfhRwNnZ1+SseHvo4MTEksQd5Ld5X4P/Ou BFHlUeXFnQHJbJSU8ysWXjtaqNiXjO2YNQI1C9CBGUFdIcl23mMhsdwYy1gFQiqR QgZ/zbvyMN1K66Ekb4UyTGTtYt/Nk9luaVY9wqQU94BMjnyWgf86O8ZgGIUxJBGF 26fxR2KITtM+3r9UQjNx =CpLE -----END PGP SIGNATURE----- --ubBGeysJ7fFOU9Y9--