2022-09-17 03:15:41

by Guru Das Srinagesh

[permalink] [raw]
Subject: [PATCH 1/1] soc: qcom: llcc: Move struct llcc_slice_config to header

Move struct llcc_slice_config to header so that it can be reused by
other kernel modules.

Signed-off-by: Guru Das Srinagesh <[email protected]>
---
drivers/soc/qcom/llcc-qcom.c | 44 --------------------------------------
include/linux/soc/qcom/llcc-qcom.h | 44 ++++++++++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/drivers/soc/qcom/llcc-qcom.c b/drivers/soc/qcom/llcc-qcom.c
index 38d7296..3e7326f 100644
--- a/drivers/soc/qcom/llcc-qcom.c
+++ b/drivers/soc/qcom/llcc-qcom.c
@@ -55,50 +55,6 @@
#define LLCC_VERSION_2_0_0_0 0x02000000
#define LLCC_VERSION_2_1_0_0 0x02010000

-/**
- * struct 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
- * @write_scid_en: Bit enables write cache support for a given scid.
- * @write_scid_cacheable_en: Enables write cache cacheable support for a
- * given scid (not supported on v2 or older hardware).
- */
-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;
- bool write_scid_en;
- bool write_scid_cacheable_en;
-};
-
struct qcom_llcc_config {
const struct llcc_slice_config *sct_data;
int size;
diff --git a/include/linux/soc/qcom/llcc-qcom.h b/include/linux/soc/qcom/llcc-qcom.h
index 9ed5384..e84cd87 100644
--- a/include/linux/soc/qcom/llcc-qcom.h
+++ b/include/linux/soc/qcom/llcc-qcom.h
@@ -106,6 +106,50 @@ struct llcc_drv_data {
u32 version;
};

+/**
+ * struct 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
+ * @write_scid_en: Bit enables write cache support for a given scid.
+ * @write_scid_cacheable_en: Enables write cache cacheable support for a
+ * given scid (not supported on v2 or older hardware).
+ */
+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;
+ bool write_scid_en;
+ bool write_scid_cacheable_en;
+};
+
#if IS_ENABLED(CONFIG_QCOM_LLCC)
/**
* llcc_slice_getd - get llcc slice descriptor
--
2.7.4


2022-09-19 21:02:00

by Bjorn Andersson

[permalink] [raw]
Subject: Re: [PATCH 1/1] soc: qcom: llcc: Move struct llcc_slice_config to header

On Fri, Sep 16, 2022 at 08:06:40PM -0700, Guru Das Srinagesh wrote:
> Move struct llcc_slice_config to header so that it can be reused by
> other kernel modules.

Can you please continue this sentence to provide some concrete examples?
Will we see those other users posted upstream?

Thanks,
Bjorn

>
> Signed-off-by: Guru Das Srinagesh <[email protected]>
> ---
> drivers/soc/qcom/llcc-qcom.c | 44 --------------------------------------
> include/linux/soc/qcom/llcc-qcom.h | 44 ++++++++++++++++++++++++++++++++++++++
> 2 files changed, 44 insertions(+), 44 deletions(-)
>
> diff --git a/drivers/soc/qcom/llcc-qcom.c b/drivers/soc/qcom/llcc-qcom.c
> index 38d7296..3e7326f 100644
> --- a/drivers/soc/qcom/llcc-qcom.c
> +++ b/drivers/soc/qcom/llcc-qcom.c
> @@ -55,50 +55,6 @@
> #define LLCC_VERSION_2_0_0_0 0x02000000
> #define LLCC_VERSION_2_1_0_0 0x02010000
>
> -/**
> - * struct 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
> - * @write_scid_en: Bit enables write cache support for a given scid.
> - * @write_scid_cacheable_en: Enables write cache cacheable support for a
> - * given scid (not supported on v2 or older hardware).
> - */
> -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;
> - bool write_scid_en;
> - bool write_scid_cacheable_en;
> -};
> -
> struct qcom_llcc_config {
> const struct llcc_slice_config *sct_data;
> int size;
> diff --git a/include/linux/soc/qcom/llcc-qcom.h b/include/linux/soc/qcom/llcc-qcom.h
> index 9ed5384..e84cd87 100644
> --- a/include/linux/soc/qcom/llcc-qcom.h
> +++ b/include/linux/soc/qcom/llcc-qcom.h
> @@ -106,6 +106,50 @@ struct llcc_drv_data {
> u32 version;
> };
>
> +/**
> + * struct 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
> + * @write_scid_en: Bit enables write cache support for a given scid.
> + * @write_scid_cacheable_en: Enables write cache cacheable support for a
> + * given scid (not supported on v2 or older hardware).
> + */
> +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;
> + bool write_scid_en;
> + bool write_scid_cacheable_en;
> +};
> +
> #if IS_ENABLED(CONFIG_QCOM_LLCC)
> /**
> * llcc_slice_getd - get llcc slice descriptor
> --
> 2.7.4
>

2022-09-20 16:50:19

by Guru Das Srinagesh

[permalink] [raw]
Subject: Re: [PATCH 1/1] soc: qcom: llcc: Move struct llcc_slice_config to header

On Sep 19 2022 15:56, Bjorn Andersson wrote:
> On Fri, Sep 16, 2022 at 08:06:40PM -0700, Guru Das Srinagesh wrote:
> > Move struct llcc_slice_config to header so that it can be reused by
> > other kernel modules.
>
> Can you please continue this sentence to provide some concrete examples?
> Will we see those other users posted upstream?

There is an llcc debug module downstream that we're currently using to test the
llcc driver that uses this struct and has to copy the struct definition because
it's not in the header. I can check with the team about their plans to upstream
this driver.

Thank you.

Guru Das.