Skip to content

Commit e2a3495

Browse files
committed
Merge tag 'qcom-drivers-for-5.16-2' of git://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux into arm/drivers
More Qualcomm driver updates for v5.16 This introduces the Qualcomm "sleep stats" driver, which aids the efforts of bringing various Qualcomm platforms into low power mode. The SMP2P driver gains support for negotiating the "SSR" feature, which is used to better synchronize some corner cases that might appear as the remoteproc is recovering from a crash. The socinfo driver learns about a few new PMICs. SMEM is updated so that it's possible to put the compatible property directly in the reserved-memory node, to avoid having to have a separate node just pointing to the memory-region. Lastly it fixes some bugs in smp2p, apr, rpmhpd drivers, notably avoiding the issue where powering on a power-domain using rpmhpd while keeping the performance_state at 0 is a nop * tag 'qcom-drivers-for-5.16-2' of git://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux: firmware: qcom: scm: Don't break compile test on non-ARM platforms soc: qcom: smp2p: Add of_node_put() before goto soc: qcom: apr: Add of_node_put() before return soc: qcom: qcom_stats: Fix client votes offset soc: qcom: rpmhpd: fix sm8350_mxc's peer domain dt-bindings: arm: cpus: Document qcom,msm8916-smp enable-method ARM: qcom: Add qcom,msm8916-smp enable-method identical to MSM8226 firmware: qcom: scm: Add support for MC boot address API soc: qcom: spm: Add 8916 SPM register data dt-bindings: soc: qcom: spm: Document qcom,msm8916-saw2-v3.0-cpu soc: qcom: socinfo: Add PM8150C and SMB2351 models firmware: qcom_scm: Fix error retval in __qcom_scm_is_call_available() soc: qcom: smp2p: add feature negotiation and ssr ack feature support soc: qcom: Add Sleep stats driver dt-bindings: Introduce QCOM Sleep stats bindings soc: qcom: socinfo: add two missing PMIC IDs soc: qcom: rpmhpd: Make power_on actually enable the domain soc: qcom: smem: Support reserved-memory description dt-bindings: soc: smem: Make indirection optional dt-bindings: sram: Document qcom,rpm-msg-ram Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnd Bergmann <[email protected]>
2 parents 64954d1 + c50031f commit e2a3495

File tree

18 files changed

+645
-77
lines changed

18 files changed

+645
-77
lines changed

Documentation/devicetree/bindings/arm/cpus.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,8 @@ properties:
210210
- qcom,kpss-acc-v1
211211
- qcom,kpss-acc-v2
212212
- qcom,msm8226-smp
213+
# Only valid on ARM 32-bit, see above for ARM v8 64-bit
214+
- qcom,msm8916-smp
213215
- renesas,apmu
214216
- renesas,r9a06g032-smp
215217
- rockchip,rk3036-smp
@@ -294,7 +296,8 @@ properties:
294296
Specifies the ACC* node associated with this CPU.
295297
296298
Required for systems that have an "enable-method" property
297-
value of "qcom,kpss-acc-v1", "qcom,kpss-acc-v2" or "qcom,msm8226-smp"
299+
value of "qcom,kpss-acc-v1", "qcom,kpss-acc-v2", "qcom,msm8226-smp" or
300+
"qcom,msm8916-smp".
298301
299302
* arm/msm/qcom,kpss-acc.txt
300303

Documentation/devicetree/bindings/soc/qcom/qcom,smem.yaml

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,18 @@ maintainers:
1010
- Andy Gross <[email protected]>
1111
- Bjorn Andersson <[email protected]>
1212

13-
description: |
14-
This binding describes the Qualcomm Shared Memory Manager, used to share data
15-
between various subsystems and OSes in Qualcomm platforms.
13+
description:
14+
This binding describes the Qualcomm Shared Memory Manager, a region of
15+
reserved-memory used to share data between various subsystems and OSes in
16+
Qualcomm platforms.
1617

1718
properties:
1819
compatible:
1920
const: qcom,smem
2021

22+
reg:
23+
maxItems: 1
24+
2125
memory-region:
2226
maxItems: 1
2327
description: handle to memory reservation for main SMEM memory region.
@@ -29,11 +33,19 @@ properties:
2933
$ref: /schemas/types.yaml#/definitions/phandle
3034
description: handle to RPM message memory resource
3135

36+
no-map: true
37+
3238
required:
3339
- compatible
34-
- memory-region
3540
- hwlocks
3641

