From patchwork Mon Oct 5 11:14:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 11816475 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A01A492C for ; Mon, 5 Oct 2020 11:15:22 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 64BC320774 for ; Mon, 5 Oct 2020 11:15:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="kg5Gz/OP"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="RqHUf71f" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 64BC320774 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version: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:In-Reply-To:References:List-Owner; bh=7s0xFUOvSQPEzbsk3lsyL1xvvDQS/OHTOPfTHQlEEBs=; b=kg5Gz/OP1vn4+Ora7nlJ5c36U0 nk6Kogrs034e6Iog/9If6pv1r9lv3Lfn/V1zBP55H4XwD/3DMSYRxNYYtFN6bLH/RhtEzIZh7crr6 MOI5IJBmS3mog/S9CjXMByMlEwuUrJ9CsrNmJqKciDxz3nxRUw9RA6uJRAoIzvajg0j37AKaARtgS H2oWs+buSWHypQNxHxPAwAf6HxaNgPhb5/GufdAFykW2HseHwQ4T2UquCft+sw8p/nq48u0A0aSMH Sra8fdedi0fzGYB+vu+fXAqrMf0bRroBPxuK1XWmCEWd7i6Wdbm/Gv4fvdYu6PY1f6gIm1y4MjEKg tgbqS87A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kPOSR-0005T7-6V; Mon, 05 Oct 2020 11:15:07 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kPOSL-0005Qo-NH for linux-arm-kernel@lists.infradead.org; Mon, 05 Oct 2020 11:15:03 +0000 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4B77C206CB; Mon, 5 Oct 2020 11:14:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601896499; bh=byOyHb25XO6a9zA+76nGhRy3pYx2YIrog+eRA2qInos=; h=From:To:Cc:Subject:Date:From; b=RqHUf71fPDWNNdPM2UDmRAP/Z792CVULi4OvJg714IhmVcTOQkI5FZ8W/EKn9f2Sf evBUFr0ErbGaFe0b//XLEgmNXvgSekNpIFA4wPM8PxL8JWgdW7qG813i2q4lSHSyTj 8hAzK+Fl9c4wl5C99Ya2XtX8flfGU6VIbpwUcnOY= Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kPOSH-00HLMq-6C; Mon, 05 Oct 2020 12:14:57 +0100 From: Marc Zyngier To: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 0/3] soc/tegra: Prevent the PMC driver from corrupting interrupt routing Date: Mon, 5 Oct 2020 12:14:40 +0100 Message-Id: <20201005111443.1390096-1-maz@kernel.org> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, thierry.reding@gmail.com, jonathanh@nvidia.com, digetx@gmail.com, skomatineni@nvidia.com, vreddytalla@nvidia.com, tglx@linutronix.de, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201005_071501_910419_34D93D7C X-CRM114-Status: GOOD ( 17.56 ) X-Spam-Score: -5.9 (-----) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-5.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [198.145.29.99 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.7 DKIMWL_WL_HIGH DKIMwl.org - High trust sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Venkat Reddy Talla , Jonathan Hunter , Thierry Reding , Sowjanya Komatineni , Dmitry Osipenko , kernel-team@android.com, Thomas Gleixner Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Jon recently reported that one of the Tegra systems (Jetson TX2, aka tegra186) stopped booting with the introduction of the "IPI as IRQs" series. After a few weeks of head scratching and complete puzzlement, I obtained a board and started looking at what was happening. The interrupt hierarchy looks like this: [DEVICE] -A-> [PMC] -B-> [GIC] which seems simple enough. However, not all the devices attached to the PMC follow this hierarchy, and in some cases, the 'B' link isn't present in the HW. In other cases, neither 'A' nor 'B' are present. And yet the PMC driver creates such linkages using random hwirq values for the non-existent links, potentially overriding existing mappings in the process. "What could possibly go wrong?" It turns out that for the 'B' link, the PMC driver uses hwirq 0, which is SGI0 for the GIC, and used as the rescheduling IPI. Obviously, this doesn't go very well, nor very far, as the IPI gets routed to random drivers. Also, as the handling flow has been overridden, this interrupt never gets deactivated and can't fire anymore. Yes, this is bad. The 'A' link is less problematic, but the hwirq value is still out of the irqdomain range, and gets remapped every time a new 'A'-less driver comes up. Instead, let's trim the unused hierarchy levels as needed. This requires some checks in the upper levels of the hierarchy as we now have optional levels, but this looks a lot saner than what we currently have. With this, tegra186 is back booting on -next. I haven't tested any wake-up stuff, nor any other nvidia system (this is the only one I have). If people agree to these changes, I can take them via the irqchip tree so that they make it into the next merge window. M. Marc Zyngier (3): gpio: tegra186: Allow optional irq parent callbacks soc/tegra: pmc: Allow optional irq parent callbacks soc/tegra: pmc: Don't create fake interrupt hierarchy levels drivers/gpio/gpio-tegra186.c | 15 +++- drivers/soc/tegra/pmc.c | 142 ++++++++++++++++++++--------------- 2 files changed, 95 insertions(+), 62 deletions(-) Tested-by: Thierry Reding Tested-by: Jon Hunter