Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3212713pxk; Mon, 5 Oct 2020 04:17:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLc4D5YZGYpvPaL8H3qcvE+u9jQeB9S/LfEw8KBeq/OzCx1+52aT4EzUY9ulNkTDp+qnS3 X-Received: by 2002:a17:906:c007:: with SMTP id e7mr14900773ejz.55.1601896631314; Mon, 05 Oct 2020 04:17:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601896631; cv=none; d=google.com; s=arc-20160816; b=YWjvuFfh7vwx8196M+pWj4+/YpVLvpwc1P5gPYBtzMdljZtMvmkAypXnVcAQhtBnoE JvB9ERb4yoqcZTyWfNuqQyBSqXBrKVOay8NN213lQiseZeuchJb/p+GiMLPzUTIZoL64 0FAwae3sYbdcEbkKSwFHH+yv9yKwvl65ZIWejTJ4+RJgQF8MIjgX1SimHhPfxgfhNwWa pRYNSraR7f45qLjUrMxTSnvjLfInj5mUxfTvMnS5Eimx/BysZh66MoPLtA+dU66ZPjaP ODqO1zsrQWuTP5gsEvbr7uR2lRKPJfzyLxbz61bQlIe0d95DF4CURQBTVU/+jbYqFpJt 4m9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=uquiuyAW8sPh8Y97q8ZhIGUN2EqoCbghfyB+7q1RkdI=; b=pjF64CSHkfRZ7mAZXb7M2Cj2KDvB+fm6svHcnouWidFDcCxRzJa4w7wWD6DF4uf/kU McID36AA80KkvgQP1+jpHTrW0g02v6p4sWwbZXbXXAL9ARMiizj1Zknbvb6yfTWF5frr XMvP61fKV+dvC+AxYirM9P0MRsZr36INxa1Lvw4EEzqZIuCIOwRIoddVY1jPGB4P2kTe QlZ7tG0qvO2j+O6RyLU55BehUvdK8+ChN5fndBvI+3s1Te39n1P1AtivaDkWbW52NpbX yKWpXjdWNwPOjXdX1pnwv7cPBFX1KiS+8cn7Bxv6zo3tTO9T2ubxXlfUS9v7qOUSGVak XTcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RqHUf71f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g24si6455721ejw.434.2020.10.05.04.16.48; Mon, 05 Oct 2020 04:17:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RqHUf71f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726105AbgJELPB (ORCPT + 99 others); Mon, 5 Oct 2020 07:15:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:57700 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725843AbgJELPA (ORCPT ); Mon, 5 Oct 2020 07:15:00 -0400 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 Cc: Thierry Reding , Jonathan Hunter , Dmitry Osipenko , Sowjanya Komatineni , Venkat Reddy Talla , Thomas Gleixner , kernel-team@android.com 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 Content-Transfer-Encoding: 8bit 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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(-) -- 2.28.0