[Skiboot] [PATCH v3 1/4] hw/psi: Add chip ID to interrupt names

Cédric Le Goater clg at kaod.org
Thu Sep 5 22:30:18 AEST 2019


On 05/09/2019 12:50, Oliver O'Halloran wrote:
> 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 at gmail.com>

The format looks OK. I don't know if there are other examples of literal
names with the chip id.



Reviewed-by: Cédric Le Goater <clg at kaod.org>

Thanks,

C.

> ---
>  hw/psi.c | 56 +++++++++++++++++++++++++++++++++-----------------------
>  1 file changed, 33 insertions(+), 23 deletions(-)
> 
> diff --git a/hw/psi.c b/hw/psi.c
> index a74c105ff0ec..a54b503ce463 100644
> --- a/hw/psi.c
> +++ b/hw/psi.c
> @@ -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 = {
> @@ -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 = {
> 



More information about the Skiboot mailing list