42+
oneOf:
43+
- required:
44+
- reg
45+
- no-map
46+
- required:
47+
- memory-region
48+
3749
additionalProperties: false
3850

3951
examples:
@@ -43,6 +55,20 @@ examples:
4355
#size-cells = <1>;
4456
ranges;
4557
58+
smem@fa00000 {
59+
compatible = "qcom,smem";
60+
reg = <0xfa00000 0x200000>;
61+
no-map;
62+
63+
hwlocks = <&tcsr_mutex 3>;
64+
};
65+
};
66+
- |
67+
reserved-memory {
68+
#address-cells = <1>;
69+
#size-cells = <1>;
70+
ranges;
71+
4672
smem_region: smem@fa00000 {
4773
reg = <0xfa00000 0x200000>;
4874
no-map;

Documentation/devicetree/bindings/soc/qcom/qcom,spm.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ properties:
2222
- qcom,sdm660-silver-saw2-v4.1-l2
2323
- qcom,msm8998-gold-saw2-v4.1-l2
2424
- qcom,msm8998-silver-saw2-v4.1-l2
25+
- qcom,msm8916-saw2-v3.0-cpu
2526
- qcom,msm8226-saw2-v2.1-cpu
2627
- qcom,msm8974-saw2-v2.1-cpu
2728
- qcom,apq8084-saw2-v2.1-cpu
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/soc/qcom/qcom-stats.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Qualcomm Technologies, Inc. (QTI) Stats bindings
8+
9+
maintainers:
10+
- Maulik Shah <[email protected]>
11+
12+
description:
13+
Always On Processor/Resource Power Manager maintains statistics of the SoC
14+
sleep modes involving powering down of the rails and oscillator clock.
15+
16+
Statistics includes SoC sleep mode type, number of times low power mode were
17+
entered, time of last entry, time of last exit and accumulated sleep duration.
18+
19+
properties:
20+
compatible:
21+
enum:
22+
- qcom,rpmh-stats
23+
- qcom,rpm-stats
24+
25+
reg:
26+
maxItems: 1
27+
28+
required:
29+
- compatible
30+
- reg
31+
32+
additionalProperties: false
33+
34+
examples:
35+
# Example of rpmh sleep stats
36+
- |
37+
sram@c3f0000 {
38+
compatible = "qcom,rpmh-stats";
39+
reg = <0x0c3f0000 0x400>;
40+
};
41+
# Example of rpm sleep stats
42+
- |
43+
sram@4690000 {
44+
compatible = "qcom,rpm-stats";
45+
reg = <0x04690000 0x10000>;
46+
};
47+
...

Documentation/devicetree/bindings/sram/sram.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ properties:
3131
- amlogic,meson-gxbb-sram
3232
- arm,juno-sram-ns
3333
- atmel,sama5d2-securam
34+
- qcom,rpm-msg-ram
3435
- rockchip,rk3288-pmu-sram
3536

3637
reg:
@@ -135,7 +136,9 @@ if:
135136
properties:
136137
compatible:
137138
contains:
138-
const: rockchip,rk3288-pmu-sram
139+
enum:
140+
- qcom,rpm-msg-ram
141+
- rockchip,rk3288-pmu-sram
139142

140143
else:
141144
required:

arch/arm/mach-qcom/platsmp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ static const struct smp_operations qcom_smp_cortex_a7_ops __initconst = {
385385
#endif
386386
};
387387
CPU_METHOD_OF_DECLARE(qcom_smp_msm8226, "qcom,msm8226-smp", &qcom_smp_cortex_a7_ops);
388+
CPU_METHOD_OF_DECLARE(qcom_smp_msm8916, "qcom,msm8916-smp", &qcom_smp_cortex_a7_ops);
388389

389390
static const struct smp_operations qcom_smp_kpssv1_ops __initconst = {
390391
.smp_prepare_cpus = qcom_smp_prepare_cpus,

drivers/firmware/qcom_scm.c

Lines changed: 78 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
#include <linux/reset-controller.h>
1818
#include <linux/arm-smccc.h>
1919

20+
#if defined(CONFIG_ARM) || defined(CONFIG_ARM64)
21+
#include <asm/smp_plat.h>
22+
#endif
23+
2024
#include "qcom_scm.h"
2125

2226
static bool download_mode = IS_ENABLED(CONFIG_QCOM_SCM_DOWNLOAD_MODE_DEFAULT);
@@ -252,23 +256,52 @@ static bool __qcom_scm_is_call_available(struct device *dev, u32 svc_id,
252256
break;
253257
default:
254258
pr_err("Unknown SMC convention being used\n");
255-
return -EINVAL;
259+
return false;
256260
}
257261

258262
ret = qcom_scm_call(dev, &desc, &res);
259263

260264
return ret ? false : !!res.result[0];
261265
}
262266

263-
/**
264-
* qcom_scm_set_warm_boot_addr() - Set the warm boot address for cpus
265-
* @entry: Entry point function for the cpus
266-
* @cpus: The cpumask of cpus that will use the entry point
267-
*
268-
* Set the Linux entry point for the SCM to transfer control to when coming
269-
* out of a power down. CPU power down may be executed on cpuidle or hotplug.
270-
*/
271-
int qcom_scm_set_warm_boot_addr(void *entry, const cpumask_t *cpus)
267+
#if defined(CONFIG_ARM) || defined(CONFIG_ARM64)
268+
static int __qcom_scm_set_boot_addr_mc(void *entry, const cpumask_t *cpus,
269+
unsigned int flags)
270+
{
271+
struct qcom_scm_desc desc = {
272+
.svc = QCOM_SCM_SVC_BOOT,
273+
.cmd = QCOM_SCM_BOOT_SET_ADDR_MC,
274+
.owner = ARM_SMCCC_OWNER_SIP,
275+
.arginfo = QCOM_SCM_ARGS(6),
276+
};
277+
unsigned int cpu;
278+
u64 map;
279+
280+
/* Need a device for DMA of the additional arguments */
281+
if (!__scm || __get_convention() == SMC_CONVENTION_LEGACY)
282+
return -EOPNOTSUPP;
283+
284+
desc.args[0] = virt_to_phys(entry);
285+
for_each_cpu(cpu, cpus) {
286+
map = cpu_logical_map(cpu);
287+
desc.args[1] |= BIT(MPIDR_AFFINITY_LEVEL(map, 0));
288+
desc.args[2] |= BIT(MPIDR_AFFINITY_LEVEL(map, 1));
289+
desc.args[3] |= BIT(MPIDR_AFFINITY_LEVEL(map, 2));
290+
}
291+
desc.args[4] = ~0ULL; /* Reserved for affinity level 3 */
292+
desc.args[5] = flags;
293+
294+
return qcom_scm_call(__scm->dev, &desc, NULL);
295+
}
296+
#else
297+
static inline int __qcom_scm_set_boot_addr_mc(void *entry, const cpumask_t *cpus,
298+
unsigned int flags)
299+
{
300+
return -EINVAL;
301+
}
302+
#endif
303+
304+
static int __qcom_scm_set_warm_boot_addr(void *entry, const cpumask_t *cpus)
272305
{
273306
int ret;
274307
int flags = 0;
@@ -304,17 +337,28 @@ int qcom_scm_set_warm_boot_addr(void *entry, const cpumask_t *cpus)
304337

305338
return ret;
306339
}
307-
EXPORT_SYMBOL(qcom_scm_set_warm_boot_addr);
308340

309341
/**
310-
* qcom_scm_set_cold_boot_addr() - Set the cold boot address for cpus
342+
* qcom_scm_set_warm_boot_addr() - Set the warm boot address for cpus
311343
* @entry: Entry point function for the cpus
312344
* @cpus: The cpumask of cpus that will use the entry point
313345
*
314-
* Set the cold boot address of the cpus. Any cpu outside the supported
315-
* range would be removed from the cpu present mask.
346+
* Set the Linux entry point for the SCM to transfer control to when coming
347+
* out of a power down. CPU power down may be executed on cpuidle or hotplug.
316348
*/
317-
int qcom_scm_set_cold_boot_addr(void *entry, const cpumask_t *cpus)
349+
int qcom_scm_set_warm_boot_addr(void *entry, const cpumask_t *cpus)
350+
{
351+
if (!cpus || cpumask_empty(cpus))
352+
return -EINVAL;
353+
354+
if (__qcom_scm_set_boot_addr_mc(entry, cpus, QCOM_SCM_BOOT_MC_FLAG_WARMBOOT))
355+
/* Fallback to old SCM call */
356+
return __qcom_scm_set_warm_boot_addr(entry, cpus);
357+
return 0;
358+
}
359+
EXPORT_SYMBOL(qcom_scm_set_warm_boot_addr);
360+
361+
static int __qcom_scm_set_cold_boot_addr(void *entry, const cpumask_t *cpus)
318362
{
319363
int flags = 0;
320364
int cpu;
@@ -331,9 +375,6 @@ int qcom_scm_set_cold_boot_addr(void *entry, const cpumask_t *cpus)
331375
.owner = ARM_SMCCC_OWNER_SIP,
332376
};
333377

334-
if (!cpus || cpumask_empty(cpus))
335-
return -EINVAL;
336-
337378
for_each_cpu(cpu, cpus) {
338379
if (cpu < ARRAY_SIZE(scm_cb_flags))
339380
flags |= scm_cb_flags[cpu];
@@ -346,6 +387,25 @@ int qcom_scm_set_cold_boot_addr(void *entry, const cpumask_t *cpus)
346387

347388
return qcom_scm_call_atomic(__scm ? __scm->dev : NULL, &desc, NULL);
348389
}
390+
391+
/**
392+
* qcom_scm_set_cold_boot_addr() - Set the cold boot address for cpus
393+
* @entry: Entry point function for the cpus
394+
* @cpus: The cpumask of cpus that will use the entry point
395+
*
396+
* Set the cold boot address of the cpus. Any cpu outside the supported
397+
* range would be removed from the cpu present mask.
398+
*/
399+
int qcom_scm_set_cold_boot_addr(void *entry, const cpumask_t *cpus)
400+
{
401+
if (!cpus || cpumask_empty(cpus))
402+
return -EINVAL;
403+
404+
if (__qcom_scm_set_boot_addr_mc(entry, cpus, QCOM_SCM_BOOT_MC_FLAG_COLDBOOT))
405+
/* Fallback to old SCM call */
406+
return __qcom_scm_set_cold_boot_addr(entry, cpus);
407+
return 0;
408+
}
349409
EXPORT_SYMBOL(qcom_scm_set_cold_boot_addr);
350410

351411
/**

drivers/firmware/qcom_scm.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,12 @@ extern int scm_legacy_call(struct device *dev, const struct qcom_scm_desc *desc,
7878
#define QCOM_SCM_BOOT_SET_ADDR 0x01
7979
#define QCOM_SCM_BOOT_TERMINATE_PC 0x02
8080
#define QCOM_SCM_BOOT_SET_DLOAD_MODE 0x10
81+
#define QCOM_SCM_BOOT_SET_ADDR_MC 0x11
8182
#define QCOM_SCM_BOOT_SET_REMOTE_STATE 0x0a
8283
#define QCOM_SCM_FLUSH_FLAG_MASK 0x3
84+
#define QCOM_SCM_BOOT_MC_FLAG_AARCH64 BIT(0)
85+
#define QCOM_SCM_BOOT_MC_FLAG_COLDBOOT BIT(1)
86+
#define QCOM_SCM_BOOT_MC_FLAG_WARMBOOT BIT(2)
8387

8488
#define QCOM_SCM_SVC_PIL 0x02
8589
#define QCOM_SCM_PIL_PAS_INIT_IMAGE 0x01

drivers/of/platform.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,7 @@ EXPORT_SYMBOL_GPL(of_platform_default_populate);
509509
static const struct of_device_id reserved_mem_matches[] = {
510510
{ .compatible = "qcom,rmtfs-mem" },
511511
{ .compatible = "qcom,cmd-db" },
512+
{ .compatible = "qcom,smem" },
512513
{ .compatible = "ramoops" },
513514
{ .compatible = "nvmem-rmem" },
514515
{}

drivers/soc/qcom/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,16 @@ config QCOM_SPM
199199
to manage cores, L2 low power modes and to configure the internal
200200
Adaptive Voltage Scaler parameters, where supported.
201201

202+
config QCOM_STATS
203+
tristate "Qualcomm Technologies, Inc. (QTI) Sleep stats driver"
204+
depends on (ARCH_QCOM && DEBUG_FS) || COMPILE_TEST
205+
depends on QCOM_SMEM
206+
help
207+
Qualcomm Technologies, Inc. (QTI) Sleep stats driver to read
208+
the shared memory exported by the remote processor related to
209+
various SoC level low power modes statistics and export to debugfs
210+
interface.
211+
202212
config QCOM_WCNSS_CTRL
203213
tristate "Qualcomm WCNSS control driver"
204214
depends on ARCH_QCOM || COMPILE_TEST

0 commit comments

Comments
 (0)