* [Qemu-devel] [PATCH] ppc/xics: Add xics to the monitor "info pic" command
@ 2016-10-17 20:33 Cédric Le Goater
2016-10-17 23:44 ` David Gibson
0 siblings, 1 reply; 2+ messages in thread
From: Cédric Le Goater @ 2016-10-17 20:33 UTC (permalink / raw)
To: qemu-ppc; +Cc: David Gibson, qemu-devel, Cedric Le Goater,
Benjamin Herrenschmidt
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Useful to debug interrupt problems.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
[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édric Le Goater <clg@kaod.org>
---
hw/intc/xics.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
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"
int xics_get_cpu_index_by_dt_id(int cpu_dt_id)
{
@@ -90,6 +92,47 @@ void xics_cpu_setup(XICSState *xics, PowerPCCPU *cpu)
}
}
+static void xics_common_pic_print_info(InterruptStatsProvider *obj,
+ Monitor *mon)
+{
+ XICSState *xics = XICS_COMMON(obj);
+ ICSState *ics;
+ uint32_t i;
+
+ for (i = 0; i < xics->nr_servers; i++) {
+ ICPState *icp = &xics->ss[i];
+
+ if (!icp->output) {
+ continue;
+ }
+ monitor_printf(mon, "CPU %d XIRR=%08x (%p) PP=%02x MFRR=%02x\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 = 0; i < ics->nr_irqs; i++) {
+ ICSIRQState *irq = 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 = DEVICE_CLASS(oc);
+ InterruptStatsProviderClass *ic = INTERRUPT_STATS_PROVIDER_CLASS(oc);
dc->reset = xics_common_reset;
+ ic->print_info = xics_common_pic_print_info;
}
static const TypeInfo xics_common_info = {
@@ -201,6 +246,10 @@ static const TypeInfo xics_common_info = {
.class_size = sizeof(XICSStateClass),
.instance_init = xics_common_initfn,
.class_init = xics_common_class_init,
+ .interfaces = (InterfaceInfo[]) {
+ { TYPE_INTERRUPT_STATS_PROVIDER },
+ { }
+ },
};
/*
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] ppc/xics: Add xics to the monitor "info pic" command
2016-10-17 20:33 [Qemu-devel] [PATCH] ppc/xics: Add xics to the monitor "info pic" command Cédric Le Goater
@ 2016-10-17 23:44 ` David Gibson
0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2016-10-17 23:44 UTC (permalink / raw)
To: Cédric Le Goater; +Cc: qemu-ppc, qemu-devel, Benjamin Herrenschmidt
[-- Attachment #1: Type: text/plain, Size: 3649 bytes --]
On Mon, Oct 17, 2016 at 10:33:14PM +0200, Cédric Le Goater wrote:
> From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>
> Useful to debug interrupt problems.
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> [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édric Le Goater <clg@kaod.org>
Applied to ppc-for-2.8.
> ---
> hw/intc/xics.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 49 insertions(+)
>
> 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"
>
> int xics_get_cpu_index_by_dt_id(int cpu_dt_id)
> {
> @@ -90,6 +92,47 @@ void xics_cpu_setup(XICSState *xics, PowerPCCPU *cpu)
> }
> }
>
> +static void xics_common_pic_print_info(InterruptStatsProvider *obj,
> + Monitor *mon)
> +{
> + XICSState *xics = XICS_COMMON(obj);
> + ICSState *ics;
> + uint32_t i;
> +
> + for (i = 0; i < xics->nr_servers; i++) {
> + ICPState *icp = &xics->ss[i];
> +
> + if (!icp->output) {
> + continue;
> + }
> + monitor_printf(mon, "CPU %d XIRR=%08x (%p) PP=%02x MFRR=%02x\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 = 0; i < ics->nr_irqs; i++) {
> + ICSIRQState *irq = 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 = DEVICE_CLASS(oc);
> + InterruptStatsProviderClass *ic = INTERRUPT_STATS_PROVIDER_CLASS(oc);
>
> dc->reset = xics_common_reset;
> + ic->print_info = xics_common_pic_print_info;
> }
>
> static const TypeInfo xics_common_info = {
> @@ -201,6 +246,10 @@ static const TypeInfo xics_common_info = {
> .class_size = sizeof(XICSStateClass),
> .instance_init = xics_common_initfn,
> .class_init = xics_common_class_init,
> + .interfaces = (InterfaceInfo[]) {
> + { TYPE_INTERRUPT_STATS_PROVIDER },
> + { }
> + },
> };
>
> /*
--
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-10-18 0:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-17 20:33 [Qemu-devel] [PATCH] ppc/xics: Add xics to the monitor "info pic" command Cédric Le Goater
2016-10-17 23:44 ` David Gibson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).