From patchwork Mon Mar 12 06:49:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Yingliang X-Patchwork-Id: 10275541 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 63EC8602C2 for ; Mon, 12 Mar 2018 06:53:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5291C28C0E for ; Mon, 12 Mar 2018 06:53:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 46DE728C14; Mon, 12 Mar 2018 06:53:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D111D28C0E for ; Mon, 12 Mar 2018 06:53:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dvXnUoYuwswmdDDyK8ovhlU5XTkhCjm4+HSus0gtkQM=; b=pUes1uTr2J+UBx UiaHQAtBBth8wdo9kiqxDhOElRIRuuEG4P5UULzkh9wCjHkbYZkoTk8SO52YFU0Uu/X8TNByiSwSk aFozE6rTTX16l/9Al87T5DanWTZt4DaW+s1zw1CU97OSVT5B8kIq3EVQyEeJXVDfkl6Kak4boP+LM xu3/3wK625W8MZUT/S6ttJHAzsqdY3IZrcVvbdwOzZvW6SlqcZVGnXVoMPfvC8OHgZ2XJr6w+OuLr 1ha0j9lObxbKZF4Cz5O3z3QzUgQbbhRZncWFO178craDzHRFdVpuh06tyo7WKMKN4zVUKWeR75uC+ a/k5ALItdYBJxPQTjYGQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1evHKM-0006gi-Mq; Mon, 12 Mar 2018 06:52:58 +0000 Received: from szxga04-in.huawei.com ([45.249.212.190] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1evHIY-0005YU-UU for linux-arm-kernel@lists.infradead.org; Mon, 12 Mar 2018 06:51:14 +0000 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id B32BA6C601EAA; Mon, 12 Mar 2018 14:50:12 +0800 (CST) Received: from localhost (10.177.19.219) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.361.1; Mon, 12 Mar 2018 14:50:06 +0800 From: Yang Yingliang To: 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 Message-ID: <1520837395-10288-5-git-send-email-yangyingliang@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1520837395-10288-1-git-send-email-yangyingliang@huawei.com> References: <1520837395-10288-1-git-send-email-yangyingliang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.19.219] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180311_235108_282512_376FE9F6 X-CRM114-Status: GOOD ( 10.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, yangyingliang@huawei.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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)