From: Raviteja Laggyshetty <quic_rlaggysh@quicinc.com>
To: Bjorn Andersson <andersson@kernel.org>
Cc: Georgi Djakov <djakov@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
Odelu Kukatla <quic_okukatla@quicinc.com>,
Mike Tipton <mdtipton@quicinc.com>,
"Vivek Aknurwar" <viveka@quicinc.com>,
Sibi Sankar <quic_sibis@quicinc.com>,
<linux-arm-msm@vger.kernel.org>, <linux-pm@vger.kernel.org>,
<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V7 1/5] interconnect: core: Add dynamic id allocation support
Date: Thu, 23 Jan 2025 16:05:59 +0530 [thread overview]
Message-ID: <91ec5b74-2fda-4aa8-bc87-c8e99f046391@quicinc.com> (raw)
In-Reply-To: <pu3s3fjkt2663wce2632s25oys56wkhsc22lcc5ydepfc4pbll@n73ouprb25zj>
On 1/12/2025 2:27 AM, Bjorn Andersson wrote:
> On Sat, Jan 11, 2025 at 04:14:25PM +0000, Raviteja Laggyshetty wrote:
>> Current interconnect framework is based on static IDs for creating node
>> and registering with framework. This becomes a limitation for topologies
>> where there are multiple instances of same interconnect provider. Add
>> icc_node_create_alloc_id() API to create icc node with dynamic id, this
>> will help to overcome the dependency on static IDs.
>>
>> Signed-off-by: Raviteja Laggyshetty <quic_rlaggysh@quicinc.com>
>> ---
>> drivers/interconnect/core.c | 32 +++++++++++++++++++++++++++
>> include/linux/interconnect-provider.h | 6 +++++
>> 2 files changed, 38 insertions(+)
>>
>> diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c
>> index 9d5404a07e8a..0b7093eb51af 100644
>> --- a/drivers/interconnect/core.c
>> +++ b/drivers/interconnect/core.c
>> @@ -858,6 +858,38 @@ struct icc_node *icc_node_create(int id)
>> }
>> EXPORT_SYMBOL_GPL(icc_node_create);
>>
>> +/**
>> + * icc_node_create_alloc_id() - create node and dynamically allocate id
>> + * @start_id: min id to be allocated
>> + *
>> + * Return: icc_node pointer on success, or ERR_PTR() on error
>> + */
>> +struct icc_node *icc_node_create_alloc_id(int start_id)
>
> By having clients pass in start_id, you distribute the decision of what
> a "good number" is across multiple parts of the system (or you have
> clients relying on getting [start_id, start_id + N) back).
>
> Wouldn't it be better to hide that choice in one place (inside the icc
> framework)?
>
Yes, inline to Dmitry's suggestion I will be moving the start_id to
framework and all dynamic allocations will start from 10000.
> Regards,
> Bjorn
>
>> +{
>> + struct icc_node *node;
>> + int id;
>> +
>> + mutex_lock(&icc_lock);
>> +
>> + node = kzalloc(sizeof(*node), GFP_KERNEL);
>> + if (!node)
>> + return ERR_PTR(-ENOMEM);
>> +
>> + id = idr_alloc(&icc_idr, node, start_id, 0, GFP_KERNEL);
>> + if (id < 0) {
>> + WARN(1, "%s: couldn't get idr\n", __func__);
>> + kfree(node);
>> + node = ERR_PTR(id);
>> + goto out;
>> + }
>> + node->id = id;
>> +out:
>> + mutex_unlock(&icc_lock);
>> +
>> + return node;
>> +}
>> +EXPORT_SYMBOL_GPL(icc_node_create_alloc_id);
>> +
>> /**
>> * icc_node_destroy() - destroy a node
>> * @id: node id
>> diff --git a/include/linux/interconnect-provider.h b/include/linux/interconnect-provider.h
>> index f5aef8784692..4fc7a5884374 100644
>> --- a/include/linux/interconnect-provider.h
>> +++ b/include/linux/interconnect-provider.h
>> @@ -117,6 +117,7 @@ struct icc_node {
>> int icc_std_aggregate(struct icc_node *node, u32 tag, u32 avg_bw,
>> u32 peak_bw, u32 *agg_avg, u32 *agg_peak);
>> struct icc_node *icc_node_create(int id);
>> +struct icc_node *icc_node_create_alloc_id(int start_id);
>> void icc_node_destroy(int id);
>> int icc_link_create(struct icc_node *node, const int dst_id);
>> void icc_node_add(struct icc_node *node, struct icc_provider *provider);
>> @@ -141,6 +142,11 @@ static inline struct icc_node *icc_node_create(int id)
>> return ERR_PTR(-ENOTSUPP);
>> }
>>
>> +static inline struct icc_node *icc_node_create_alloc_id(int start_id)
>> +{
>> + return ERR_PTR(-EOPNOTSUPP);
>> +}
>> +
>> static inline void icc_node_destroy(int id)
>> {
>> }
>> --
>> 2.39.2
>>
next prev parent reply other threads:[~2025-01-23 10:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-11 16:14 [V7 0/5] Add EPSS L3 provider support on SA8775P SoC Raviteja Laggyshetty
2025-01-11 16:14 ` [PATCH V7 1/5] interconnect: core: Add dynamic id allocation support Raviteja Laggyshetty
2025-01-11 20:57 ` Bjorn Andersson
2025-01-23 10:35 ` Raviteja Laggyshetty [this message]
2025-01-13 8:14 ` Dmitry Baryshkov
2025-01-23 10:47 ` Raviteja Laggyshetty
2025-01-20 8:15 ` Dan Carpenter
2025-01-11 16:14 ` [PATCH V7 2/5] interconnect: qcom: Add multidev EPSS L3 support Raviteja Laggyshetty
2025-01-11 21:08 ` Bjorn Andersson
2025-01-23 10:40 ` Raviteja Laggyshetty
2025-01-11 16:14 ` [PATCH V7 3/5] dt-bindings: interconnect: Add EPSS L3 compatible for SA8775P Raviteja Laggyshetty
2025-01-12 9:31 ` Krzysztof Kozlowski
2025-01-23 12:07 ` Raviteja Laggyshetty
2025-01-11 16:14 ` [PATCH V7 4/5] arm64: dts: qcom: sa8775p: add EPSS l3 interconnect provider Raviteja Laggyshetty
2025-01-11 16:14 ` [PATCH V7 5/5] arm64: dts: qcom: sa8775p: Add CPU OPP tables to scale DDR/L3 Raviteja Laggyshetty
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=91ec5b74-2fda-4aa8-bc87-c8e99f046391@quicinc.com \
--to=quic_rlaggysh@quicinc.com \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=djakov@kernel.org \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mdtipton@quicinc.com \
--cc=quic_okukatla@quicinc.com \
--cc=quic_sibis@quicinc.com \
--cc=robh@kernel.org \
--cc=viveka@quicinc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®