From patchwork Thu Jul 6 07:46:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 13303303 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 AA000EB64D9 for ; Thu, 6 Jul 2023 07:47:11 +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=m08BoSjTWM/mCgFhNCOn4sygsu37uabqnYKpC+J9Zbs=; b=0iYNHTZuclkwjB vWjblBGdTTg7FAlFdwgF4jIMQj0aE6iXiJ3LZykstHvZOgOHo/o7+nvDjpog3iMvG8AcY0NsYZ++T SodFuxfqfMPz9/SPMHgwaVzuvWsOXlK9sXIMG2qVXOVCCiNvK4DUX5AmA42ntEil4q/t1v5i1X6kI t1ukRhyHk92FEg9uZUErfyCRUYp8OhpbSykcRFUxGai3fuKM1geWlVHIxkRLmNoV6q6B7wGws7Ptj t2S295bWTHiWtKht+HFDh64f9ad47dXwFxgEVfLPHojvIpVeTHqrH2wc+ERnxF9KjI7CD3zExSMaA oCC3sYldIcyB86j1SvOw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qHJhI-000qL0-2k; Thu, 06 Jul 2023 07:46:40 +0000 Received: from mx1.tq-group.com ([93.104.207.81]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qHJhF-000qJy-1M for linux-arm-kernel@lists.infradead.org; Thu, 06 Jul 2023 07:46:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1688629597; x=1720165597; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=FBkKK0Q1R9NNgE46cJR01fF514x5z+JFqxLy9grd32Y=; b=B/oUIapU5SgNXAibCVUWFBiuiIUGO2tlNqlw9Cm9A9HpkTw9BEc0CHOo S6gm7iCT/8zjAZTaMy22A+j1eLiDmE6ax1L1c5KrHLmTNJX3edTZjQ55O 0gWEuOASkdH1CQYzZKvMd2jZF3Oz+/ODHxCf+zUfRyc7OOq/BuXZN+t2i EDb3PgVHl/NWTzaidvLBP+caAZtVa+NCXYPaq3lMsZLCMs+2WFR7xGq5f 8oCuYICaK2fIXPzf7DRYKs1b7vvkxNLVFwaBhPhVH7DpZuDpZUE3UdD1E ADQnCYKEQ7DTmWNYHH8dLDI5MKwDihUvE8R70aIzvVj4zyH68hUwzaQzx Q==; X-IronPort-AV: E=Sophos;i="6.01,185,1684792800"; d="scan'208";a="31784952" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 06 Jul 2023 09:46:34 +0200 Received: from steina-w.tq-net.de (unknown [10.123.53.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id DF073280084; Thu, 6 Jul 2023 09:46:33 +0200 (CEST) From: Alexander Stein To: Shawn Guo , Sascha Hauer , Fabio Estevam , Peng Fan Cc: Alexander Stein , Pengutronix Kernel Team , NXP Linux Team , linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/1] soc: imx: imx93-blk-ctrl: Add dedicated lockdep class for nested genpd locks Date: Thu, 6 Jul 2023 09:46:29 +0200 Message-Id: <20230706074629.3527654-1-alexander.stein@ew.tq-group.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-20230706_004637_869746_E82A940B X-CRM114-Status: GOOD ( 13.23 ) 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 This is the same approach as being used within imx8mp-blk-ctrl. This fixes the lockdep warning about 'possible recursive locking detected' with the following (reduced) backtrace: genpd_lock_mtx+0x14/0x1c genpd_runtime_resume+0x108/0x308 __rpm_callback+0x44/0x19c rpm_callback+0x64/0x70 rpm_resume+0x438/0x6d8 __pm_runtime_resume+0x54/0xb0 imx93_blk_ctrl_power_on+0x100/0x294 _genpd_power_on+0x8c/0x16c genpd_power_on.part.0+0xa0/0x1a0 __genpd_dev_pm_attach+0x14c/0x2e4 genpd_dev_pm_attach+0x58/0x64 dev_pm_domain_attach+0x1c/0x2c Signed-off-by: Alexander Stein --- drivers/soc/imx/imx93-blk-ctrl.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/soc/imx/imx93-blk-ctrl.c b/drivers/soc/imx/imx93-blk-ctrl.c index 6cd7f2015b5a..185d428cebac 100644 --- a/drivers/soc/imx/imx93-blk-ctrl.c +++ b/drivers/soc/imx/imx93-blk-ctrl.c @@ -187,6 +187,8 @@ static int imx93_blk_ctrl_power_off(struct generic_pm_domain *genpd) return 0; } +static struct lock_class_key blk_ctrl_genpd_lock_class; + static int imx93_blk_ctrl_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -269,6 +271,19 @@ static int imx93_blk_ctrl_probe(struct platform_device *pdev) goto cleanup_pds; } + /* + * We use runtime PM to trigger power on/off of the upstream GPC + * domain, as a strict hierarchical parent/child power domain + * setup doesn't allow us to meet the sequencing requirements. + * This means we have nested locking of genpd locks, without the + * nesting being visible at the genpd level, so we need a + * separate lock class to make lockdep aware of the fact that + * this are separate domain locks that can be nested without a + * self-deadlock. + */ + lockdep_set_class(&domain->genpd.mlock, + &blk_ctrl_genpd_lock_class); + bc->onecell_data.domains[i] = &domain->genpd; }