Skip to content

Commit

Permalink
powerpc/xive: Simplify the dump of XIVE interrupts under xmon
Browse files Browse the repository at this point in the history
Move the xmon routine under XIVE subsystem and rework the loop on the
interrupts taking into account the xive_irq_domain to filter out IPIs.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Greg Kurz <groug@kaod.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210331144514.892250-7-clg@kaod.org
  • Loading branch information
Cédric Le Goater authored and Michael Ellerman committed Apr 14, 2021
1 parent a74ce59 commit 6bf66eb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 26 deletions.
1 change: 1 addition & 0 deletions arch/powerpc/include/asm/xive.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ void xive_flush_interrupt(void);
/* xmon hook */
void xmon_xive_do_dump(int cpu);
int xmon_xive_get_irq_config(u32 hw_irq, struct irq_data *d);
void xmon_xive_get_irq_all(void);

/* APIs used by KVM */
u32 xive_native_default_eq_shift(void);
Expand Down
14 changes: 14 additions & 0 deletions arch/powerpc/sysdev/xive/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,20 @@ int xmon_xive_get_irq_config(u32 hw_irq, struct irq_data *d)
return 0;
}

void xmon_xive_get_irq_all(void)
{
unsigned int i;
struct irq_desc *desc;

for_each_irq_desc(i, desc) {
struct irq_data *d = irq_desc_get_irq_data(desc);
unsigned int hwirq = (unsigned int)irqd_to_hwirq(d);

if (d->domain == xive_irq_domain)
xmon_xive_get_irq_config(hwirq, d);
}
}

#endif /* CONFIG_XMON */

static unsigned int xive_get_irq(void)
Expand Down
28 changes: 2 additions & 26 deletions arch/powerpc/xmon/xmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -2727,30 +2727,6 @@ static void dump_all_xives(void)
dump_one_xive(cpu);
}

static void dump_one_xive_irq(u32 num, struct irq_data *d)
{
xmon_xive_get_irq_config(num, d);
}

static void dump_all_xive_irq(void)
{
unsigned int i;
struct irq_desc *desc;

for_each_irq_desc(i, desc) {
struct irq_data *d = irq_desc_get_irq_data(desc);
unsigned int hwirq;

if (!d)
continue;

hwirq = (unsigned int)irqd_to_hwirq(d);
/* IPIs are special (HW number 0) */
if (hwirq)
dump_one_xive_irq(hwirq, d);
}
}

static void dump_xives(void)
{
unsigned long num;
Expand All @@ -2767,9 +2743,9 @@ static void dump_xives(void)
return;
} else if (c == 'i') {
if (scanhex(&num))
dump_one_xive_irq(num, NULL);
xmon_xive_get_irq_config(num, NULL);
else
dump_all_xive_irq();
xmon_xive_get_irq_all();
return;
}

Expand Down

0 comments on commit 6bf66eb

Please sign in to comment.