LinuxPPC-Dev Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 0/2] powerpc/xmon: Improve output of XIVE commands
@ 2019-09-10  8:18 Cédric Le Goater
  2019-09-10  8:18 ` [PATCH 1/2] powerpc/xmon: Improve output of XIVE interrupts Cédric Le Goater
  2019-09-10  8:18 ` [PATCH 2/2] powerpc/xmon: Fix output of XIVE IPI Cédric Le Goater
  0 siblings, 2 replies; 4+ messages in thread
From: Cédric Le Goater @ 2019-09-10  8:18 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, Cédric Le Goater

Hello,

This series extend the interrupt command output with the PQ bit value
and reworks the CPU command output to check that a CPU is started.

Thanks,

C.

Cédric Le Goater (2):
  powerpc/xmon: Improve output of XIVE interrupts
  powerpc/xmon: Fix output of XIVE IPI

 arch/powerpc/include/asm/xive.h   |  3 +-
 arch/powerpc/sysdev/xive/common.c | 56 +++++++++++++++++++++++--------
 arch/powerpc/xmon/xmon.c          | 15 +++------
 3 files changed, 47 insertions(+), 27 deletions(-)

-- 
2.21.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] powerpc/xmon: Improve output of XIVE interrupts
  2019-09-10  8:18 [PATCH 0/2] powerpc/xmon: Improve output of XIVE commands Cédric Le Goater
@ 2019-09-10  8:18 ` Cédric Le Goater
  2019-09-19 10:25   ` Michael Ellerman
  2019-09-10  8:18 ` [PATCH 2/2] powerpc/xmon: Fix output of XIVE IPI Cédric Le Goater
  1 sibling, 1 reply; 4+ messages in thread
From: Cédric Le Goater @ 2019-09-10  8:18 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, Cédric Le Goater

When looping on the list of interrupts, add the current value of the
PQ bits with a load on the ESB page. This has the side effect of
faulting the ESB page of all interrupts.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 arch/powerpc/include/asm/xive.h   |  3 +--
 arch/powerpc/sysdev/xive/common.c | 29 ++++++++++++++++++++++++++---
 arch/powerpc/xmon/xmon.c          | 15 ++++-----------
 3 files changed, 31 insertions(+), 16 deletions(-)

diff --git a/arch/powerpc/include/asm/xive.h b/arch/powerpc/include/asm/xive.h
index 967d6ab3c977..71f52f22c36b 100644
--- a/arch/powerpc/include/asm/xive.h
+++ b/arch/powerpc/include/asm/xive.h
@@ -99,8 +99,7 @@ extern void xive_flush_interrupt(void);
 
 /* xmon hook */
 extern void xmon_xive_do_dump(int cpu);
-extern int xmon_xive_get_irq_config(u32 irq, u32 *target, u8 *prio,
-				    u32 *sw_irq);
+extern int xmon_xive_get_irq_config(u32 hw_irq, struct irq_data *d);
 
 /* APIs used by KVM */
 extern u32 xive_native_default_eq_shift(void);
diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c
index ed4561e71951..85a27ec49d34 100644
--- a/arch/powerpc/sysdev/xive/common.c
+++ b/arch/powerpc/sysdev/xive/common.c
@@ -258,10 +258,33 @@ notrace void xmon_xive_do_dump(int cpu)
 #endif
 }
 
-int xmon_xive_get_irq_config(u32 irq, u32 *target, u8 *prio,
-			     u32 *sw_irq)
+int xmon_xive_get_irq_config(u32 hw_irq, struct irq_data *d)
 {
-	return xive_ops->get_irq_config(irq, target, prio, sw_irq);
+	int rc;
+	u32 target;
+	u8 prio;
+	u32 lirq;
+
+	rc = xive_ops->get_irq_config(hw_irq, &target, &prio, &lirq);
+	if (rc) {
+		xmon_printf("IRQ 0x%08x : no config rc=%d\n", hw_irq, rc);
+		return rc;
+	}
+
+	xmon_printf("IRQ 0x%08x : target=0x%x prio=%02x lirq=0x%x ",
+		    hw_irq, target, prio, lirq);
+
+	if (d) {
+		struct xive_irq_data *xd = irq_data_get_irq_handler_data(d);
+		u64 val = xive_esb_read(xd, XIVE_ESB_GET);
+
+		xmon_printf("PQ=%c%c",
+			    val & XIVE_ESB_VAL_P ? 'P' : '-',
+			    val & XIVE_ESB_VAL_Q ? 'Q' : '-');
+	}
+
+	xmon_printf("\n");
+	return 0;
 }
 
 #endif /* CONFIG_XMON */
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index dc9832e06256..d83364ebc5c5 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -2572,16 +2572,9 @@ static void dump_all_xives(void)
 		dump_one_xive(cpu);
 }
 
-static void dump_one_xive_irq(u32 num)
+static void dump_one_xive_irq(u32 num, struct irq_data *d)
 {
-	int rc;
-	u32 target;
-	u8 prio;
-	u32 lirq;
-
-	rc = xmon_xive_get_irq_config(num, &target, &prio, &lirq);
-	xmon_printf("IRQ 0x%08x : target=0x%x prio=%d lirq=0x%x (rc=%d)\n",
-		    num, target, prio, lirq, rc);
+	xmon_xive_get_irq_config(num, d);
 }
 
 static void dump_all_xive_irq(void)
@@ -2599,7 +2592,7 @@ static void dump_all_xive_irq(void)
 		hwirq = (unsigned int)irqd_to_hwirq(d);
 		/* IPIs are special (HW number 0) */
 		if (hwirq)
-			dump_one_xive_irq(hwirq);
+			dump_one_xive_irq(hwirq, d);
 	}
 }
 
@@ -2619,7 +2612,7 @@ static void dump_xives(void)
 		return;
 	} else if (c == 'i') {
 		if (scanhex(&num))
-			dump_one_xive_irq(num);
+			dump_one_xive_irq(num, NULL);
 		else
 			dump_all_xive_irq();
 		return;
-- 
2.21.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] powerpc/xmon: Fix output of XIVE IPI
  2019-09-10  8:18 [PATCH 0/2] powerpc/xmon: Improve output of XIVE commands Cédric Le Goater
  2019-09-10  8:18 ` [PATCH 1/2] powerpc/xmon: Improve output of XIVE interrupts Cédric Le Goater
