Skip to content

Commit

Permalink
hw/psi: Add chip ID to interrupt names
Browse files Browse the repository at this point in the history
Each chip has a separate PSI, but the interrupt names are the same for
both. Add the chip ID to the interrupt name of each to help differentiate
between the two.

Before:
	$ ./count_irqs.py |grep psi:i2c
	27:             13006 - XIVE-IRQ 2097147 Level     opal-psi:i2c
	507:             3447 - XIVE-IRQ 1048571 Level     opal-psi:i2c

After:

	$ ~/count_irqs.py |grep i2c
	27:              4338 - XIVE-IRQ 2097147 Level     opal-psi#8:i2c
	507:            11668 - XIVE-IRQ 1048571 Level     opal-psi#0:i2c

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
  • Loading branch information
oohal committed Sep 6, 2019
1 parent e97391a commit 4017085
Showing 1 changed file with 33 additions and 23 deletions.
56 changes: 33 additions & 23 deletions hw/psi.c
Expand Up @@ -486,19 +486,24 @@ static char *psi_p8_irq_name(struct irq_source *is, uint32_t isn)
{
struct psi *psi = is->data;
uint32_t idx = isn - psi->interrupt;
char tmp[30];

static const char *names[P8_IRQ_PSI_IRQ_COUNT] = {
"psi:fsp",
"psi:occ",
"psi:fsi",
"psi:lpchc",
"psi:local_err",
"psi:external",
"fsp",
"occ",
"fsi",
"lpchc",
"local_err",
"external",
};

if (idx >= P8_IRQ_PSI_IRQ_COUNT)
return NULL;
return strdup(names[idx]);

snprintf(tmp, sizeof(tmp), "psi#%x:%s",
psi->chip_id, names[idx]);

return strdup(tmp);
}

static const struct irq_source_ops psi_p8_irq_ops = {
Expand Down Expand Up @@ -587,27 +592,32 @@ static char *psi_p9_irq_name(struct irq_source *is, uint32_t isn)
{
struct psi *psi = is->data;
uint32_t idx = isn - psi->interrupt;
char tmp[30];

static const char *names[P9_PSI_NUM_IRQS] = {
"psi:fsp",
"psi:occ",
"psi:fsi",
"psi:lpchc",
"psi:local_err",
"psi:global_err",
"psi:external",
"psi:lpc_serirq_mux0", /* Have a callback to get name ? */
"psi:lpc_serirq_mux1", /* Have a callback to get name ? */
"psi:lpc_serirq_mux2", /* Have a callback to get name ? */
"psi:lpc_serirq_mux3", /* Have a callback to get name ? */
"psi:i2c",
"psi:dio",
"psi:psu"
"fsp",
"occ",
"fsi",
"lpchc",
"local_err",
"global_err",
"external",
"lpc_serirq_mux0", /* Have a callback to get name ? */
"lpc_serirq_mux1", /* Have a callback to get name ? */
"lpc_serirq_mux2", /* Have a callback to get name ? */
"lpc_serirq_mux3", /* Have a callback to get name ? */
"i2c",
"dio",
"psu"
};

if (idx >= P9_PSI_NUM_IRQS)
if (idx >= ARRAY_SIZE(names))
return NULL;
return strdup(names[idx]);

snprintf(tmp, sizeof(tmp), "psi#%x:%s",
psi->chip_id, names[idx]);

return strdup(tmp);
}

static const struct irq_source_ops psi_p9_irq_ops = {
Expand Down

0 comments on commit 4017085

Please sign in to comment.