soc: qcom: llcc cleanups
Subsystems (2)
v2 cover soc: qcom: llcc cleanups
To better support future versions of llcc, consolidating the driver to llcc-qcom driver file, and taking care of the dependencies. v1 series is availale at:
https://lore.kernel.org/patchwork/patch/1099573/
Changes since v1:
Addressing Bjorn's comments -
* Not using llcc-plat as the platform driver rather using a single driver file now - llcc-qcom.
* Removed SCT_ENTRY macro.
* Moved few structure definitions from include/linux path to llcc-qcom driver as they are not exposed to other subsystems.
Vivek Gautam (3):
soc: qcom: llcc cleanup to get rid of sdm845 specific driver file
soc: qcom: Rename llcc-slice to llcc-qcom
soc: qcom: Make llcc-qcom a generic driver
drivers/soc/qcom/Kconfig | 14 +--
drivers/soc/qcom/Makefile | 3 +-
drivers/soc/qcom/{llcc-slice.c => llcc-qcom.c} | 155 +++++++++++++++++++++++--
drivers/soc/qcom/llcc-sdm845.c | 100 ----------------
include/linux/soc/qcom/llcc-qcom.h | 104 -----------------
5 files changed, 152 insertions(+), 224 deletions(-)
rename drivers/soc/qcom/{llcc-slice.c => llcc-qcom.c} (64%)
delete mode 100644 drivers/soc/qcom/llcc-sdm845.cSignature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v2 1/3 soc: qcom: llcc cleanup to get rid of sdm845 specific driver file
A single file should suffice the need to program the llcc for various platforms. Get rid of sdm845 specific driver file to make way for a more generic driver.
--- drivers/soc/qcom/Kconfig | 14 ++---- drivers/soc/qcom/Makefile | 1 - drivers/soc/qcom/llcc-sdm845.c | 100 ------------------------------------- drivers/soc/qcom/llcc-slice.c | 60 +++++++++++++++++++--- include/linux/soc/qcom/llcc-qcom.h | 57 ++++++++------------- 5 files changed, 77 insertions(+), 155 deletions(-) delete mode 100644 drivers/soc/qcom/llcc-sdm845.c
drivers/soc/qcom/Kconfig +3 -11
@@ -58,17 +58,9 @@ config QCOM_LLCC depends on ARCH_QCOM || COMPILE_TEST help Qualcomm Technologies, Inc. platform specific - Last Level Cache Controller(LLCC) driver. This provides interfaces - to clients that use the LLCC. Say yes here to enable LLCC slice - driver. - -config QCOM_SDM845_LLCC - tristate "Qualcomm Technologies, Inc. SDM845 LLCC driver" - depends on QCOM_LLCC - help - Say yes here to enable the LLCC driver for SDM845. This provides - data required to configure LLCC so that clients can start using the - LLCC slices. + Last Level Cache Controller(LLCC) driver for platforms such as, + SDM845. This provides interfaces to clients that use the LLCC. + Say yes here to enable LLCC slice driver. config QCOM_MDT_LOADER tristate
drivers/soc/qcom/Makefile +0 -1
@@ -21,6 +21,5 @@ obj-$(CONFIG_QCOM_SMSM) += smsm.o obj-$(CONFIG_QCOM_WCNSS_CTRL) += wcnss_ctrl.o obj-$(CONFIG_QCOM_APR) += apr.o obj-$(CONFIG_QCOM_LLCC) += llcc-slice.o -obj-$(CONFIG_QCOM_SDM845_LLCC) += llcc-sdm845.o obj-$(CONFIG_QCOM_RPMHPD) += rpmhpd.o obj-$(CONFIG_QCOM_RPMPD) += rpmpd.o
drivers/soc/qcom/llcc-sdm845.c deleted +0 -100
100 lines not on this page · raw message
drivers/soc/qcom/llcc-slice.c +53 -7
98 lines not on this page · raw message
include/linux/soc/qcom/llcc-qcom.h +21 -36
75 lines not on this page · raw message
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v2 2/3 soc: qcom: Rename llcc-slice to llcc-qcom
In reply to Vivek GautamThe cleaning up was done without changing the driver file name to ensure a cleaner bisect. Change the file name now to facilitate making the driver generic in subsequent patch.
---
drivers/soc/qcom/Makefile | 2 +-
drivers/soc/qcom/{llcc-slice.c => llcc-qcom.c} | 0
2 files changed, 1 insertion(+), 1 deletion(-)
rename drivers/soc/qcom/{llcc-slice.c => llcc-qcom.c} (100%)drivers/soc/qcom/Makefile +1 -1
@@ -20,6 +20,6 @@ obj-$(CONFIG_QCOM_SMP2P) += smp2p.o obj-$(CONFIG_QCOM_SMSM) += smsm.o obj-$(CONFIG_QCOM_WCNSS_CTRL) += wcnss_ctrl.o obj-$(CONFIG_QCOM_APR) += apr.o -obj-$(CONFIG_QCOM_LLCC) += llcc-slice.o +obj-$(CONFIG_QCOM_LLCC) += llcc-qcom.o obj-$(CONFIG_QCOM_RPMHPD) += rpmhpd.o obj-$(CONFIG_QCOM_RPMPD) += rpmpd.o
drivers/soc/qcom/llcc-qcom.c renamed from drivers/soc/qcom/llcc-slice.c +0 -0
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Re: [PATCH 2/3] soc: qcom: Rename llcc-slice to llcc-qcom
Quoting Vivek Gautam (2019-07-18 06:02:37)
Quoted 8 lines
The cleaning up was done without changing the driver file name to ensure a cleaner bisect. Change the file name now to facilitate making the driver generic in subsequent patch.
Signed-off-by Vivek Gautam <[email protected]>--- drivers/soc/qcom/Makefile | 2 +- drivers/soc/qcom/{llcc-slice.c => llcc-qcom.c} | 0
qcom/llcc-qcom.c seems sort of redundant. Would have been nice to have it named llcc.c but I guess the ship has sailed. <sad face>
PATCH v2 3/3 soc: qcom: Make llcc-qcom a generic driver
In reply to Vivek GautamThis makes way for adding future llcc versions.
Also pull out the llcc-qcom specific definitions from includes. Includes path now contains the only definitions that are to be exposed to other subsystems.
--- drivers/soc/qcom/llcc-qcom.c | 137 +++++++++++++++++++++++++++++++------ include/linux/soc/qcom/llcc-qcom.h | 89 ------------------------ 2 files changed, 116 insertions(+), 110 deletions(-)
drivers/soc/qcom/llcc-qcom.c +116 -21
@@ -47,6 +47,100 @@#define BANK_OFFSET_STRIDE 0x80000 +/** +* llcc_slice_config - Data associated with the llcc slice +* @usecase_id: Unique id for the client's use case +* @slice_id: llcc slice id for each client +* @max_cap: The maximum capacity of the cache slice provided in KB +* @priority: Priority of the client used to select victim line for replacement +* @fixed_size: Boolean indicating if the slice has a fixed capacity +* @bonus_ways: Bonus ways are additional ways to be used for any slice, +* if client ends up using more than reserved cache ways. Bonus +* ways are allocated only if they are not reserved for some +* other client. +* @res_ways: Reserved ways for the cache slice, the reserved ways cannot +* be used by any other client than the one its assigned to. +* @cache_mode: Each slice operates as a cache, this controls the mode of the +* slice: normal or TCM(Tightly Coupled Memory) +* @probe_target_ways: Determines what ways to probe for access hit. When +* configured to 1 only bonus and reserved ways are probed. +* When configured to 0 all ways in llcc are probed. +* @dis_cap_alloc: Disable capacity based allocation for a client +* @retain_on_pc: If this bit is set and client has maintained active vote +* then the ways assigned to this client are not flushed on power +* collapse. +* @activate_on_init: Activate the slice immediately after it is programmed +*/ +struct llcc_slice_config { +u32 usecase_id; +u32 slice_id; +u32 max_cap; +u32 priority; +bool fixed_size; +u32 bonus_ways; +u32 res_ways; +u32 cache_mode; +u32 probe_target_ways; +bool dis_cap_alloc; +bool retain_on_pc; +bool activate_on_init; +}; + +/** +* llcc_drv_data - Data associated with the llcc driver +* @regmap: regmap associated with the llcc device +* @bcast_regmap: regmap associated with llcc broadcast offset +* @cfg: pointer to the data structure for slice configuration +* @lock: mutex associated with each slice +* @cfg_size: size of the config data table +* @max_slices: max slices as read from device tree +* @num_banks: Number of llcc banks +* @bitmap: Bit map to track the active slice ids +* @offsets: Pointer to the bank offsets array +* @ecc_irq: interrupt for llcc cache error detection and reporting +*/ +struct llcc_drv_data { +struct regmap *regmap; +struct regmap *bcast_regmap; +const struct llcc_slice_config *cfg; +struct mutex lock; +u32 cfg_size; +u32 max_slices; +u32 num_banks; +unsigned long *bitmap; +u32 *offsets; +int ecc_irq; +}; + +/** +* llcc_edac_reg_data - llcc edac registers data for each error type +* @name: Name of the error +* @synd_reg: Syndrome register address +* @count_status_reg: Status register address to read the error count +* @ways_status_reg: Status register address to read the error ways +* @reg_cnt: Number of registers +* @count_mask: Mask value to get the error count +* @ways_mask: Mask value to get the error ways +* @count_shift: Shift value to get the error count +* @ways_shift: Shift value to get the error ways +*/ +struct llcc_edac_reg_data { +char *name; +u64 synd_reg; +u64 count_status_reg; +u64 ways_status_reg; +u32 reg_cnt; +u32 count_mask; +u32 ways_mask; +u8 count_shift; +u8 ways_shift; +}; + +struct qcom_llcc_config { +const struct llcc_slice_config *sct_data; +int size; +}; +static struct llcc_slice_config sdm845_data[] = { {LLCC_CPUSS ,1 ,2816 ,1 ,0 ,0xffc ,0x2 ,0 ,0 ,1 ,1 ,1 }, {LLCC_VIDSC0 ,2 ,512 ,2 ,1 ,0x0 ,0x0f0 ,0 ,0 ,1 ,1 ,0 },
@@ -68,6 +162,11 @@ static struct llcc_slice_config sdm845_data[] = { { LLCC_AUDHW, 22, 1024, 1, 1, 0xffc, 0x2, 0, 0, 1, 1, 0 }, }; +static const struct qcom_llcc_config sdm845_cfg = { + .sct_data = sdm845_data, + .size =ARRAY_SIZE (sdm845_data), +}; +static struct llcc_drv_data *drv_data = (void *) -EPROBE_DEFER ; static const struct regmap_config llcc_regmap_config = {
@@ -347,13 +446,15 @@ static struct regmap *qcom_llcc_init_mmio(struct platform_device *pdev,return devm_regmap_init_mmio (&pdev->dev, base, &llcc_regmap_config); } -static int qcom_llcc_probe (struct platform_device *pdev, -const struct llcc_slice_config *llcc_cfg,u32 sz) +static int qcom_llcc_probe (struct platform_device *pdev) {u32 num_banks;struct device *dev = &pdev->dev;int ret, i;struct platform_device *llcc_edac; +const struct qcom_llcc_config *cfg; +const struct llcc_slice_config *llcc_cfg; +u32 sz; drv_data =devm_kzalloc (dev,sizeof (*drv_data),GFP_KERNEL );if (!drv_data) {
@@ -383,6 +484,10 @@ static int qcom_llcc_probe(struct platform_device *pdev, num_banks >>=LLCC_LB_CNT_SHIFT ; drv_data->num_banks = num_banks; + cfg =of_device_get_match_data (&pdev->dev); + llcc_cfg = cfg->sct_data; + sz = cfg->size; +for (i =0 ; i < sz; i++)if (llcc_cfg[i].slice_id > drv_data->max_slices) drv_data->max_slices = llcc_cfg[i].slice_id;
@@ -429,30 +534,20 @@ static int qcom_llcc_probe(struct platform_device *pdev,return ret; } -static int sdm845_qcom_llcc_remove (struct platform_device *pdev) -{ -return qcom_llcc_remove (pdev); -} - -static int sdm845_qcom_llcc_probe (struct platform_device *pdev) -{ -return qcom_llcc_probe (pdev, sdm845_data,ARRAY_SIZE (sdm845_data)); -} - -static const struct of_device_id sdm845_qcom_llcc_of_match[] = { - { .compatible ="qcom,sdm845-llcc" , }, +static const struct of_device_id qcom_llcc_of_match[] = { + { .compatible ="qcom,sdm845-llcc" , .data = &sdm845_cfg }, { } }; -static struct platform_driver sdm845_qcom_llcc_driver = { +static struct platform_driver qcom_llcc_driver = { .driver = { - .name ="sdm845-llcc" , - .of_match_table = sdm845_qcom_llcc_of_match, + .name ="qcom-llcc" , + .of_match_table = qcom_llcc_of_match, }, - .probe = sdm845_qcom_llcc_probe, - .remove = sdm845_qcom_llcc_remove, + .probe = qcom_llcc_probe, + .remove = qcom_llcc_remove, }; -module_platform_driver (sdm845_qcom_llcc_driver); +module_platform_driver (qcom_llcc_driver); -MODULE_DESCRIPTION ("QCOM sdm845 LLCC driver" ); +MODULE_DESCRIPTION ("Qualcomm Last Level Cache Controller" );MODULE_LICENSE ("GPL v2" );
include/linux/soc/qcom/llcc-qcom.h +0 -89
95 lines not on this page · raw message
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Quoted 6 lines · Vivek Gautam
To better support future versions of llcc, consolidating the driver to llcc-qcom driver file, and taking care of the dependencies. v1 series is availale at:
https://lore.kernel.org/patchwork/patch/1099573/
Quoted 7 lines
Changes since v1:
Addressing Bjorn's comments -
* Not using llcc-plat as the platform driver rather using a single driver file now - llcc-qcom.
* RemovedSCT_ENTRYmacro.
* Moved few structure definitions frominclude/linuxpath to llcc-qcom driver as they are not exposed to other subsystems.
Hi Bjorn,
How does this cleanup look now? Let me know if there are any improvements to make here.
Best Regards
Vivek
Quoted 19 lines
Vivek Gautam (3):
soc: qcom: llcc cleanup to get rid of sdm845 specific driver file
soc: qcom: Rename llcc-slice to llcc-qcom
soc: qcom: Make llcc-qcom a generic driverdrivers/soc/qcom/Kconfig | 14 +-- drivers/soc/qcom/Makefile | 3 +- drivers/soc/qcom/{llcc-slice.c => llcc-qcom.c} | 155 +++++++++++++++++++++++-- drivers/soc/qcom/llcc-sdm845.c | 100 ---------------- include/linux/soc/qcom/llcc-qcom.h | 104 ----------------- 5 files changed, 152 insertions(+), 224 deletions(-) rename drivers/soc/qcom/{llcc-slice.c => llcc-qcom.c} (64%) delete mode 100644 drivers/soc/qcom/llcc-sdm845.c--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Quoted 17 lines · Vivek Gautam
Quoted 6 lines · Vivek Gautam
To better support future versions of llcc, consolidating the driver to llcc-qcom driver file, and taking care of the dependencies. v1 series is availale at:
https://lore.kernel.org/patchwork/patch/1099573/Quoted 7 lines
Changes since v1:
Addressing Bjorn's comments -
* Not using llcc-plat as the platform driver rather using a single driver file now - llcc-qcom.
* RemovedSCT_ENTRYmacro.
* Moved few structure definitions frominclude/linuxpath to llcc-qcom driver as they are not exposed to other subsystems.
Quoted 5 lines
Hi Bjorn,
How does this cleanup look now? Let me know if there are any improvements to make here.
Hi Bjorn,
Are you planning to pull this series in the next merge window? There's a dt patch as well for llcc on sdm845 [1] that has been lying around.
Let me know if you have concerns with this series. I will be happy to incorporate the suggestions.
[1] https://lore.kernel.org/patchwork/patch/1099318/
Thanks & Regards
Vivek
Quoted 17 lines
Best Regards
VivekQuoted 15 lines
Vivek Gautam (3):
soc: qcom: llcc cleanup to get rid of sdm845 specific driver file
soc: qcom: Rename llcc-slice to llcc-qcom
soc: qcom: Make llcc-qcom a generic driverdrivers/soc/qcom/Kconfig | 14 +-- drivers/soc/qcom/Makefile | 3 +- drivers/soc/qcom/{llcc-slice.c => llcc-qcom.c} | 155 +++++++++++++++++++++++-- drivers/soc/qcom/llcc-sdm845.c | 100 ---------------- include/linux/soc/qcom/llcc-qcom.h | 104 ----------------- 5 files changed, 152 insertions(+), 224 deletions(-) rename drivers/soc/qcom/{llcc-slice.c => llcc-qcom.c} (64%) delete mode 100644 drivers/soc/qcom/llcc-sdm845.c
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Quoted 25 lines · Vivek Gautam
Quoted 17 lines · Vivek Gautam
Quoted 6 lines · Vivek Gautam
To better support future versions of llcc, consolidating the driver to llcc-qcom driver file, and taking care of the dependencies. v1 series is availale at:
https://lore.kernel.org/patchwork/patch/1099573/Quoted 7 lines
Changes since v1:
Addressing Bjorn's comments -
* Not using llcc-plat as the platform driver rather using a single driver file now - llcc-qcom.
* RemovedSCT_ENTRYmacro.
* Moved few structure definitions frominclude/linuxpath to llcc-qcom driver as they are not exposed to other subsystems.Quoted 5 lines
Hi Bjorn,
How does this cleanup look now? Let me know if there are any improvements to make here.
Quoted 8 lines
Hi Bjorn,
Are you planning to pull this series in the next merge window? There's a dt patch as well for llcc on sdm845 [1] that has been lying around.
Let me know if you have concerns with this series. I will be happy to incorporate the suggestions.
No concerns, this is exactly what we discussed before. Sorry for missing it. I've picked the patches now.
Quoted 2 lines
This is part of the v5.4 pull request.
Thanks,
Bjorn
Quoted 26 lines
Thanks & Regards
VivekQuoted 17 lines
Best Regards
VivekQuoted 15 lines
Vivek Gautam (3):
soc: qcom: llcc cleanup to get rid of sdm845 specific driver file
soc: qcom: Rename llcc-slice to llcc-qcom
soc: qcom: Make llcc-qcom a generic driverdrivers/soc/qcom/Kconfig | 14 +-- drivers/soc/qcom/Makefile | 3 +- drivers/soc/qcom/{llcc-slice.c => llcc-qcom.c} | 155 +++++++++++++++++++++++-- drivers/soc/qcom/llcc-sdm845.c | 100 ---------------- include/linux/soc/qcom/llcc-qcom.h | 104 ----------------- 5 files changed, 152 insertions(+), 224 deletions(-) rename drivers/soc/qcom/{llcc-slice.c => llcc-qcom.c} (64%) delete mode 100644 drivers/soc/qcom/llcc-sdm845.cSignature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Quoted 37 lines · Bjorn Andersson
Quoted 25 lines · Vivek Gautam
Quoted 17 lines · Vivek Gautam
Quoted 6 lines · Vivek Gautam
To better support future versions of llcc, consolidating the driver to llcc-qcom driver file, and taking care of the dependencies. v1 series is availale at:
https://lore.kernel.org/patchwork/patch/1099573/Quoted 7 lines
Changes since v1:
Addressing Bjorn's comments -
* Not using llcc-plat as the platform driver rather using a single driver file now - llcc-qcom.
* RemovedSCT_ENTRYmacro.
* Moved few structure definitions frominclude/linuxpath to llcc-qcom driver as they are not exposed to other subsystems.Quoted 5 lines
Hi Bjorn,
How does this cleanup look now? Let me know if there are any improvements to make here.
Quoted 8 lines
Hi Bjorn,
Are you planning to pull this series in the next merge window? There's a dt patch as well for llcc on sdm845 [1] that has been lying around.
Let me know if you have concerns with this series. I will be happy to incorporate the suggestions.
Quoted 7 lines
No concerns, this is exactly what we discussed before. Sorry for missing it. I've picked the patches now.
Quoted 2 lines
This is part of the v5.4 pull request.
Thanks a lot Bjorn.
Best regards
Vivek
Quoted 30 lines
Thanks,
BjornQuoted 26 lines
Thanks & Regards
VivekQuoted 17 lines
Best Regards
VivekQuoted 15 lines
Vivek Gautam (3):
soc: qcom: llcc cleanup to get rid of sdm845 specific driver file
soc: qcom: Rename llcc-slice to llcc-qcom
soc: qcom: Make llcc-qcom a generic driverdrivers/soc/qcom/Kconfig | 14 +-- drivers/soc/qcom/Makefile | 3 +- drivers/soc/qcom/{llcc-slice.c => llcc-qcom.c} | 155 +++++++++++++++++++++++-- drivers/soc/qcom/llcc-sdm845.c | 100 ---------------- include/linux/soc/qcom/llcc-qcom.h | 104 ----------------- 5 files changed, 152 insertions(+), 224 deletions(-) rename drivers/soc/qcom/{llcc-slice.c => llcc-qcom.c} (64%) delete mode 100644 drivers/soc/qcom/llcc-sdm845.c--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation