mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yang Yingliang <yangyingliang@huawei.com>
To: <marc.zyngier@arm.com>
Cc: <linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <yangyingliang@huawei.com>
Subject: [RFC PATCH 4/4] irqchip/gic-v3-its: sync config of LPIs if there are more than one prop_page
Date: Mon, 12 Mar 2018 14:49:55 +0800	[thread overview]
Message-ID: <1520837395-10288-5-git-send-email-yangyingliang@huawei.com> (raw)
In-Reply-To: <1520837395-10288-1-git-send-email-yangyingliang@huawei.com>

The config of LPIs need to be same in each prop_page.
So if one prop_page is modified, other prop_page should
be updated too.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/irqchip/irq-gic-v3-its.c | 39 ++++++++++++++++++++++++++++++---------
 1 file changed, 30 insertions(+), 9 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 02a5d95..27306a5 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -1051,11 +1051,25 @@ static inline u32 its_get_event_id(struct irq_data *d)
 	return d->hwirq - its_dev->event_map.lpi_base;
 }
 
+static inline void lpi_flush_config(u8 *cfg)
+{
+	/*
+	 * Make the above write visible to the redistributors.
+	 * And yes, we're flushing exactly: One. Single. Byte.
+	 * Humpf...
+	 */
+	if (gic_rdists->flags & RDIST_FLAGS_PROPBASE_NEEDS_FLUSHING)
+		gic_flush_dcache_to_poc(cfg, sizeof(*cfg));
+	else
+		dsb(ishst);
+}
+
 static void lpi_write_config(struct irq_data *d, u8 clr, u8 set)
 {
 	irq_hw_number_t hwirq;
 	struct page *prop_page;
 	u8 *cfg;
+	int cpu;
 
 	if (irqd_is_forwarded_to_vcpu(d)) {
 		struct its_device *its_dev = irq_data_get_irq_chip_data(d);
@@ -1078,15 +1092,22 @@ static void lpi_write_config(struct irq_data *d, u8 clr, u8 set)
 	*cfg &= ~clr;
 	*cfg |= set | LPI_PROP_GROUP1;
 
-	/*
-	 * Make the above write visible to the redistributors.
-	 * And yes, we're flushing exactly: One. Single. Byte.
-	 * Humpf...
-	 */
-	if (gic_rdists->flags & RDIST_FLAGS_PROPBASE_NEEDS_FLUSHING)
-		gic_flush_dcache_to_poc(cfg, sizeof(*cfg));
-	else
-		dsb(ishst);
+	if (gic_rdists->common_aff_lpi) {
+		/* It's protected by desc->lock, don't need lock any more. */
+		for_each_cpu(cpu, cpu_possible_mask) {
+			u8 *other_cfg;
+			struct page *other_prop_page = per_cpu_ptr(gic_rdists->rdist, cpu)->prop_page;
+
+			if (other_prop_page == prop_page)
+				continue;
+
+			other_cfg = page_address(other_prop_page) + hwirq - 8192;
+			*other_cfg = *cfg;
+			lpi_flush_config(other_cfg);
+		}
+	} else {
+		lpi_flush_config(cfg);
+	}
 }
 
 static void lpi_update_config(struct irq_data *d, u8 clr, u8 set)
-- 
1.8.3

  parent reply	other threads:[~2018-03-12  6:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-12  6:49 [RFC PATCH 0/4] add support for CommonLPIAff field Yang Yingliang
2018-03-12  6:49 ` [RFC PATCH 1/4] irqchip/gic-v3: add common_aff_lpi field in struct rdists Yang Yingliang
2018-03-12  6:49 ` [RFC PATCH 2/4] irqchip/gic-v3-its: replace alloc_pages() with alloc_pages_node() Yang Yingliang
2018-03-12  6:49 ` [RFC PATCH 3/4] irqchip/gic-v3-its: change prop_page to per-cpu type to support CommonLPIAff field Yang Yingliang
2018-03-12  6:49 ` Yang Yingliang [this message]
2018-03-12  9:55 ` [RFC PATCH 0/4] add support for " Marc Zyngier
2018-03-12 12:13   ` Yang Yingliang
2018-03-12 12:25     ` Marc Zyngier

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=1520837395-10288-5-git-send-email-yangyingliang@huawei.com \
    --to=yangyingliang@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    /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®