@ 2019-09-10  8:18 ` Cédric Le Goater
  1 sibling, 0 replies; 4+ messages in thread
From: Cédric Le Goater @ 2019-09-10  8:18 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, Cédric Le Goater

When dumping the XIVE state of an CPU IPI, xmon does not check if the
CPU is started or not which can cause an error. Add a check for that
and change the output to be on one line just as the XIVE interrupts of
the machine.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 arch/powerpc/sysdev/xive/common.c | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c
index 85a27ec49d34..20f45b8a52ab 100644
--- a/arch/powerpc/sysdev/xive/common.c
+++ b/arch/powerpc/sysdev/xive/common.c
@@ -237,25 +237,30 @@ static notrace void xive_dump_eq(const char *name, struct xive_q *q)
 	i0 = be32_to_cpup(q->qpage + idx);
 	idx = (idx + 1) & q->msk;
 	i1 = be32_to_cpup(q->qpage + idx);
-	xmon_printf("  %s Q T=%d %08x %08x ...\n", name,
-		    q->toggle, i0, i1);
+	xmon_printf("%s idx=%d T=%d %08x %08x ...", name,
+		     q->idx, q->toggle, i0, i1);
 }
 
 notrace void xmon_xive_do_dump(int cpu)
 {
 	struct xive_cpu *xc = per_cpu(xive_cpu, cpu);
 
-	xmon_printf("XIVE state for CPU %d:\n", cpu);
-	xmon_printf("  pp=%02x cppr=%02x\n", xc->pending_prio, xc->cppr);
-	xive_dump_eq("IRQ", &xc->queue[xive_irq_priority]);
+	xmon_printf("CPU %d:", cpu);
+	if (xc) {
+		xmon_printf("pp=%02x CPPR=%02x ", xc->pending_prio, xc->cppr);
+
 #ifdef CONFIG_SMP
-	{
-		u64 val = xive_esb_read(&xc->ipi_data, XIVE_ESB_GET);
-		xmon_printf("  IPI state: %x:%c%c\n", xc->hw_ipi,
-			val & XIVE_ESB_VAL_P ? 'P' : 'p',
-			val & XIVE_ESB_VAL_Q ? 'Q' : 'q');
-	}
+		{
+			u64 val = xive_esb_read(&xc->ipi_data, XIVE_ESB_GET);
+
+			xmon_printf("IPI=0x%08x PQ=%c%c ", xc->hw_ipi,
+				    val & XIVE_ESB_VAL_P ? 'P' : '-',
+				    val & XIVE_ESB_VAL_Q ? 'Q' : '-');
+		}
 #endif
+		xive_dump_eq("EQ", &xc->queue[xive_irq_priority]);
+	}
+	xmon_printf("\n");
 }
 
 int xmon_xive_get_irq_config(u32 hw_irq, struct irq_data *d)
-- 
2.21.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] powerpc/xmon: Improve output of XIVE interrupts
  2019-09-10  8:18 ` [PATCH 1/2] powerpc/xmon: Improve output of XIVE interrupts Cédric Le Goater
@ 2019-09-19 10:25   ` Michael Ellerman
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2019-09-19 10:25 UTC (permalink / raw)
  To: Cédric Le Goater; +Cc: linuxppc-dev, Cédric Le Goater

[-- Warning: decoded text below may be mangled --]
[-- Attachment #0: Type: text/plain, Size: 439 bytes --]

On Tue, 2019-09-10 at 08:18:49 UTC, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= wrote:
> When looping on the list of interrupts, add the current value of the
> PQ bits with a load on the ESB page. This has the side effect of
> faulting the ESB page of all interrupts.
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>

Series applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/5896163f7f91c0560cc41908c808661eee4c4121

cheers

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-10  8:18 [PATCH 0/2] powerpc/xmon: Improve output of XIVE commands Cédric Le Goater
2019-09-10  8:18 ` [PATCH 1/2] powerpc/xmon: Improve output of XIVE interrupts Cédric Le Goater
2019-09-19 10:25   ` Michael Ellerman
2019-09-10  8:18 ` [PATCH 2/2] powerpc/xmon: Fix output of XIVE IPI Cédric Le Goater

LinuxPPC-Dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linuxppc-dev/0 linuxppc-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linuxppc-dev linuxppc-dev/ https://lore.kernel.org/linuxppc-dev \
		linuxppc-dev@lists.ozlabs.org linuxppc-dev@ozlabs.org linuxppc-dev@archiver.kernel.org
	public-inbox-index linuxppc-dev


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.ozlabs.lists.linuxppc-dev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox