linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "tip-bot2 for Marc Zyngier" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Jiaxing Luo <luojiaxing@huawei.com>,
	John Garry <john.garry@huawei.com>, Marc Zyngier <maz@kernel.org>,
	Ingo Molnar <mingo@kernel.org>, Borislav Petkov <bp@alien8.de>,
	linux-kernel@vger.kernel.org
Subject: [tip: irq/core] irqchip/gic-v3-its: Fix LPI release for Multi-MSI devices
Date: Fri, 06 Sep 2019 11:08:13 -0000	[thread overview]
Message-ID: <156776809389.24167.18399116865141253707.tip-bot2@tip-bot2> (raw)
In-Reply-To: <f5e948aa-e32f-3f74-ae30-31fee06c2a74@huawei.com>

The following commit has been merged into the irq/core branch of tip:

Commit-ID:     c9c96e30ecaa0aafa225aa1a5392cb7db17c7a82
Gitweb:        https://git.kernel.org/tip/c9c96e30ecaa0aafa225aa1a5392cb7db17c7a82
Author:        Marc Zyngier <maz@kernel.org>
AuthorDate:    Thu, 05 Sep 2019 14:56:47 +01:00
Committer:     Marc Zyngier <maz@kernel.org>
CommitterDate: Thu, 05 Sep 2019 16:03:48 +01:00

irqchip/gic-v3-its: Fix LPI release for Multi-MSI devices

When allocating a range of LPIs for a Multi-MSI capable device,
this allocation extended to the closest power of 2.

But on the release path, the interrupts are released one by
one. This results in not releasing the "extra" range, leaking
the its_device. Trying to reprobe the device will then fail.

Fix it by releasing the LPIs the same way we allocate them.

Fixes: 8208d1708b88 ("irqchip/gic-v3-its: Align PCI Multi-MSI allocation on their size")
Reported-by: Jiaxing Luo <luojiaxing@huawei.com>
Tested-by: John Garry <john.garry@huawei.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/f5e948aa-e32f-3f74-ae30-31fee06c2a74@huawei.com
---
 drivers/irqchip/irq-gic-v3-its.c |  9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 9380aa4..62e54f1 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -2641,14 +2641,13 @@ static void its_irq_domain_free(struct irq_domain *domain, unsigned int virq,
 	struct its_node *its = its_dev->its;
 	int i;
 
+	bitmap_release_region(its_dev->event_map.lpi_map,
+			      its_get_event_id(irq_domain_get_irq_data(domain, virq)),
+			      get_count_order(nr_irqs));
+
 	for (i = 0; i < nr_irqs; i++) {
 		struct irq_data *data = irq_domain_get_irq_data(domain,
 								virq + i);
-		u32 event = its_get_event_id(data);
-
-		/* Mark interrupt index as unused */
-		clear_bit(event, its_dev->event_map.lpi_map);
-
 		/* Nuke the entry in the domain */
 		irq_domain_reset_irq_data(data);
 	}

      parent reply	other threads:[~2019-09-06 11:10 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-03 14:09 PCI/kernel msi code vs GIC ITS driver conflict? John Garry
2019-09-03 16:16 ` Marc Zyngier
2019-09-04  8:56   ` John Garry
2019-09-04 10:25     ` Andrew Murray
2019-09-05  8:38       ` Marc Zyngier
2019-09-05  9:39         ` John Garry
2019-09-05 10:02           ` Marc Zyngier
2019-09-05 10:35             ` John Garry
2019-09-05 11:22               ` Marc Zyngier
2019-09-05 13:26                 ` John Garry
2019-09-05 13:50                   ` Marc Zyngier
2019-09-05 14:23                     ` John Garry
2019-09-05 14:32                       ` Marc Zyngier
2019-09-05 14:53                         ` John Garry
2019-09-05 15:09                           ` Marc Zyngier
2019-09-06 11:08 ` tip-bot2 for Marc Zyngier [this message]

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=156776809389.24167.18399116865141253707.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=bp@alien8.de \
    --cc=john.garry@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=luojiaxing@huawei.com \
    --cc=maz@kernel.org \
    --cc=mingo@kernel.org \
    /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).