From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33588) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3eTj-000585-6Z for qemu-devel@nongnu.org; Tue, 01 Dec 2015 01:31:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a3eTg-0004tp-Kr for qemu-devel@nongnu.org; Tue, 01 Dec 2015 01:31:55 -0500 Date: Tue, 1 Dec 2015 17:32:24 +1100 From: David Gibson Message-ID: <20151201063224.GV31343@voom.redhat.com> References: <1447201710-10229-1-git-send-email-benh@kernel.crashing.org> <1447201710-10229-40-git-send-email-benh@kernel.crashing.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="MUnXZt0Uv08c1hBe" Content-Disposition: inline In-Reply-To: <1447201710-10229-40-git-send-email-benh@kernel.crashing.org> Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH 39/77] ppc/xics: Add xics to the monitor "info pic" command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Benjamin Herrenschmidt Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org --MUnXZt0Uv08c1hBe Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Nov 11, 2015 at 11:27:52AM +1100, Benjamin Herrenschmidt wrote: > Useful to debug interrupt problems. Ugh.. I can see the use of this, but we really want to just deprecate info pic entirely, it's an awful, awful interface. I think the right way to do this is to allow some state introspection via the QOM interfaces on the xics devices themselves, but I'm not immediately sure how to go about that. >=20 > Signed-off-by: Benjamin Herrenschmidt > --- > hmp-commands-info.hx | 2 ++ > hw/intc/xics.c | 38 ++++++++++++++++++++++++++++++++++++++ > hw/ppc/ppc.c | 14 ++++++++++++++ > include/hw/ppc/ppc.h | 2 ++ > include/hw/ppc/xics.h | 2 ++ > monitor.c | 3 +++ > 6 files changed, 61 insertions(+) >=20 > diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx > index 9b71351..2f1dc86 100644 > --- a/hmp-commands-info.hx > +++ b/hmp-commands-info.hx > @@ -203,6 +203,8 @@ ETEXI > .mhandler.cmd =3D sun4m_hmp_info_pic, > #elif defined(TARGET_LM32) > .mhandler.cmd =3D lm32_hmp_info_pic, > +#elif defined(TARGET_PPC) > + .mhandler.cmd =3D ppc_hmp_info_pic, > #else > .mhandler.cmd =3D hmp_info_pic, > #endif > diff --git a/hw/intc/xics.c b/hw/intc/xics.c > index 4b33e6d..d027a24 100644 > --- a/hw/intc/xics.c > +++ b/hw/intc/xics.c > @@ -31,6 +31,9 @@ > #include "hw/ppc/xics.h" > #include "qemu/error-report.h" > #include "qapi/visitor.h" > +#include "monitor/monitor.h" > + > +static XICSState *g_xics; > =20 > int get_cpu_index_by_dt_id(int cpu_dt_id) > { > @@ -170,6 +173,9 @@ static void xics_common_initfn(Object *obj) > object_property_add(obj, "nr_servers", "int", > xics_prop_get_nr_servers, xics_prop_set_nr_serve= rs, > NULL, NULL, NULL); > + > + /* For exclusive use of monitor command */ > + g_xics =3D XICS_COMMON(obj); > } > =20 > static void xics_common_class_init(ObjectClass *oc, void *data) > @@ -614,6 +620,38 @@ static int ics_dispatch_post_load(void *opaque, int = version_id) > return 0; > } > =20 > +void xics_hmp_info_pic(Monitor *mon, const QDict *qdict) > +{ > + ICSState *ics; > + uint32_t i; > + > + for (i =3D 0; i < g_xics->nr_servers; i++) { > + ICPState *icp =3D &g_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, &g_xics->ics, list) { > + monitor_printf(mon, "ICS %4x..%4x %p\n", > + ics->offset, ics->offset + ics->nr_irqs - 1, ics); > + 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); > + } > + } > +} > + > static const VMStateDescription vmstate_ics_simple_irq =3D { > .name =3D "ics/irq", > .version_id =3D 2, > diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c > index 2c604ef..3b14f09 100644 > --- a/hw/ppc/ppc.c > +++ b/hw/ppc/ppc.c > @@ -24,6 +24,7 @@ > #include "hw/hw.h" > #include "hw/ppc/ppc.h" > #include "hw/ppc/ppc_e500.h" > +#include "hw/i386/pc.h" > #include "qemu/timer.h" > #include "sysemu/sysemu.h" > #include "sysemu/cpus.h" > @@ -35,6 +36,10 @@ > #include "kvm_ppc.h" > #include "trace.h" > =20 > +#if defined(TARGET_PPC64) > +#include "hw/ppc/xics.h" > +#endif > + > //#define PPC_DEBUG_IRQ > //#define PPC_DEBUG_TB > =20 > @@ -1337,3 +1342,12 @@ PowerPCCPU *ppc_get_vcpu_by_dt_id(int cpu_dt_id) > =20 > return NULL; > } > + > +void ppc_hmp_info_pic(Monitor *mon, const QDict *qdict) > +{ > + /* Call in turn every PIC around. OpenPIC doesn't have one yet */ > +#ifdef TARGET_PPC64 > + xics_hmp_info_pic(mon, qdict); > +#endif > + hmp_info_pic(mon, qdict); > +} > diff --git a/include/hw/ppc/ppc.h b/include/hw/ppc/ppc.h > index 14efd0c..d5c648d 100644 > --- a/include/hw/ppc/ppc.h > +++ b/include/hw/ppc/ppc.h > @@ -1,6 +1,8 @@ > #ifndef HW_PPC_H > #define HW_PPC_H 1 > =20 > +void ppc_hmp_info_pic(Monitor *mon, const QDict *qdict); > + > void ppc_set_irq(PowerPCCPU *cpu, int n_IRQ, int level); > =20 > /* PowerPC hardware exceptions management helpers */ > diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h > index f32f409..1cf7037 100644 > --- a/include/hw/ppc/xics.h > +++ b/include/hw/ppc/xics.h > @@ -213,4 +213,6 @@ void xics_set_nr_servers(XICSState *icp, uint32_t nr_= servers, Error **errp); > ICSState *xics_find_source(XICSState *icp, int irq); > void xics_add_ics(XICSState *xics, ICSState *ics); > =20 > +void xics_hmp_info_pic(Monitor *mon, const QDict *qdict); > + > #endif /* __XICS_H__ */ > diff --git a/monitor.c b/monitor.c > index 3295840..988477e 100644 > --- a/monitor.c > +++ b/monitor.c > @@ -76,6 +76,9 @@ > #include "qapi-event.h" > #include "qmp-introspect.h" > #include "sysemu/block-backend.h" > +#if defined(TARGET_PPC) > +#include "hw/ppc/ppc.h" > +#endif > =20 > /* for hmp_info_irq/pic */ > #if defined(TARGET_SPARC) --=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 --MUnXZt0Uv08c1hBe Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWXT74AAoJEGw4ysog2bOS1X0P/3fbrwP0m1i+EIQ4314lysaI z5sqVlKcfpq4T+a4SupVOEV5kKe39nRWS89O+C6Z+NWGzx0kp9cPbnA2HfIGbNXc kDskO8ivLkx3V5M7B89TY0v1S0igjyAk65Ynr5BOgsog1w+tvDCWplGlq1G/uCPn VmBduyyXPvP+3tUUh+69/w+ml9MT3O7UXB6uBK3F1n0cMF+hfl4hD7puPmrAdn4p SRTCb5Pda05mHo8xOiyx4qTpRtcFJFRQU2zbEciI+Sth40T3lPU2E1rBS/Gv9OIx U7tgxlaS6zFMul39136pPezQydEeWgFbdAknkKgMZNOPAqEcBsrfkAXZdqU+Afpj PZ6S2jazKy6f3v2frGl+G8Mt9oQzvOw6nAZRGhC4/rlvXW1CPIIcm39ozZuuHm9O kGx6ezkLzi9Wev5DGTiM5IuZTmkAC8KwOImggTdzHNBSl7pQfgpaPMXXFok0UQhZ YCtD1riv2k38O6o7Z252nrCzCY6g0zWBfGRthWCiwX1hhNmVa+LHw4d2K/+JJtnE QkbwgNHwV7S1rEgochCvaiEx577ucvCbWpU0XtM6xJBC/I3s9/phePV/f5KKejyx PYsrvBsm+hzZrgb5tlb1f5aWPuIX0uVq2Dvr4EG43aAENBsRwgEwnf/QLzNP3lwB yZ3sIW5uWz1bSbCVlM8y =p3HC -----END PGP SIGNATURE----- --MUnXZt0Uv08c1hBe--