Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp649968pxb; Tue, 5 Apr 2022 17:18:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHT7F64bg1dwD0pGKsvWYvlbYOzZ/g1MPN9TiA6tasFJ9Ej/xtmVainqXRf0h/WuSDAlVx X-Received: by 2002:a17:907:6e21:b0:6e1:c1ab:d0e0 with SMTP id sd33-20020a1709076e2100b006e1c1abd0e0mr5953445ejc.358.1649204288168; Tue, 05 Apr 2022 17:18:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649204288; cv=none; d=google.com; s=arc-20160816; b=XlKPvEk5eSN8OTR0P1bpFwdDxZ2HS0nHFmrEnuo3fFqyTampspvuWYxEcifkqYLphM NaAkhkpkF2nGoYhBHivBEFCf3sDLPb09XWrfal0XDp20TS2sub5hcqAAtkxJeGH0oGWH pfWiQCOtjWkUutmB8FgyRQhR52QiqJejH93z5w/sra9UID4J5aafD620W0Dx76nnSI1u wfENk5wE0PGPzxqn63YMvvMkFMJbBVaYpEfJUm9dmXCPMRdcYDIa93pn1DsiBv6dYsEI L3bUDs7jWN7dRDo1fLuzTIkkKnsjU8o8IZlrCq9b+VpOhtIDm8/6Yq40puFx1bl9r3ad xZRw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=G0oB60PcXsbJ5nVkoYm/f0W1UwlgWrC9kOds7SO17Wc=; b=II6YW5yVoNEb9s1KWvIwv9he+pOLbTNwbc8wQ2DxHbsf3SAFjeRUiS4PY2NU2/EIvg 0OvkBSWjdOsQBJFzyat/lEkkstXAFubCdGXYjnZYysdg9TLGcdGwrZM7kre/o9yaGHst 6/jSQ3nU661IT29QcUlyglW9NO9VGscPABtRUfPhai1bHwe5DAmpVlD+7cJYE2xJ1Mc+ qpt5X5YmHEdsuUz8bW8eGTcbABQe1KaVn2anwOwMJA8jmYX/MxEb+XN8rZrbM7ufgBPu qQIyHn31mhxy1x632SmvtvAuo/U161VSnbormO/X3ak9a87wnvuzfLnLPhsNhoNlyKPO sDCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=outQIfS5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lv3-20020a170906bc8300b006e7fd7464f6si4615684ejb.113.2022.04.05.17.17.41; Tue, 05 Apr 2022 17:18:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=outQIfS5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382627AbiDEMQT (ORCPT + 99 others); Tue, 5 Apr 2022 08:16:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244897AbiDEIwp (ORCPT ); Tue, 5 Apr 2022 04:52:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62F9F2458B; Tue, 5 Apr 2022 01:45:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0A4D2B81A32; Tue, 5 Apr 2022 08:45:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 510ECC385A4; Tue, 5 Apr 2022 08:45:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649148350; bh=4mNg/F94fD5ePGFoWZAISjOcsN7uVsRt2932zEV02wk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=outQIfS5CRnkTOG/lzNo5NxL+OjL7LGOMP2YRTxiAIqeRrqdNGGzDncLQpHSb3Tmp nWXlDdmtZgG1Udv/sT5m04xKK5tsfaO16ywMzIw2Hgtkc1+KgQdrX/n6+g9Koy+gjz duYs51evoI5OXXk4p/lSg2h6rlnyLOq7pI1JaDZc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Szyprowski , Stephan Gerhold , Daniel Lezcano , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.16 0325/1017] cpuidle: qcom-spm: Check if any CPU is managed by SPM Date: Tue, 5 Apr 2022 09:20:38 +0200 Message-Id: <20220405070403.927275915@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stephan Gerhold [ Upstream commit 0ee30ace67e425ab83a1673bf51f50b577328cf9 ] At the moment, the "qcom-spm-cpuidle" platform device is always created, even if none of the CPUs is actually managed by the SPM. On non-qcom platforms this will result in infinite probe-deferral due to the failing qcom_scm_is_available() call. To avoid this, look through the CPU DT nodes and check if there is actually any CPU managed by a SPM (as indicated by the qcom,saw property). It should also be available because e.g. MSM8916 has qcom,saw defined but it's typically not enabled with ARM64/PSCI firmwares. This is needed in preparation of a follow-up change that calls qcom_scm_set_warm_boot_addr() a single time before registering any cpuidle drivers. Otherwise this call might be made even on devices that have this driver enabled but actually make use of PSCI. Fixes: 60f3692b5f0b ("cpuidle: qcom_spm: Detach state machine from main SPM handling") Reported-by: Marek Szyprowski Link: https://lore.kernel.org/r/86e3e09f-a8d7-3dff-3fc6-ddd7d30c5d78@samsung.com/ Signed-off-by: Stephan Gerhold Tested-by: Marek Szyprowski Acked-by: Daniel Lezcano Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20211201130505.257379-2-stephan@gerhold.net Signed-off-by: Sasha Levin --- drivers/cpuidle/cpuidle-qcom-spm.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/cpuidle/cpuidle-qcom-spm.c b/drivers/cpuidle/cpuidle-qcom-spm.c index 01e77913a414..5f27dcc6c110 100644 --- a/drivers/cpuidle/cpuidle-qcom-spm.c +++ b/drivers/cpuidle/cpuidle-qcom-spm.c @@ -155,6 +155,22 @@ static struct platform_driver spm_cpuidle_driver = { }, }; +static bool __init qcom_spm_find_any_cpu(void) +{ + struct device_node *cpu_node, *saw_node; + + for_each_of_cpu_node(cpu_node) { + saw_node = of_parse_phandle(cpu_node, "qcom,saw", 0); + if (of_device_is_available(saw_node)) { + of_node_put(saw_node); + of_node_put(cpu_node); + return true; + } + of_node_put(saw_node); + } + return false; +} + static int __init qcom_spm_cpuidle_init(void) { struct platform_device *pdev; @@ -164,6 +180,10 @@ static int __init qcom_spm_cpuidle_init(void) if (ret) return ret; + /* Make sure there is actually any CPU managed by the SPM */ + if (!qcom_spm_find_any_cpu()) + return 0; + pdev = platform_device_register_simple("qcom-spm-cpuidle", -1, NULL, 0); if (IS_ERR(pdev)) { -- 2.34.1