Skip to content

Commit a3134fb

Browse files
Rishabh BhatnagarAndy Gross
authored andcommitted
drivers: soc: Add LLCC driver
LLCC (Last Level Cache Controller) provides additional cache memory in the system. LLCC is partitioned into multiple slices and each slice gets its own priority, size, ID and other config parameters. LLCC driver programs these parameters for each slice. Clients that are assigned to use LLCC need to get information such size & ID of the slice they get and activate or deactivate the slice as needed. LLCC driver provides API for the clients to perform these operations. Signed-off-by: Channagoud Kadabi <[email protected]> Signed-off-by: Rishabh Bhatnagar <[email protected]> Reviewed-by: Evan Green <[email protected]> Reviewed-by: Rob Herring <[email protected]> Reviewed-by: Bjorn Andersson <[email protected]> Signed-off-by: Andy Gross <[email protected]>
1 parent 7e5700a commit a3134fb

5 files changed

Lines changed: 628 additions & 0 deletions

File tree

drivers/soc/qcom/Kconfig

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

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

drivers/soc/qcom/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ obj-$(CONFIG_QCOM_SMP2P) += smp2p.o
1515
obj-$(CONFIG_QCOM_SMSM) += smsm.o
1616
obj-$(CONFIG_QCOM_WCNSS_CTRL) += wcnss_ctrl.o
1717
obj-$(CONFIG_QCOM_APR) += apr.o
18+
obj-$(CONFIG_QCOM_LLCC) += llcc-slice.o
19+
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)