* [PATCH 1/2] irqchip/armada-370-xp: Fix return value of armada_370_xp_msi_alloc()
@ 2021-11-25 13:00 Pali Rohár
2021-11-25 13:00 ` [PATCH 2/2] irqchip/armada-370-xp: Fix support for Multi-MSI interrupts Pali Rohár
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Pali Rohár @ 2021-11-25 13:00 UTC (permalink / raw)
To: Andrew Lunn, Gregory Clement, Sebastian Hesselbarth,
Thomas Gleixner, Marc Zyngier, Marek Behún
Cc: linux-arm-kernel, linux-kernel
IRQ domain alloc function should return zero on success. Non-zero value
indicates failure.
Signed-off-by: Pali Rohár <pali@kernel.org>
Fixes: fcc392d501bd ("irqchip/armada-370-xp: Use the generic MSI infrastructure")
Cc: stable@vger.kernel.org
---
drivers/irqchip/irq-armada-370-xp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 80906bfec845..41ad745cf343 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -250,7 +250,7 @@ static int armada_370_xp_msi_alloc(struct irq_domain *domain, unsigned int virq,
NULL, NULL);
}
- return hwirq;
+ return 0;
}
static void armada_370_xp_msi_free(struct irq_domain *domain,
--
2.20.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] irqchip/armada-370-xp: Fix support for Multi-MSI interrupts
2021-11-25 13:00 [PATCH 1/2] irqchip/armada-370-xp: Fix return value of armada_370_xp_msi_alloc() Pali Rohár
@ 2021-11-25 13:00 ` Pali Rohár
2021-11-25 14:03 ` Marc Zyngier
2021-11-25 17:03 ` [irqchip: irq/irqchip-fixes] " irqchip-bot for Pali Rohár
2021-11-25 14:06 ` [PATCH 1/2] irqchip/armada-370-xp: Fix return value of armada_370_xp_msi_alloc() Marc Zyngier
2021-11-25 17:03 ` [irqchip: irq/irqchip-fixes] " irqchip-bot for Pali Rohár
2 siblings, 2 replies; 6+ messages in thread
From: Pali Rohár @ 2021-11-25 13:00 UTC (permalink / raw)
To: Andrew Lunn, Gregory Clement, Sebastian Hesselbarth,
Thomas Gleixner, Marc Zyngier, Marek Behún
Cc: linux-arm-kernel, linux-kernel
irq-armada-370-xp driver already sets MSI_FLAG_MULTI_PCI_MSI flag into
msi_domain_info structure. But allocated interrupt numbers for Multi-MSI
needs to be properly aligned otherwise devices send MSI interrupt with
wrong number.
Fix this issue by using function bitmap_find_free_region() instead of
bitmap_find_next_zero_area() to allocate aligned interrupt numbers.
Signed-off-by: Pali Rohár <pali@kernel.org>
Fixes: a71b9412c90c ("irqchip/armada-370-xp: Allow allocation of multiple MSIs")
Cc: stable@vger.kernel.org
---
drivers/irqchip/irq-armada-370-xp.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 41ad745cf343..5b8d571c041d 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -232,16 +232,12 @@ static int armada_370_xp_msi_alloc(struct irq_domain *domain, unsigned int virq,
int hwirq, i;
mutex_lock(&msi_used_lock);
+ hwirq = bitmap_find_free_region(msi_used, PCI_MSI_DOORBELL_NR,
+ order_base_2(nr_irqs));
+ mutex_unlock(&msi_used_lock);
- hwirq = bitmap_find_next_zero_area(msi_used, PCI_MSI_DOORBELL_NR,
- 0, nr_irqs, 0);
- if (hwirq >= PCI_MSI_DOORBELL_NR) {
- mutex_unlock(&msi_used_lock);
+ if (hwirq < 0)
return -ENOSPC;
- }
-
- bitmap_set(msi_used, hwirq, nr_irqs);
- mutex_unlock(&msi_used_lock);
for (i = 0; i < nr_irqs; i++) {
irq_domain_set_info(domain, virq + i, hwirq + i,
@@ -259,7 +255,7 @@ static void armada_370_xp_msi_free(struct irq_domain *domain,
struct irq_data *d = irq_domain_get_irq_data(domain, virq);
mutex_lock(&msi_used_lock);
- bitmap_clear(msi_used, d->hwirq, nr_irqs);
+ bitmap_release_region(msi_used, d->hwirq, order_base_2(nr_irqs));
mutex_unlock(&msi_used_lock);
}
--
2.20.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] irqchip/armada-370-xp: Fix support for Multi-MSI interrupts
2021-11-25 13:00 ` [PATCH 2/2] irqchip/armada-370-xp: Fix support for Multi-MSI interrupts Pali Rohár
@ 2021-11-25 14:03 ` Marc Zyngier
2021-11-25 17:03 ` [irqchip: irq/irqchip-fixes] " irqchip-bot for Pali Rohár
1 sibling, 0 replies; 6+ messages in thread
From: Marc Zyngier @ 2021-11-25 14:03 UTC (permalink / raw)
To: Pali Rohár
Cc: Andrew Lunn, Gregory Clement, Sebastian Hesselbarth,
Thomas Gleixner, Marek Behún, linux-arm-kernel,
linux-kernel
On Thu, 25 Nov 2021 13:00:57 +0000,
Pali Rohár <pali@kernel.org> wrote:
>
> irq-armada-370-xp driver already sets MSI_FLAG_MULTI_PCI_MSI flag into
> msi_domain_info structure. But allocated interrupt numbers for Multi-MSI
> needs to be properly aligned otherwise devices send MSI interrupt with
> wrong number.
>
> Fix this issue by using function bitmap_find_free_region() instead of
> bitmap_find_next_zero_area() to allocate aligned interrupt numbers.
>
> Signed-off-by: Pali Rohár <pali@kernel.org>
> Fixes: a71b9412c90c ("irqchip/armada-370-xp: Allow allocation of multiple MSIs")
> Cc: stable@vger.kernel.org
> ---
> drivers/irqchip/irq-armada-370-xp.c | 14 +++++---------
> 1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
> index 41ad745cf343..5b8d571c041d 100644
> --- a/drivers/irqchip/irq-armada-370-xp.c
> +++ b/drivers/irqchip/irq-armada-370-xp.c
> @@ -232,16 +232,12 @@ static int armada_370_xp_msi_alloc(struct irq_domain *domain, unsigned int virq,
> int hwirq, i;
>
> mutex_lock(&msi_used_lock);
> + hwirq = bitmap_find_free_region(msi_used, PCI_MSI_DOORBELL_NR,
> + order_base_2(nr_irqs));
> + mutex_unlock(&msi_used_lock);
>
> - hwirq = bitmap_find_next_zero_area(msi_used, PCI_MSI_DOORBELL_NR,
> - 0, nr_irqs, 0);
> - if (hwirq >= PCI_MSI_DOORBELL_NR) {
> - mutex_unlock(&msi_used_lock);
> + if (hwirq < 0)
> return -ENOSPC;
> - }
> -
> - bitmap_set(msi_used, hwirq, nr_irqs);
> - mutex_unlock(&msi_used_lock);
>
> for (i = 0; i < nr_irqs; i++) {
> irq_domain_set_info(domain, virq + i, hwirq + i,
> @@ -259,7 +255,7 @@ static void armada_370_xp_msi_free(struct irq_domain *domain,
> struct irq_data *d = irq_domain_get_irq_data(domain, virq);
>
> mutex_lock(&msi_used_lock);
> - bitmap_clear(msi_used, d->hwirq, nr_irqs);
> + bitmap_release_region(msi_used, d->hwirq, order_base_2(nr_irqs));
> mutex_unlock(&msi_used_lock);
> }
>
> --
> 2.20.1
>
>
Acked-by: Marc Zyngier <maz@kernel.org>
M.
--
Without deviation from the norm, progress is not possible.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] irqchip/armada-370-xp: Fix return value of armada_370_xp_msi_alloc()
2021-11-25 13:00 [PATCH 1/2] irqchip/armada-370-xp: Fix return value of armada_370_xp_msi_alloc() Pali Rohár
2021-11-25 13:00 ` [PATCH 2/2] irqchip/armada-370-xp: Fix support for Multi-MSI interrupts Pali Rohár
@ 2021-11-25 14:06 ` Marc Zyngier
2021-11-25 17:03 ` [irqchip: irq/irqchip-fixes] " irqchip-bot for Pali Rohár
2 siblings, 0 replies; 6+ messages in thread
From: Marc Zyngier @ 2021-11-25 14:06 UTC (permalink / raw)
To: Pali Rohár
Cc: Andrew Lunn, Gregory Clement, Sebastian Hesselbarth,
Thomas Gleixner, Marek Behún, linux-arm-kernel,
linux-kernel
On Thu, 25 Nov 2021 13:00:56 +0000,
Pali Rohár <pali@kernel.org> wrote:
>
> IRQ domain alloc function should return zero on success. Non-zero value
> indicates failure.
>
> Signed-off-by: Pali Rohár <pali@kernel.org>
> Fixes: fcc392d501bd ("irqchip/armada-370-xp: Use the generic MSI infrastructure")
> Cc: stable@vger.kernel.org
> ---
> drivers/irqchip/irq-armada-370-xp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
> index 80906bfec845..41ad745cf343 100644
> --- a/drivers/irqchip/irq-armada-370-xp.c
> +++ b/drivers/irqchip/irq-armada-370-xp.c
> @@ -250,7 +250,7 @@ static int armada_370_xp_msi_alloc(struct irq_domain *domain, unsigned int virq,
> NULL, NULL);
> }
>
> - return hwirq;
> + return 0;
> }
>
> static void armada_370_xp_msi_free(struct irq_domain *domain,
> --
> 2.20.1
>
>
Looks good too. As this lives in the irqchip tree, I'll queue these
two patches directly unless someone shouts...
M.
--
Without deviation from the norm, progress is not possible.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [irqchip: irq/irqchip-fixes] irqchip/armada-370-xp: Fix support for Multi-MSI interrupts
2021-11-25 13:00 ` [PATCH 2/2] irqchip/armada-370-xp: Fix support for Multi-MSI interrupts Pali Rohár
2021-11-25 14:03 ` Marc Zyngier
@ 2021-11-25 17:03 ` irqchip-bot for Pali Rohár
1 sibling, 0 replies; 6+ messages in thread
From: irqchip-bot for Pali Rohár @ 2021-11-25 17:03 UTC (permalink / raw)
To: linux-kernel; +Cc: pali, stable, Marc Zyngier, tglx
The following commit has been merged into the irq/irqchip-fixes branch of irqchip:
Commit-ID: d0a553502efd545c1ce3fd08fc4d423f8e4ac3d6
Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/d0a553502efd545c1ce3fd08fc4d423f8e4ac3d6
Author: Pali Rohár <pali@kernel.org>
AuthorDate: Thu, 25 Nov 2021 14:00:57 +01:00
Committer: Marc Zyngier <maz@kernel.org>
CommitterDate: Thu, 25 Nov 2021 16:49:50
irqchip/armada-370-xp: Fix support for Multi-MSI interrupts
irq-armada-370-xp driver already sets MSI_FLAG_MULTI_PCI_MSI flag into
msi_domain_info structure. But allocated interrupt numbers for Multi-MSI
needs to be properly aligned otherwise devices send MSI interrupt with
wrong number.
Fix this issue by using function bitmap_find_free_region() instead of
bitmap_find_next_zero_area() to allocate aligned interrupt numbers.
Signed-off-by: Pali Rohár <pali@kernel.org>
Fixes: a71b9412c90c ("irqchip/armada-370-xp: Allow allocation of multiple MSIs")
Cc: stable@vger.kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20211125130057.26705-2-pali@kernel.org
---
drivers/irqchip/irq-armada-370-xp.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 41ad745..5b8d571 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -232,16 +232,12 @@ static int armada_370_xp_msi_alloc(struct irq_domain *domain, unsigned int virq,
int hwirq, i;
mutex_lock(&msi_used_lock);
+ hwirq = bitmap_find_free_region(msi_used, PCI_MSI_DOORBELL_NR,
+ order_base_2(nr_irqs));
+ mutex_unlock(&msi_used_lock);
- hwirq = bitmap_find_next_zero_area(msi_used, PCI_MSI_DOORBELL_NR,
- 0, nr_irqs, 0);
- if (hwirq >= PCI_MSI_DOORBELL_NR) {
- mutex_unlock(&msi_used_lock);
+ if (hwirq < 0)
return -ENOSPC;
- }
-
- bitmap_set(msi_used, hwirq, nr_irqs);
- mutex_unlock(&msi_used_lock);
for (i = 0; i < nr_irqs; i++) {
irq_domain_set_info(domain, virq + i, hwirq + i,
@@ -259,7 +255,7 @@ static void armada_370_xp_msi_free(struct irq_domain *domain,
struct irq_data *d = irq_domain_get_irq_data(domain, virq);
mutex_lock(&msi_used_lock);
- bitmap_clear(msi_used, d->hwirq, nr_irqs);
+ bitmap_release_region(msi_used, d->hwirq, order_base_2(nr_irqs));
mutex_unlock(&msi_used_lock);
}
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [irqchip: irq/irqchip-fixes] irqchip/armada-370-xp: Fix return value of armada_370_xp_msi_alloc()
2021-11-25 13:00 [PATCH 1/2] irqchip/armada-370-xp: Fix return value of armada_370_xp_msi_alloc() Pali Rohár
2021-11-25 13:00 ` [PATCH 2/2] irqchip/armada-370-xp: Fix support for Multi-MSI interrupts Pali Rohár
2021-11-25 14:06 ` [PATCH 1/2] irqchip/armada-370-xp: Fix return value of armada_370_xp_msi_alloc() Marc Zyngier
@ 2021-11-25 17:03 ` irqchip-bot for Pali Rohár
2 siblings, 0 replies; 6+ messages in thread
From: irqchip-bot for Pali Rohár @ 2021-11-25 17:03 UTC (permalink / raw)
To: linux-kernel; +Cc: pali, stable, Marc Zyngier, tglx
The following commit has been merged into the irq/irqchip-fixes branch of irqchip:
Commit-ID: ce20eff57361e72878a772ef08b5239d3ae102b6
Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/ce20eff57361e72878a772ef08b5239d3ae102b6
Author: Pali Rohár <pali@kernel.org>
AuthorDate: Thu, 25 Nov 2021 14:00:56 +01:00
Committer: Marc Zyngier <maz@kernel.org>
CommitterDate: Thu, 25 Nov 2021 16:49:38
irqchip/armada-370-xp: Fix return value of armada_370_xp_msi_alloc()
IRQ domain alloc function should return zero on success. Non-zero value
indicates failure.
Signed-off-by: Pali Rohár <pali@kernel.org>
Fixes: fcc392d501bd ("irqchip/armada-370-xp: Use the generic MSI infrastructure")
Cc: stable@vger.kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20211125130057.26705-1-pali@kernel.org
---
drivers/irqchip/irq-armada-370-xp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 80906bf..41ad745 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -250,7 +250,7 @@ static int armada_370_xp_msi_alloc(struct irq_domain *domain, unsigned int virq,
NULL, NULL);
}
- return hwirq;
+ return 0;
}
static void armada_370_xp_msi_free(struct irq_domain *domain,
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-11-25 17:19 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-25 13:00 [PATCH 1/2] irqchip/armada-370-xp: Fix return value of armada_370_xp_msi_alloc() Pali Rohár
2021-11-25 13:00 ` [PATCH 2/2] irqchip/armada-370-xp: Fix support for Multi-MSI interrupts Pali Rohár
2021-11-25 14:03 ` Marc Zyngier
2021-11-25 17:03 ` [irqchip: irq/irqchip-fixes] " irqchip-bot for Pali Rohár
2021-11-25 14:06 ` [PATCH 1/2] irqchip/armada-370-xp: Fix return value of armada_370_xp_msi_alloc() Marc Zyngier
2021-11-25 17:03 ` [irqchip: irq/irqchip-fixes] " irqchip-bot for Pali Rohár
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).