From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE7C4183077; Wed, 3 Jul 2024 11:07:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720004841; cv=none; b=NYkdVbIbi9DHE7fGHu1w9OXqLtIkSoxuweEqs7paqh4K60WMMa5LsLF4KynlwwBhjzB/O5JHSFvUaDd+E/FzXvuYES9BSAt8Dt3j+6f8rH/rFGGFbwpFK/Rfvg6pyKFhFH7QqLMUaegnStWzhKVncMZBjJjndCC49JPoauFw1xo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720004841; c=relaxed/simple; bh=o5bxa3LxeEUnmpImEGIpL916PxAtfE7z/W8SUaLkZOU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PMihkL5SfSYz+LNC5GvDD3WvVPaWdl3XjPWRuKOdYGA7eEvmAMpTKzZQHvfYooPPYiFMxsMxy6ImXc62cd3zIlRH6cnbEKPTIJ/L8C667s3EbiLVgy9H0VHo2LySteZq6r83Kt55t5Y/7Toohgcu1Npo7SiH5YfimLaUlmmp9jo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=b0tIeF9R; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="b0tIeF9R" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 388C4C32781; Wed, 3 Jul 2024 11:07:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1720004840; bh=o5bxa3LxeEUnmpImEGIpL916PxAtfE7z/W8SUaLkZOU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b0tIeF9RHWE1F0DxKz0I4SjsYwkgtK0A3HfbYxaE8Qll1g8t5Ye5NqaKQB6WDIjV8 0Yh9SYbuY71TeYx9Z3V7oiEWOuhjRjWlIzYA32YfAJP4gT9qydnZ9XbHkX5inNcDyr MknvIagarz7gg8SMjUpeo4t7rzd7pBUeH8RccRjQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Tomi Valkeinen , Ulf Hansson , Sasha Levin Subject: [PATCH 5.10 176/290] pmdomain: ti-sci: Fix duplicate PD referrals Date: Wed, 3 Jul 2024 12:39:17 +0200 Message-ID: <20240703102910.822148593@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240703102904.170852981@linuxfoundation.org> References: <20240703102904.170852981@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tomi Valkeinen [ Upstream commit 670c900f69645db394efb38934b3344d8804171a ] When the dts file has multiple referrers to a single PD (e.g. simple-framebuffer and dss nodes both point to the DSS power-domain) the ti-sci driver will create two power domains, both with the same ID, and that will cause problems as one of the power domains will hide the other one. Fix this checking if a PD with the ID has already been created, and only create a PD for new IDs. Fixes: efa5c01cd7ee ("soc: ti: ti_sci_pm_domains: switch to use multiple genpds instead of one") Signed-off-by: Tomi Valkeinen Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20240415-ti-sci-pd-v1-1-a0e56b8ad897@ideasonboard.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/soc/ti/ti_sci_pm_domains.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/soc/ti/ti_sci_pm_domains.c b/drivers/soc/ti/ti_sci_pm_domains.c index a33ec7eaf23d1..17984a7bffba5 100644 --- a/drivers/soc/ti/ti_sci_pm_domains.c +++ b/drivers/soc/ti/ti_sci_pm_domains.c @@ -114,6 +114,18 @@ static const struct of_device_id ti_sci_pm_domain_matches[] = { }; MODULE_DEVICE_TABLE(of, ti_sci_pm_domain_matches); +static bool ti_sci_pm_idx_exists(struct ti_sci_genpd_provider *pd_provider, u32 idx) +{ + struct ti_sci_pm_domain *pd; + + list_for_each_entry(pd, &pd_provider->pd_list, node) { + if (pd->idx == idx) + return true; + } + + return false; +} + static int ti_sci_pm_domain_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -153,8 +165,14 @@ static int ti_sci_pm_domain_probe(struct platform_device *pdev) break; if (args.args_count >= 1 && args.np == dev->of_node) { - if (args.args[0] > max_id) + if (args.args[0] > max_id) { max_id = args.args[0]; + } else { + if (ti_sci_pm_idx_exists(pd_provider, args.args[0])) { + index++; + continue; + } + } pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); if (!pd) -- 2.43.0