Skip to content

Commit 33e4bc5

Browse files
legoatermpe
authored andcommitted
powerpc/xive: Fix xmon command "dxi"
When under xmon, the "dxi" command dumps the state of the XIVE interrupts. If an interrupt number is specified, only the state of the associated XIVE interrupt is dumped. This form of the command lacks an irq_data parameter which is nevertheless used by xmon_xive_get_irq_config(), leading to an xmon crash. Fix that by doing a lookup in the system IRQ mapping to query the IRQ descriptor data. Invalid interrupt numbers, or not belonging to the XIVE IRQ domain, OPAL event interrupt number for instance, should be caught by the previous query done at the firmware level. Fixes: 97ef275 ("powerpc/xive: Fix xmon support on the PowerNV platform") Reported-by: kernel test robot <[email protected]> Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Cédric Le Goater <[email protected]> Tested-by: Greg Kurz <[email protected]> Reviewed-by: Greg Kurz <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 6bf66eb commit 33e4bc5

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

arch/powerpc/sysdev/xive/common.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,17 +253,20 @@ notrace void xmon_xive_do_dump(int cpu)
253253
xmon_printf("\n");
254254
}
255255

256+
static struct irq_data *xive_get_irq_data(u32 hw_irq)
257+
{
258+
unsigned int irq = irq_find_mapping(xive_irq_domain, hw_irq);
259+
260+
return irq ? irq_get_irq_data(irq) : NULL;
261+
}
262+
256263
int xmon_xive_get_irq_config(u32 hw_irq, struct irq_data *d)
257264
{
258-
struct irq_chip *chip = irq_data_get_irq_chip(d);
259265
int rc;
260266
u32 target;
261267
u8 prio;
262268
u32 lirq;
263269

264-
if (!is_xive_irq(chip))
265-
return -EINVAL;
266-
267270
rc = xive_ops->get_irq_config(hw_irq, &target, &prio, &lirq);
268271
if (rc) {
269272
xmon_printf("IRQ 0x%08x : no config rc=%d\n", hw_irq, rc);
@@ -273,6 +276,9 @@ int xmon_xive_get_irq_config(u32 hw_irq, struct irq_data *d)
273276
xmon_printf("IRQ 0x%08x : target=0x%x prio=%02x lirq=0x%x ",
274277
hw_irq, target, prio, lirq);
275278

279+
if (!d)
280+
d = xive_get_irq_data(hw_irq);
281+
276282
if (d) {
277283
struct xive_irq_data *xd = irq_data_get_irq_handler_data(d);
278284
u64 val = xive_esb_read(xd, XIVE_ESB_GET);

0 commit comments

Comments
 (0)