Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/xive: Add a debug_show handler to the XIVE irq_domain

Full state of the Linux interrupt descriptors can be dumped under
debugfs when compiled with CONFIG_GENERIC_IRQ_DEBUGFS. Add support for
the XIVE interrupt controller.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20201210171450.1933725-7-clg@kaod.org

authored by

Cédric Le Goater and committed by
Michael Ellerman
a5021abc 9dfe4b14

+58
+58
arch/powerpc/sysdev/xive/common.c
··· 1303 1303 return xive_ops->match(node); 1304 1304 } 1305 1305 1306 + #ifdef CONFIG_GENERIC_IRQ_DEBUGFS 1307 + static const char * const esb_names[] = { "RESET", "OFF", "PENDING", "QUEUED" }; 1308 + 1309 + static const struct { 1310 + u64 mask; 1311 + char *name; 1312 + } xive_irq_flags[] = { 1313 + { XIVE_IRQ_FLAG_STORE_EOI, "STORE_EOI" }, 1314 + { XIVE_IRQ_FLAG_LSI, "LSI" }, 1315 + { XIVE_IRQ_FLAG_SHIFT_BUG, "SHIFT_BUG" }, 1316 + { XIVE_IRQ_FLAG_MASK_FW, "MASK_FW" }, 1317 + { XIVE_IRQ_FLAG_EOI_FW, "EOI_FW" }, 1318 + { XIVE_IRQ_FLAG_H_INT_ESB, "H_INT_ESB" }, 1319 + { XIVE_IRQ_FLAG_NO_EOI, "NO_EOI" }, 1320 + }; 1321 + 1322 + static void xive_irq_domain_debug_show(struct seq_file *m, struct irq_domain *d, 1323 + struct irq_data *irqd, int ind) 1324 + { 1325 + struct xive_irq_data *xd; 1326 + u64 val; 1327 + int i; 1328 + 1329 + /* No IRQ domain level information. To be done */ 1330 + if (!irqd) 1331 + return; 1332 + 1333 + if (!is_xive_irq(irq_data_get_irq_chip(irqd))) 1334 + return; 1335 + 1336 + seq_printf(m, "%*sXIVE:\n", ind, ""); 1337 + ind++; 1338 + 1339 + xd = irq_data_get_irq_handler_data(irqd); 1340 + if (!xd) { 1341 + seq_printf(m, "%*snot assigned\n", ind, ""); 1342 + return; 1343 + } 1344 + 1345 + val = xive_esb_read(xd, XIVE_ESB_GET); 1346 + seq_printf(m, "%*sESB: %s\n", ind, "", esb_names[val & 0x3]); 1347 + seq_printf(m, "%*sPstate: %s %s\n", ind, "", xd->stale_p ? "stale" : "", 1348 + xd->saved_p ? "saved" : ""); 1349 + seq_printf(m, "%*sTarget: %d\n", ind, "", xd->target); 1350 + seq_printf(m, "%*sChip: %d\n", ind, "", xd->src_chip); 1351 + seq_printf(m, "%*sTrigger: 0x%016llx\n", ind, "", xd->trig_page); 1352 + seq_printf(m, "%*sEOI: 0x%016llx\n", ind, "", xd->eoi_page); 1353 + seq_printf(m, "%*sFlags: 0x%llx\n", ind, "", xd->flags); 1354 + for (i = 0; i < ARRAY_SIZE(xive_irq_flags); i++) { 1355 + if (xd->flags & xive_irq_flags[i].mask) 1356 + seq_printf(m, "%*s%s\n", ind + 12, "", xive_irq_flags[i].name); 1357 + } 1358 + } 1359 + #endif 1360 + 1306 1361 static const struct irq_domain_ops xive_irq_domain_ops = { 1307 1362 .match = xive_irq_domain_match, 1308 1363 .map = xive_irq_domain_map, 1309 1364 .unmap = xive_irq_domain_unmap, 1310 1365 .xlate = xive_irq_domain_xlate, 1366 + #ifdef CONFIG_GENERIC_IRQ_DEBUGFS 1367 + .debug_show = xive_irq_domain_debug_show, 1368 + #endif 1311 1369 }; 1312 1370 1313 1371 static void __init xive_init_host(struct device_node *np)