From: Liao Chang <liaochang1@huawei.com>
To: <tglx@linutronix.de>, <maz@kernel.org>, <samuel@sholland.org>,
<brgl@bgdev.pl>, <andy.shevchenko@gmail.com>,
<mikelley@microsoft.com>, <lvjianmin@loongson.cn>,
<mark.rutland@arm.com>
Cc: <linux-kernel@vger.kernel.org>, <liaochang1@huawei.com>
Subject: [PATCH 2/2] irqchip/gic-v3-its: Release the allocated but unmapped bits in LPI maps
Date: Thu, 25 Aug 2022 14:08:19 +0800 [thread overview]
Message-ID: <20220825060819.74303-2-liaochang1@huawei.com> (raw)
In-Reply-To: <20220825060819.74303-1-liaochang1@huawei.com>
If one hwirq allocated in ITS domain followed by some unmapped bits, the
number of unmapped bits will be recorded, so that this hwirq and
following unmapped bits could be released both.
Reported-by: John Garry <john.garry@huawei.com>
Signed-off-by: Liao Chang <liaochang1@huawei.com>
Link: https://lore.kernel.org/lkml/3d3d0155e66429968cb4f6b4feeae4b3@kernel.org/
---
drivers/irqchip/irq-gic-v3-its.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 5ff09de6c48f..36a1bc88e832 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -3572,11 +3572,19 @@ static int its_irq_domain_alloc(struct irq_domain *domain, unsigned int virq,
irqd = irq_get_irq_data(virq + i);
irqd_set_single_target(irqd);
irqd_set_affinity_on_activate(irqd);
+ irqd_set_dangling(irqd, 0);
pr_debug("ID:%d pID:%d vID:%d\n",
(int)(hwirq + i - its_dev->event_map.lpi_base),
(int)(hwirq + i), virq + i);
}
+ /*
+ * In order to free dangling hwirq bits, kernel uses the irq_data
+ * of hwirq which is followed by dangling bits to record dangling
+ * number.
+ */
+ irqd_set_dangling(irqd, (1 << get_count_order(nr_irqs)) - nr_irqs);
+
return 0;
}
@@ -3617,12 +3625,16 @@ static void its_irq_domain_free(struct irq_domain *domain, unsigned int virq,
struct irq_data *d = irq_domain_get_irq_data(domain, virq);
struct its_device *its_dev = irq_data_get_irq_chip_data(d);
struct its_node *its = its_dev->its;
+ unsigned int pos = its_get_event_id(d);
int i;
- bitmap_release_region(its_dev->event_map.lpi_map,
- its_get_event_id(irq_domain_get_irq_data(domain, virq)),
+ bitmap_release_region(its_dev->event_map.lpi_map, pos,
get_count_order(nr_irqs));
+ for (i = 0; i < d->dangling; i++)
+ bitmap_release_region(its_dev->event_map.lpi_map,
+ pos + nr_irqs + i, get_count_order(1));
+
for (i = 0; i < nr_irqs; i++) {
struct irq_data *data = irq_domain_get_irq_data(domain,
virq + i);
--
2.17.1
next prev parent reply other threads:[~2022-08-25 6:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-25 6:08 [PATCH 1/2] genirq: Record dangling hwirq number into struct irq_data Liao Chang
2022-08-25 6:08 ` Liao Chang [this message]
2022-08-25 8:29 ` [PATCH 2/2] irqchip/gic-v3-its: Release the allocated but unmapped bits in LPI maps Andy Shevchenko
2022-08-25 8:27 ` [PATCH 1/2] genirq: Record dangling hwirq number into struct irq_data Andy Shevchenko
2022-08-25 8:34 ` liaochang (A)
2022-08-27 16:15 ` Marc Zyngier
2022-08-29 9:28 ` liaochang (A)
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=20220825060819.74303-2-liaochang1@huawei.com \
--to=liaochang1@huawei.com \
--cc=andy.shevchenko@gmail.com \
--cc=brgl@bgdev.pl \
--cc=linux-kernel@vger.kernel.org \
--cc=lvjianmin@loongson.cn \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=mikelley@microsoft.com \
--cc=samuel@sholland.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
all inboxes | Powered by JetHome®