From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.0 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B415C4363A for ; Mon, 5 Oct 2020 11:35:07 +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 348A920776 for ; Mon, 5 Oct 2020 11:35:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="zronKHvG"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NlzCH3xt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 348A920776 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.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-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=df2nXPnMtrrn79qXfpLblO1VP64H3rnNd/OCGD1fagQ=; b=zronKHvGoJ432gzYy0UndMvj5 LQKkO4YjqcmbZc1tqyudRwhDXMiDapMdcoiUQ0NDovS3B2/DBUfrRK/gQ+V9TH/oL1+YLKDw8ffcD jPTcBffklfZnH0tjeUCAUFyqm5c9SE+sAw9de8D0x5DtWorOU4bZV3rJ95Cq2DA5ozNNs4XjMUiip ybzVwOuUkHwd8ynbKJfL9kdn9K650YALwjfiZf9IHBN0veyUUieg0PUxHdM8pb8RcHBXUIgdDJ73b LdUS4lGmwkdOQTO9lZ2F7QFGooySlRDiFQvntpDXnBQ2W7P/i0InB8cMs2Q1Nwjc0XT621eFUB0WO BiAeC0h3g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kPOkR-00013Y-JP; Mon, 05 Oct 2020 11:33:43 +0000 Received: from mail-ed1-x541.google.com ([2a00:1450:4864:20::541]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kPOkN-000125-Rz for linux-arm-kernel@lists.infradead.org; Mon, 05 Oct 2020 11:33:41 +0000 Received: by mail-ed1-x541.google.com with SMTP id dn5so8899074edb.10 for ; Mon, 05 Oct 2020 04:33:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=vb+TwOIgac5MoVAF3GUMOQDHMZpS4X5tXF1cJJQ1nCY=; b=NlzCH3xtoWaf6qZygPGXybA7Frl4WxD8hLDjKfIg4Lyu/rjNlsCA7fgYmHsmooUEsC 9ABypkalhbvsLnS2I8peWMH4pVuiuJawiJWxlZvV5B8eGUIXzTJRRVBF/Y06ceNloMkE iICYR8oWsqERrZSE0EogTct18xuavv5gtqbHv42IgdWHy/RviLK8uTdXRYIKSJuC3QlA kxjm5w+jVJ/f1A3n2bmCL4MroEq5IQX/zZ35zEmmcnjNcjS4Wka7AsGMACKl7bib96Ln ruelEN/2wIqtJej1kXAlsPo5W9+FfJorIayr4dmAb2l+80sEa1FrGnBKzoUUcCVixzTU wU2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=vb+TwOIgac5MoVAF3GUMOQDHMZpS4X5tXF1cJJQ1nCY=; b=cydzSmnb+GCriaGela2cAxqekPpSsE0O1tnzUjU/XaNchBNM5P6LznGV9cKYAIuR8i uMn8ZNF7dOA/0owskY9REycWT2tC2UCk9rR6ddWWDN41LsN3QHj7PiH0x8LMhFcmm6Vq 0yW6v1IfZxZ2bP6uJjNN0+2Qk9wcqJa6178Sijlmnq4hFr3cgMjkpY1+/X9TBW4vSM2/ l0//uljz9EQCuSfxnHlO9IPSyvnQZzo9paBqiTFNcR/rHrbXtrasJU6zQOM9/GsRaCbb gwF0GcTVUF66f/+zySnZ0Vr5xYgCApnqxby6K74DRq3MLiRivjC4eLK4Lxi5Lk2j7lfP qrpQ== X-Gm-Message-State: AOAM532D2xoEwYnJIY2JiP7ELbG8GURS/pEDc9YGN96aRCijceH+rTkx d/mT8ibFZ9PKgnomZ5+NC+s= X-Google-Smtp-Source: ABdhPJxIcDVW0mVVP9Ods5blhc23tjadSvAerumNBOwtZbiN8dkbM63bVtiTf7G6JtjV2bVJNluOSg== X-Received: by 2002:a05:6402:a42:: with SMTP id bt2mr16171053edb.193.1601897617963; Mon, 05 Oct 2020 04:33:37 -0700 (PDT) Received: from localhost ([217.111.27.204]) by smtp.gmail.com with ESMTPSA id v25sm8426608edr.29.2020.10.05.04.33.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Oct 2020 04:33:36 -0700 (PDT) Date: Mon, 5 Oct 2020 13:33:35 +0200 From: Thierry Reding To: Marc Zyngier Subject: Re: [PATCH 3/3] soc/tegra: pmc: Don't create fake interrupt hierarchy levels Message-ID: <20201005113335.GT425362@ulmo> References: <20201005111443.1390096-1-maz@kernel.org> <20201005111443.1390096-4-maz@kernel.org> MIME-Version: 1.0 In-Reply-To: <20201005111443.1390096-4-maz@kernel.org> User-Agent: Mutt/1.14.7 (2020-08-29) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201005_073339_932715_6C7A8D32 X-CRM114-Status: GOOD ( 28.34 ) 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 , linux-kernel@vger.kernel.org, Jonathan Hunter , Sowjanya Komatineni , linux-tegra@vger.kernel.org, Dmitry Osipenko , kernel-team@android.com, Thomas Gleixner , linux-arm-kernel@lists.infradead.org Content-Type: multipart/mixed; boundary="===============8033055694658614473==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============8033055694658614473== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="D5tFrmRBv7YOLFOK" Content-Disposition: inline --D5tFrmRBv7YOLFOK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 05, 2020 at 12:14:43PM +0100, Marc Zyngier wrote: > The Tegra PMC driver does ungodly things with the interrupt hierarchy, > repeatedly corrupting it by pulling hwirq numbers out of thin air, > overriding existing IRQ mappings and changing the handling flow > of unsuspecting users. >=20 > All of this is done in the name of preserving the interrupt hierarchy > even when these levels do not exist in the HW. Together with the use > of proper IRQs for IPIs, this leads to an unbootable system as the > rescheduling IPI gets repeatedly repurposed for random drivers... >=20 > Instead, let's allow the hierarchy to be trimmed to the level that > actually makes sense for the HW, and not any deeper. This avoids > having unnecessary callbacks, overriding mappings, and otherwise > keeps the hierarchy sane. >=20 > Signed-off-by: Marc Zyngier > --- > drivers/soc/tegra/pmc.c | 79 +++++++++++++++-------------------------- > 1 file changed, 29 insertions(+), 50 deletions(-) >=20 > diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c > index 9960f7c18431..4eea3134fb3e 100644 > --- a/drivers/soc/tegra/pmc.c > +++ b/drivers/soc/tegra/pmc.c > @@ -1993,6 +1993,30 @@ static int tegra_pmc_irq_translate(struct irq_doma= in *domain, > return 0; > } > =20 > +/* Trim the irq hierarchy from a particular irq domain */ > +static void trim_hierarchy(unsigned int virq, struct irq_domain *domain) > +{ > + struct irq_data *tail, *irq_data =3D irq_get_irq_data(virq); > + > + /* The PMC doesn't generate any interrupt by itself */ > + if (WARN_ON(!irq_data->parent_data)) > + return; > + > + /* Skip until we find the right domain */ > + while (irq_data->parent_data && irq_data->parent_data->domain !=3D doma= in) > + irq_data =3D irq_data->parent_data; > + > + /* Sever the inner part of the hierarchy... */ > + tail =3D irq_data->parent_data; > + irq_data->parent_data =3D NULL; > + > + /* ... and free it */ > + for (irq_data =3D tail; irq_data; irq_data =3D tail) { > + tail =3D irq_data->parent_data; > + kfree(irq_data); > + }; > +} That kind of looks like what I originally wanted to do and (naively) thought that passing the (0, NULL, NULL) triplet would achieve. Given that this is fairly low-level stuff that deals with the inner workings of the IRQ infrastructure, should we eventually pull this out of the driver and make it into a core helper? I don't seriously expect this to be widely useful, but putting it into the core might help keep it more maintainable. I volunteer to do that work if you think it's a good idea. Thierry --D5tFrmRBv7YOLFOK Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAl97BI8ACgkQ3SOs138+ s6EuNhAApCC/Y3UxL04Yc45mEeylUQ9lbVX8t5YJdJfEEoWIl9a4nCmfszoDz6Jr 0EO3/atnQLyx3E5Lm61/yKshCOrvO6AQNTx//P++eEhIiRcz/HPQQ2dZ5RKCYP/g /cRW8F6S92TdE1hlVuvhEi3cTR2fpdBbo5+y6sNvaHppg9U3mZEXttMB7vb9Ftv9 xFzCk9vIKXfrD5trhyhqgpN8P4rIcq68XWUkJYonv34qO8FmTHziUC6NtJgKesuN RLdDOtyLHVQrJ0h+kU492Gqki5kX7hJRlqxu0EI9tYWWIqYFZT6hylJ4Ozn5v53h zeMLezl3AF6PxQinW0Pg7wWcyJtWb3QSBD+HGW/6jXtzQOtdwqZSCRwJ7ylA+Axz fb5lFkxvT5LcWSZEFk75yCns759w79jSqDgnYUSZJTiG/0FoamgAG5iMXTsTdwJn DDuqiWVpIslq3AvO0IyYNSwwmzSmQBsQkr84mnvFEcPMhrrN/u46AeqAHJRsXUQ+ uZoiUmKL5Hbrpg3GQz6DRAB4nW1wollWyhF1PTiHkImmIhacYijzsb3Y32QJKRom wysRz/m0L9OcXt9lH1KTGjDQbvZa+yAFG2QpPkFuGqstcyI8FJkiH9y3bQd0eJeS YgSfnwxv2zC9kjD92FdFg6iofeY9OJglDyG0oPYr4zVwEhty7SM= =GsHC -----END PGP SIGNATURE----- --D5tFrmRBv7YOLFOK-- --===============8033055694658614473== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============8033055694658614473==--