[PATCH] powerpc/pseries: Correct MSI allocation tracking

Nam Cao posted 1 patch 1 month, 2 weeks ago
arch/powerpc/platforms/pseries/msi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] powerpc/pseries: Correct MSI allocation tracking
Posted by Nam Cao 1 month, 2 weeks ago
The per-device MSI allocation calculation in pseries_irq_domain_alloc()
is clearly wrong. It can still happen to work when nr_irqs is 1.

Correct it.

Fixes: c0215e2d72de ("powerpc/pseries: Fix MSI-X allocation failure when quota is exceeded")
Cc: stable@vger.kernel.org
Signed-off-by: Nam Cao <namcao@linutronix.de>
---
 arch/powerpc/platforms/pseries/msi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c
index 64ffc6476ad6..8285b9a29fbf 100644
--- a/arch/powerpc/platforms/pseries/msi.c
+++ b/arch/powerpc/platforms/pseries/msi.c
@@ -605,7 +605,7 @@ static int pseries_irq_domain_alloc(struct irq_domain *domain, unsigned int virq
 					      &pseries_msi_irq_chip, pseries_dev);
 	}
 
-	pseries_dev->msi_used++;
+	pseries_dev->msi_used += nr_irqs;
 	return 0;
 
 out:
-- 
2.47.3
Re: [PATCH] powerpc/pseries: Correct MSI allocation tracking
Posted by Madhavan Srinivasan 1 month ago
On Mon, 02 Mar 2026 01:39:48 +0100, Nam Cao wrote:
> The per-device MSI allocation calculation in pseries_irq_domain_alloc()
> is clearly wrong. It can still happen to work when nr_irqs is 1.
> 
> Correct it.
> 
> 

Applied to powerpc/fixes.

[1/1] powerpc/pseries: Correct MSI allocation tracking
      https://git.kernel.org/powerpc/c/35e4f2a17eb40288f9bcdb09549fa04a63a96279

cheers
Re: [PATCH] powerpc/pseries: Correct MSI allocation tracking
Posted by Mahesh J Salgaonkar 1 month, 1 week ago
On 2026-03-02 01:39:48 Mon, Nam Cao wrote:
> The per-device MSI allocation calculation in pseries_irq_domain_alloc()
> is clearly wrong. It can still happen to work when nr_irqs is 1.
> 
> Correct it.
> 
> Fixes: c0215e2d72de ("powerpc/pseries: Fix MSI-X allocation failure when quota is exceeded")
> Cc: stable@vger.kernel.org
> Signed-off-by: Nam Cao <namcao@linutronix.de>
> ---
>  arch/powerpc/platforms/pseries/msi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c
> index 64ffc6476ad6..8285b9a29fbf 100644
> --- a/arch/powerpc/platforms/pseries/msi.c
> +++ b/arch/powerpc/platforms/pseries/msi.c
> @@ -605,7 +605,7 @@ static int pseries_irq_domain_alloc(struct irq_domain *domain, unsigned int virq
>  					      &pseries_msi_irq_chip, pseries_dev);
>  	}
>  
> -	pseries_dev->msi_used++;
> +	pseries_dev->msi_used += nr_irqs;

Yeah, msi_used was wronlgy incremented only once while allocating
nr_irqs interrupts from parent domain. Looks good to me.

Reviewed-by: Mahesh Salgaonkar <mahesh@linux.ibm.com>

Thanks,
-Mahesh.

>  	return 0;
>  
>  out:
> -- 
> 2.47.3
> 

-- 
Mahesh J Salgaonkar
Re: [PATCH] powerpc/pseries: Correct MSI allocation tracking
Posted by Nilay Shroff 1 month, 1 week ago
On 3/2/26 6:09 AM, Nam Cao wrote:
> The per-device MSI allocation calculation in pseries_irq_domain_alloc()
> is clearly wrong. It can still happen to work when nr_irqs is 1.
> 
> Correct it.
> 
> Fixes: c0215e2d72de ("powerpc/pseries: Fix MSI-X allocation failure when quota is exceeded")
> Cc: stable@vger.kernel.org
> Signed-off-by: Nam Cao <namcao@linutronix.de>
> ---
>   arch/powerpc/platforms/pseries/msi.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c
> index 64ffc6476ad6..8285b9a29fbf 100644
> --- a/arch/powerpc/platforms/pseries/msi.c
> +++ b/arch/powerpc/platforms/pseries/msi.c
> @@ -605,7 +605,7 @@ static int pseries_irq_domain_alloc(struct irq_domain *domain, unsigned int virq
>   					      &pseries_msi_irq_chip, pseries_dev);
>   	}
>   
> -	pseries_dev->msi_used++;
> +	pseries_dev->msi_used += nr_irqs;
>   	return 0;
>   
>   out:

Looks good to me:
Reviewed-by : Nilay Shroff <nilay@linux.ibm.com>