]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
firmware: qcom: scm: Drop cpumask parameter from set_boot_addr()
authorStephan Gerhold <stephan@gerhold.net>
Wed, 1 Dec 2021 13:05:04 +0000 (14:05 +0100)
committerBjorn Andersson <bjorn.andersson@linaro.org>
Fri, 4 Feb 2022 03:54:48 +0000 (21:54 -0600)
qcom_scm_set_cold/warm_boot_addr() currently take a cpumask parameter,
but it's not very useful because at the end we always set the same entry
address for all CPUs. This also allows speeding up probe of
cpuidle-qcom-spm a bit because only one SCM call needs to be made to
the TrustZone firmware, instead of one per CPU.

The main reason for this change is that it allows implementing the
"multi-cluster" variant of the set_boot_addr() call more easily
without having to rely on functions that break in certain build
configurations or that are not exported to modules.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20211201130505.257379-4-stephan@gerhold.net
arch/arm/mach-qcom/platsmp.c
drivers/cpuidle/cpuidle-qcom-spm.c
drivers/firmware/qcom_scm.c
include/linux/qcom_scm.h

index 58a4228455ce2713ee3bb135311040a8ab5f2242..65a0d5ce2bb3528304675e1e36e1775f65ec9337 100644 (file)
@@ -357,8 +357,7 @@ static void __init qcom_smp_prepare_cpus(unsigned int max_cpus)
 {
        int cpu;
 
-       if (qcom_scm_set_cold_boot_addr(secondary_startup_arm,
-                                       cpu_present_mask)) {
+       if (qcom_scm_set_cold_boot_addr(secondary_startup_arm)) {
                for_each_present_cpu(cpu) {
                        if (cpu == smp_processor_id())
                                continue;
index 5f27dcc6c110f21a261e0453466cd5a5d763bd38..beedf22cbe78b21d3982065d89020e8f24cc363f 100644 (file)
@@ -122,10 +122,6 @@ static int spm_cpuidle_register(struct device *cpuidle_dev, int cpu)
        if (ret <= 0)
                return ret ? : -ENODEV;
 
-       ret = qcom_scm_set_warm_boot_addr(cpu_resume_arm, cpumask_of(cpu));
-       if (ret)
-               return ret;
-
        return cpuidle_register(&data->cpuidle_driver, NULL);
 }
 
@@ -136,6 +132,10 @@ static int spm_cpuidle_drv_probe(struct platform_device *pdev)
        if (!qcom_scm_is_available())
                return -EPROBE_DEFER;
 
+       ret = qcom_scm_set_warm_boot_addr(cpu_resume_arm);
+       if (ret)
+               return dev_err_probe(&pdev->dev, ret, "set warm boot addr failed");
+
        for_each_possible_cpu(cpu) {
                ret = spm_cpuidle_register(&pdev->dev, cpu);
                if (ret && ret != -ENODEV) {
index 1bcc139c916585323ab694629db62230c6506185..0382f9fa4501ce8e27ab33f6f6869571e993ef6a 100644 (file)
@@ -243,8 +243,7 @@ static bool __qcom_scm_is_call_available(struct device *dev, u32 svc_id,
        return ret ? false : !!res.result[0];
 }
 
-static int qcom_scm_set_boot_addr(void *entry, const cpumask_t *cpus,
-                                 const u8 *cpu_bits)
+static int qcom_scm_set_boot_addr(void *entry, const u8 *cpu_bits)
 {
        int cpu;
        unsigned int flags = 0;
@@ -255,7 +254,7 @@ static int qcom_scm_set_boot_addr(void *entry, const cpumask_t *cpus,
                .owner = ARM_SMCCC_OWNER_SIP,
        };
 
-       for_each_cpu(cpu, cpus) {
+       for_each_present_cpu(cpu) {
                if (cpu >= QCOM_SCM_BOOT_MAX_CPUS)
                        return -EINVAL;
                flags |= cpu_bits[cpu];
@@ -268,27 +267,25 @@ static int qcom_scm_set_boot_addr(void *entry, const cpumask_t *cpus,
 }
 
 /**
- * qcom_scm_set_warm_boot_addr() - Set the warm boot address for cpus
+ * qcom_scm_set_warm_boot_addr() - Set the warm boot address for all cpus
  * @entry: Entry point function for the cpus
- * @cpus: The cpumask of cpus that will use the entry point
  *
  * Set the Linux entry point for the SCM to transfer control to when coming
  * out of a power down. CPU power down may be executed on cpuidle or hotplug.
  */
-int qcom_scm_set_warm_boot_addr(void *entry, const cpumask_t *cpus)
+int qcom_scm_set_warm_boot_addr(void *entry)
 {
-       return qcom_scm_set_boot_addr(entry, cpus, qcom_scm_cpu_warm_bits);
+       return qcom_scm_set_boot_addr(entry, qcom_scm_cpu_warm_bits);
 }
 EXPORT_SYMBOL(qcom_scm_set_warm_boot_addr);
 
 /**
- * qcom_scm_set_cold_boot_addr() - Set the cold boot address for cpus
+ * qcom_scm_set_cold_boot_addr() - Set the cold boot address for all cpus
  * @entry: Entry point function for the cpus
- * @cpus: The cpumask of cpus that will use the entry point
  */
-int qcom_scm_set_cold_boot_addr(void *entry, const cpumask_t *cpus)
+int qcom_scm_set_cold_boot_addr(void *entry)
 {
-       return qcom_scm_set_boot_addr(entry, cpus, qcom_scm_cpu_cold_bits);
+       return qcom_scm_set_boot_addr(entry, qcom_scm_cpu_cold_bits);
 }
 EXPORT_SYMBOL(qcom_scm_set_cold_boot_addr);
 
index 681748619890d867bffafffa5141891db4b3c3b1..f8335644a01aeaf0166002315534ed2436eaf7a1 100644 (file)
@@ -63,8 +63,8 @@ enum qcom_scm_ice_cipher {
 
 extern bool qcom_scm_is_available(void);
 
-extern int qcom_scm_set_cold_boot_addr(void *entry, const cpumask_t *cpus);
-extern int qcom_scm_set_warm_boot_addr(void *entry, const cpumask_t *cpus);
+extern int qcom_scm_set_cold_boot_addr(void *entry);
+extern int qcom_scm_set_warm_boot_addr(void *entry);
 extern void qcom_scm_cpu_power_down(u32 flags);
 extern int qcom_scm_set_remote_state(u32 state, u32 id);