From patchwork Sat Feb 10 01:24:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 13552048 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EE1F8C4829B for ; Sat, 10 Feb 2024 01:25:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=qK455gwucJcwQw0svx/vZelynPk6yydfI45U7a4zB6U=; b=nkqCz3cm+J0/NV NqSxmBq7xVAlWZkpwRP0R0eAXmgZDlTBq61AZ69dJKBev5r9Zlqabr5Hs074Hd7K7N/yc0ukoYWk6 eG678q0ThycOU5AgtzpSLGvvgrf5eaWIUe1/G9aoSVou16IfcSIzn1xoMs0KU3HhMmwIVKsqbVRpJ Jf0mwt9HQDraesxEHJGBcDlNAGoacN4q76I+6R+lWnNBQN+GAoiOO6GiuntLOv9GPOA/Hdo/94UdM 9AT+Z5IXsQG8aqX2xI36bgj0PQMJfDiYnJIf9/Wxo0Fdug6aXL9BmhCfyPmWszVfERyBOLMj6OwN8 yUk5OWOwRLAzV2LX4KkA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rYc70-00000001243-196m; Sat, 10 Feb 2024 01:24:58 +0000 Received: from saphodev.broadcom.com ([192.19.144.205] helo=relay.smtp-ext.broadcom.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rYc6x-0000000123B-2xSi for linux-arm-kernel@lists.infradead.org; Sat, 10 Feb 2024 01:24:57 +0000 Received: from mail-lvn-it-01.lvn.broadcom.net (mail-lvn-it-01.lvn.broadcom.net [10.36.132.253]) by relay.smtp-ext.broadcom.com (Postfix) with ESMTP id E3480C0000E8; Fri, 9 Feb 2024 17:24:52 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com E3480C0000E8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1707528293; bh=xxXAvFJcsZzZwiPknF3QF04PRu/JojlyXTHWeEtALdU=; h=From:To:Cc:Subject:Date:From; b=ZEkE3+EoCdjX3b21BnhGHFsVlZ4nRVj4bXX0scg0IQDki3QtARbi9uIE+mb+te4mY VthG9C4Qn84KV+bCTTvOg3FdoT0TQiH/5cRTkVcIJ4IJpnyNewUlZQJSa1EoI95VaT EfbpYaPeeZttX+41nC7TlWr5dDCNChw1QvfZi3zM= Received: from stbirv-lnx-1.igp.broadcom.net (stbirv-lnx-1.igp.broadcom.net [10.67.48.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail-lvn-it-01.lvn.broadcom.net (Postfix) with ESMTPSA id 2C94C18041CAC4; Fri, 9 Feb 2024 17:24:51 -0800 (PST) From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: maz@kernel.org, Doug Berger , Florian Fainelli , Broadcom internal kernel review list , Thomas Gleixner , Brian Norris , Jason Cooper , linux-mips@vger.kernel.org (open list:BROADCOM BMIPS MIPS ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE) Subject: [PATCH v2] irqchip/irq-brcmstb-l2: add write memory barrier before exit Date: Fri, 9 Feb 2024 17:24:49 -0800 Message-Id: <20240210012449.3009125-1-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240209_172455_867779_097B6367 X-CRM114-Status: GOOD ( 17.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Doug Berger It was observed on Broadcom devices that use GIC v3 architecture L1 interrupt controllers as the parent of brcmstb-l2 interrupt controllers that the deactivation of the parent irq could happen before the brcmstb-l2 deasserted its output. This would lead the GIC to reactivate the irq only to find that no L2 interrupt was pending. The result was a spurious interrupt invoking the handle_bad_irq() with its associated messaging. While this did not create a functional problem it is a waste of cycles. The hazard exists because the memory mapped bus writes to the brcmstb-l2 registers are buffered and the GIC v3 architecture uses a very efficient system register write to deactivate the interrupt. This commit adds a write memory barrier prior to invoking chained_irq_exit() to introduce a dsb(st) on those systems to ensure the system register write cannot be executed until the memory mapped writes are visible to the system. Signed-off-by: Doug Berger Acked-by: Florian Fainelli Fixes: 7f646e92766e ("irqchip: brcmstb-l2: Add Broadcom Set Top Box Level-2 interrupt controller") [florian: Added Fixes tag] Signed-off-by: Florian Fainelli Acked-by: Marc Zyngier --- Changes in v2: - add Fixes tag - bump copyright drivers/irqchip/irq-brcmstb-l2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-brcmstb-l2.c b/drivers/irqchip/irq-brcmstb-l2.c index 5559c943f03f..63aed60dd3f1 100644 --- a/drivers/irqchip/irq-brcmstb-l2.c +++ b/drivers/irqchip/irq-brcmstb-l2.c @@ -2,7 +2,7 @@ /* * Generic Broadcom Set Top Box Level 2 Interrupt controller driver * - * Copyright (C) 2014-2017 Broadcom + * Copyright (C) 2014-2024 Broadcom */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt @@ -112,6 +112,9 @@ static void brcmstb_l2_intc_irq_handle(struct irq_desc *desc) generic_handle_domain_irq(b->domain, irq); } while (status); out: + /* Don't ack parent before all device writes are done */ + wmb(); + chained_irq_exit(chip, desc); }