Patch "cpuidle: qcom-spm: Check if any CPU is managed by SPM" has been added to the 5.17-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    cpuidle: qcom-spm: Check if any CPU is managed by SPM

to the 5.17-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     cpuidle-qcom-spm-check-if-any-cpu-is-managed-by-spm.patch
and it can be found in the queue-5.17 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 75f4afbb7eba717decadc2d1e6c9466df0d5eaee
Author: Stephan Gerhold <stephan@xxxxxxxxxxx>
Date:   Wed Dec 1 14:05:02 2021 +0100

    cpuidle: qcom-spm: Check if any CPU is managed by SPM
    
    [ 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 <m.szyprowski@xxxxxxxxxxx>
    Link: https://lore.kernel.org/r/86e3e09f-a8d7-3dff-3fc6-ddd7d30c5d78@xxxxxxxxxxx/
    Signed-off-by: Stephan Gerhold <stephan@xxxxxxxxxxx>
    Tested-by: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx>
    Acked-by: Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>
    Signed-off-by: Bjorn Andersson <bjorn.andersson@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20211201130505.257379-2-stephan@xxxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

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)) {



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux