linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "irqchip-bot for Pali Rohár" <tip-bot2@linutronix.de>
To: linux-kernel@vger.kernel.org
Cc: pali@kernel.org, stable@vger.kernel.org,
	Marc Zyngier <maz@kernel.org>,
	tglx@linutronix.de
Subject: [irqchip: irq/irqchip-fixes] irqchip/armada-370-xp: Fix support for Multi-MSI interrupts
Date: Thu, 25 Nov 2021 17:03:41 -0000	[thread overview]
Message-ID: <163785982132.11128.16644475689186546860.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20211125130057.26705-2-pali@kernel.org>

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);
 }
 

  parent reply	other threads:[~2021-11-25 17:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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-bot for Pali Rohár [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=163785982132.11128.16644475689186546860.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=pali@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).