Skip to content

Commit d7e8323

Browse files
committed
Merge tag 'qcom-drivers-for-4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/agross/linux into next/drivers
Qualcomm ARM Based Driver Updates for v4.19 * Add Qualcomm LLCC driver * Add Qualcomm RPMH controller * Fix memleak in Qualcomm RMTFS * Add dummy qcom_scm_assign_mem() * Fix check for global partition in SMEM * tag 'qcom-drivers-for-4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/agross/linux: soc: qcom: rmtfs-mem: fix memleak in probe error paths soc: qcom: llc-slice: Add missing MODULE_LICENSE() drivers: qcom: rpmh: fix unwanted error check for get_tcs_of_type() drivers: qcom: rpmh-rsc: fix the loop index check in get_req_from_tcs firmware: qcom: scm: add a dummy qcom_scm_assign_mem() drivers: qcom: rpmh-rsc: Check cmd_db_ready() to help children drivers: qcom: rpmh-rsc: allow active requests from wake TCS drivers: qcom: rpmh: add support for batch RPMH request drivers: qcom: rpmh: allow requests to be sent asynchronously drivers: qcom: rpmh: cache sleep/wake state requests drivers: qcom: rpmh-rsc: allow invalidation of sleep/wake TCS drivers: qcom: rpmh-rsc: write sleep/wake requests to TCS drivers: qcom: rpmh: add RPMH helper functions drivers: qcom: rpmh-rsc: log RPMH requests in FTRACE dt-bindings: introduce RPMH RSC bindings for Qualcomm SoCs drivers: qcom: rpmh-rsc: add RPMH controller for QCOM SoCs drivers: soc: Add LLCC driver dt-bindings: Documentation for qcom, llcc soc: qcom: smem: Correct check for global partition Signed-off-by: Olof Johansson <olof@lixom.net>
2 parents 1df88c6 + 78ee559 commit d7e8323

17 files changed

Lines changed: 2341 additions & 7 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
== Introduction==
2+
3+
LLCC (Last Level Cache Controller) provides last level of cache memory in SOC,
4+
that can be shared by multiple clients. Clients here are different cores in the
5+
SOC, the idea is to minimize the local caches at the clients and migrate to
6+
common pool of memory. Cache memory is divided into partitions called slices
7+
which are assigned to clients. Clients can query the slice details, activate
8+
and deactivate them.
9+
10+
Properties:
11+
- compatible:
12+
Usage: required
13+
Value type: <string>
14+
Definition: must be "qcom,sdm845-llcc"
15+
16+
- reg:
17+
Usage: required
18+
Value Type: <prop-encoded-array>
19+
Definition: Start address and the the size of the register region.
20+
21+
Example:
22+
23+
cache-controller@1100000 {
24+
compatible = "qcom,sdm845-llcc";
25+
reg = <0x1100000 0x250000>;
26+
};
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
RPMH RSC:
2+
------------
3+
4+
Resource Power Manager Hardened (RPMH) is the mechanism for communicating with
5+
the hardened resource accelerators on Qualcomm SoCs. Requests to the resources
6+
can be written to the Trigger Command Set (TCS) registers and using a (addr,
7+
val) pair and triggered. Messages in the TCS are then sent in sequence over an
8+
internal bus.
9+
10+
The hardware block (Direct Resource Voter or DRV) is a part of the h/w entity
11+
(Resource State Coordinator a.k.a RSC) that can handle multiple sleep and
12+
active/wake resource requests. Multiple such DRVs can exist in a SoC and can
13+
be written to from Linux. The structure of each DRV follows the same template
14+
with a few variations that are captured by the properties here.
15+
16+
A TCS may be triggered from Linux or triggered by the F/W after all the CPUs
17+
have powered off to facilitate idle power saving. TCS could be classified as -
18+
19+
ACTIVE /* Triggered by Linux */
20+
SLEEP /* Triggered by F/W */
21+
WAKE /* Triggered by F/W */
22+
CONTROL /* Triggered by F/W */
23+
24+
The order in which they are described in the DT, should match the hardware
25+
configuration.
26+
27+
Requests can be made for the state of a resource, when the subsystem is active
28+
or idle. When all subsystems like Modem, GPU, CPU are idle, the resource state
29+
will be an aggregate of the sleep votes from each of those subsystems. Clients
30+
may request a sleep value for their shared resources in addition to the active
31+
mode requests.
32+
33+
Properties:
34+
35+
- compatible:
36+
Usage: required
37+
Value type: <string>
38+
Definition: Should be "qcom,rpmh-rsc".
39+
40+
- reg:
41+
Usage: required
42+
Value type: <prop-encoded-array>
43+
Definition: The first register specifies the base address of the
44+
DRV(s). The number of DRVs in the dependent on the RSC.
45+
The tcs-offset specifies the start address of the
46+
TCS in the DRVs.
47+
48+
- reg-names:
49+
Usage: required
50+
Value type: <string>
51+
Definition: Maps the register specified in the reg property. Must be
52+
"drv-0", "drv-1", "drv-2" etc and "tcs-offset". The
53+
54+
- interrupts:
55+
Usage: required
56+
Value type: <prop-encoded-interrupt>
57+
Definition: The interrupt that trips when a message complete/response
58+
is received for this DRV from the accelerators.
59+
60+
- qcom,drv-id:
61+
Usage: required
62+
Value type: <u32>
63+
Definition: The id of the DRV in the RSC block that will be used by
64+
this controller.
65+
66+
- qcom,tcs-config:
67+
Usage: required
68+
Value type: <prop-encoded-array>
69+
Definition: The tuple defining the configuration of TCS.
70+
Must have 2 cells which describe each TCS type.
71+
<type number_of_tcs>.
72+
The order of the TCS must match the hardware
73+
configuration.
74+
- Cell #1 (TCS Type): TCS types to be specified -
75+
ACTIVE_TCS
76+
SLEEP_TCS
77+
WAKE_TCS
78+
CONTROL_TCS
79+
- Cell #2 (Number of TCS): <u32>
80+
81+
- label:
82+
Usage: optional
83+
Value type: <string>
84+
Definition: Name for the RSC. The name would be used in trace logs.
85+
86+
Drivers that want to use the RSC to communicate with RPMH must specify their
87+
bindings as child nodes of the RSC controllers they wish to communicate with.
88+
89+
Example 1:
90+
91+
For a TCS whose RSC base address is is 0x179C0000 and is at a DRV id of 2, the
92+
register offsets for DRV2 start at 0D00, the register calculations are like
93+
this -
94+
DRV0: 0x179C0000
95+
DRV2: 0x179C0000 + 0x10000 = 0x179D0000
96+
DRV2: 0x179C0000 + 0x10000 * 2 = 0x179E0000
97+
TCS-OFFSET: 0xD00
98+
99+
apps_rsc: rsc@179c0000 {
100+
label = "apps_rsc";
101+
compatible = "qcom,rpmh-rsc";
102+
reg = <0x179c0000 0x10000>,
103+
<0x179d0000 0x10000>,
104+
<0x179e0000 0x10000>;
105+
reg-names = "drv-0", "drv-1", "drv-2";
106+
interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>,
107+
<GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>,
108+
<GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>;
109+
qcom,tcs-offset = <0xd00>;
110+
qcom,drv-id = <2>;
111+
qcom,tcs-config = <ACTIVE_TCS 2>,
112+
<SLEEP_TCS 3>,
113+
<WAKE_TCS 3>,
114+
<CONTROL_TCS 1>;
115+
};
116+
117+
Example 2:
118+
119+
For a TCS whose RSC base address is 0xAF20000 and is at DRV id of 0, the
120+
register offsets for DRV0 start at 01C00, the register calculations are like
121+
this -
122+
DRV0: 0xAF20000
123+
TCS-OFFSET: 0x1C00
124+
125+
disp_rsc: rsc@af20000 {
126+
label = "disp_rsc";
127+
compatible = "qcom,rpmh-rsc";
128+
reg = <0xaf20000 0x10000>;
129+
reg-names = "drv-0";
130+
interrupts = <GIC_SPI 129 IRQ_TYPE_LEVEL_HIGH>;
131+
qcom,tcs-offset = <0x1c00>;
132+
qcom,drv-id = <0>;
133+
qcom,tcs-config = <ACTIVE_TCS 0>,
134+
<SLEEP_TCS 1>,
135+
<WAKE_TCS 1>,
136+
<CONTROL_TCS 0>;
137+
};

‎drivers/soc/qcom/Kconfig‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,23 @@ config QCOM_GSBI
4040
functions for connecting the underlying serial UART, SPI, and I2C
4141
devices to the output pins.
4242

43+
config QCOM_LLCC
44+
tristate "Qualcomm Technologies, Inc. LLCC driver"
45+
depends on ARCH_QCOM
46+
help
47+
Qualcomm Technologies, Inc. platform specific
48+
Last Level Cache Controller(LLCC) driver. This provides interfaces
49+
to clients that use the LLCC. Say yes here to enable LLCC slice
50+
driver.
51+
52+
config QCOM_SDM845_LLCC
53+
tristate "Qualcomm Technologies, Inc. SDM845 LLCC driver"
54+
depends on QCOM_LLCC
55+
help
56+
Say yes here to enable the LLCC driver for SDM845. This provides
57+
data required to configure LLCC so that clients can start using the
58+
LLCC slices.
59+
4360
config QCOM_MDT_LOADER
4461
tristate
4562
select QCOM_SCM
@@ -75,6 +92,16 @@ config QCOM_RMTFS_MEM
7592

7693
Say y here if you intend to boot the modem remoteproc.
7794

95+
config QCOM_RPMH
96+
bool "Qualcomm RPM-Hardened (RPMH) Communication"
97+
depends on ARCH_QCOM && ARM64 && OF || COMPILE_TEST
98+
help
99+
Support for communication with the hardened-RPM blocks in
100+
Qualcomm Technologies Inc (QTI) SoCs. RPMH communication uses an
101+
internal bus to transmit state requests for shared resources. A set
102+
of hardware components aggregate requests for these resources and
103+
help apply the aggregated state on the resource.
104+
78105
config QCOM_SMEM
79106
tristate "Qualcomm Shared Memory Manager (SMEM)"
80107
depends on ARCH_QCOM

‎drivers/soc/qcom/Makefile‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# SPDX-License-Identifier: GPL-2.0
2+
CFLAGS_rpmh-rsc.o := -I$(src)
23
obj-$(CONFIG_QCOM_GENI_SE) += qcom-geni-se.o
34
obj-$(CONFIG_QCOM_COMMAND_DB) += cmd-db.o
45
obj-$(CONFIG_QCOM_GLINK_SSR) += glink_ssr.o
@@ -8,10 +9,15 @@ obj-$(CONFIG_QCOM_PM) += spm.o
89
obj-$(CONFIG_QCOM_QMI_HELPERS) += qmi_helpers.o
910
qmi_helpers-y += qmi_encdec.o qmi_interface.o
1011
obj-$(CONFIG_QCOM_RMTFS_MEM) += rmtfs_mem.o
12+
obj-$(CONFIG_QCOM_RPMH) += qcom_rpmh.o
13+
qcom_rpmh-y += rpmh-rsc.o
14+
qcom_rpmh-y += rpmh.o
1115
obj-$(CONFIG_QCOM_SMD_RPM) += smd-rpm.o
1216
obj-$(CONFIG_QCOM_SMEM) += smem.o
1317
obj-$(CONFIG_QCOM_SMEM_STATE) += smem_state.o
1418
obj-$(CONFIG_QCOM_SMP2P) += smp2p.o
1519
obj-$(CONFIG_QCOM_SMSM) += smsm.o
1620
obj-$(CONFIG_QCOM_WCNSS_CTRL) += wcnss_ctrl.o
1721
obj-$(CONFIG_QCOM_APR) += apr.o
22+
obj-$(CONFIG_QCOM_LLCC) += llcc-slice.o
23+
obj-$(CONFIG_QCOM_SDM845_LLCC) += llcc-sdm845.o

‎drivers/soc/qcom/llcc-sdm845.c‎

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
/*
3+
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
4+
*
5+
*/
6+
7+
#include <linux/kernel.h>
8+
#include <linux/module.h>
9+
#include <linux/of.h>
10+
#include <linux/of_device.h>
11+
#include <linux/soc/qcom/llcc-qcom.h>
12+
13+
/*
14+
* SCT(System Cache Table) entry contains of the following members:
15+
* usecase_id: Unique id for the client's use case
16+
* slice_id: llcc slice id for each client
17+
* max_cap: The maximum capacity of the cache slice provided in KB
18+
* priority: Priority of the client used to select victim line for replacement
19+
* fixed_size: Boolean indicating if the slice has a fixed capacity
20+
* bonus_ways: Bonus ways are additional ways to be used for any slice,
21+
* if client ends up using more than reserved cache ways. Bonus
22+
* ways are allocated only if they are not reserved for some
23+
* other client.
24+
* res_ways: Reserved ways for the cache slice, the reserved ways cannot
25+
* be used by any other client than the one its assigned to.
26+
* cache_mode: Each slice operates as a cache, this controls the mode of the
27+
* slice: normal or TCM(Tightly Coupled Memory)
28+
* probe_target_ways: Determines what ways to probe for access hit. When
29+
* configured to 1 only bonus and reserved ways are probed.
30+
* When configured to 0 all ways in llcc are probed.
31+
* dis_cap_alloc: Disable capacity based allocation for a client
32+
* retain_on_pc: If this bit is set and client has maintained active vote
33+
* then the ways assigned to this client are not flushed on power
34+
* collapse.
35+
* activate_on_init: Activate the slice immediately after the SCT is programmed
36+
*/
37+
#define SCT_ENTRY(uid, sid, mc, p, fs, bway, rway, cmod, ptw, dca, rp, a) \
38+
{ \
39+
.usecase_id = uid, \
40+
.slice_id = sid, \
41+
.max_cap = mc, \
42+
.priority = p, \
43+
.fixed_size = fs, \
44+
.bonus_ways = bway, \
45+
.res_ways = rway, \
46+
.cache_mode = cmod, \
47+
.probe_target_ways = ptw, \
48+
.dis_cap_alloc = dca, \
49+
.retain_on_pc = rp, \
50+
.activate_on_init = a, \
51+
}
52+
53+
static struct llcc_slice_config sdm845_data[] = {
54+
SCT_ENTRY(LLCC_CPUSS, 1, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 1),
55+
SCT_ENTRY(LLCC_VIDSC0, 2, 512, 2, 1, 0x0, 0x0f0, 0, 0, 1, 1, 0),
56+
SCT_ENTRY(LLCC_VIDSC1, 3, 512, 2, 1, 0x0, 0x0f0, 0, 0, 1, 1, 0),
57+
SCT_ENTRY(LLCC_ROTATOR, 4, 563, 2, 1, 0x0, 0x00e, 2, 0, 1, 1, 0),
58+
SCT_ENTRY(LLCC_VOICE, 5, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0),
59+
SCT_ENTRY(LLCC_AUDIO, 6, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0),
60+
SCT_ENTRY(LLCC_MDMHPGRW, 7, 1024, 2, 0, 0xfc, 0xf00, 0, 0, 1, 1, 0),
61+
SCT_ENTRY(LLCC_MDM, 8, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0),
62+
SCT_ENTRY(LLCC_CMPT, 10, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0),
63+
SCT_ENTRY(LLCC_GPUHTW, 11, 512, 1, 1, 0xc, 0x0, 0, 0, 1, 1, 0),
64+
SCT_ENTRY(LLCC_GPU, 12, 2304, 1, 0, 0xff0, 0x2, 0, 0, 1, 1, 0),
65+
SCT_ENTRY(LLCC_MMUHWT, 13, 256, 2, 0, 0x0, 0x1, 0, 0, 1, 0, 1),
66+
SCT_ENTRY(LLCC_CMPTDMA, 15, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0),
67+
SCT_ENTRY(LLCC_DISP, 16, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0),
68+
SCT_ENTRY(LLCC_VIDFW, 17, 2816, 1, 0, 0xffc, 0x2, 0, 0, 1, 1, 0),
69+
SCT_ENTRY(LLCC_MDMHPFX, 20, 1024, 2, 1, 0x0, 0xf00, 0, 0, 1, 1, 0),
70+
SCT_ENTRY(LLCC_MDMPNG, 21, 1024, 0, 1, 0x1e, 0x0, 0, 0, 1, 1, 0),
71+
SCT_ENTRY(LLCC_AUDHW, 22, 1024, 1, 1, 0xffc, 0x2, 0, 0, 1, 1, 0),
72+
};
73+
74+
static int sdm845_qcom_llcc_probe(struct platform_device *pdev)
75+
{
76+
return qcom_llcc_probe(pdev, sdm845_data, ARRAY_SIZE(sdm845_data));
77+
}
78+
79+
static const struct of_device_id sdm845_qcom_llcc_of_match[] = {
80+
{ .compatible = "qcom,sdm845-llcc", },
81+
{ }
82+
};
83+
84+
static struct platform_driver sdm845_qcom_llcc_driver = {
85+
.driver = {
86+
.name = "sdm845-llcc",
87+
.of_match_table = sdm845_qcom_llcc_of_match,
88+
},
89+
.probe = sdm845_qcom_llcc_probe,
90+
};
91+
module_platform_driver(sdm845_qcom_llcc_driver);
92+
93+
MODULE_DESCRIPTION("QCOM sdm845 LLCC driver");
94+
MODULE_LICENSE("GPL v2");

0 commit comments

Comments
 (0)