mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Raviteja Laggyshetty <quic_rlaggysh@quicinc.com>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Georgi Djakov <djakov@kernel.org>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>,
	Odelu Kukatla <quic_okukatla@quicinc.com>,
	"Mike Tipton" <quic_mdtipton@quicinc.com>,
	Jeff Johnson <quic_jjohnson@quicinc.com>,
	Andrew Halaney <ahalaney@redhat.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 V8 2/7] interconnect: core: Add dynamic id allocation support
Date: Sun, 16 Feb 2025 22:08:51 +0530	[thread overview]
Message-ID: <f40f6b9d-8f31-4ce6-a912-1aa484863d5e@quicinc.com> (raw)
In-Reply-To: <bwiuhfgv4jw7tlwjqffgrxvskxbpf4forz46nn5g3vihz3z5od@w25y7hdprykf>



On 2/10/2025 4:20 PM, Dmitry Baryshkov wrote:
> On Wed, Feb 05, 2025 at 06:27:38PM +0000, Raviteja Laggyshetty wrote:
>> The current interconnect framework relies on static IDs for node
>> creation and registration, which limits topologies with multiple
>> instances of the same interconnect provider. To address this, update
>> the interconnect framework APIs icc_node_create() and icc_link_create()
>> APIs to dynamically allocate IDs for interconnect nodes during creation.
>> This change removes the dependency on static IDs, allowing multiple
>> instances of the same hardware, such as EPSS L3.
>>
>> Signed-off-by: Raviteja Laggyshetty <quic_rlaggysh@quicinc.com>
>> ---
>>  drivers/interconnect/core.c | 13 ++++++++++++-
>>  1 file changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c
>> index 9d5404a07e8a..40700246f1b6 100644
>> --- a/drivers/interconnect/core.c
>> +++ b/drivers/interconnect/core.c
>> @@ -20,6 +20,8 @@
>>  
>>  #include "internal.h"
>>  
>> +#define ICC_DYN_ID_START 10000
>> +
>>  #define CREATE_TRACE_POINTS
>>  #include "trace.h"
>>  
>> @@ -826,7 +828,12 @@ static struct icc_node *icc_node_create_nolock(int id)
>>  	if (!node)
>>  		return ERR_PTR(-ENOMEM);
>>  
>> -	id = idr_alloc(&icc_idr, node, id, id + 1, GFP_KERNEL);
>> +	/* negative id indicates dynamic id allocation */
>> +	if (id < 0)
> 
> Nit: I think it might be better to add an explicit define for that and
> to decline all other negatdive values. Please leave us some room for
> future expansion.
> 
Do you mean to replace the value of ALLOC_DYN_ID from -1 to some
positive value like 100000 and to use it as initial ID for the nodes
requiring the dynamic allocation ? This explicit define can be used as
check for dynamic allocation and also as argument to idr_alloc min value
argument. Is my interpretation of the comment correct ?

>> +		id = idr_alloc(&icc_idr, node, ICC_DYN_ID_START, 0, GFP_KERNEL);
>> +	else
>> +		id = idr_alloc(&icc_idr, node, id, id + 1, GFP_KERNEL);
>> +
>>  	if (id < 0) {
>>  		WARN(1, "%s: couldn't get idr\n", __func__);
>>  		kfree(node);
>> @@ -962,6 +969,10 @@ void icc_node_add(struct icc_node *node, struct icc_provider *provider)
>>  	node->avg_bw = node->init_avg;
>>  	node->peak_bw = node->init_peak;
>>  
>> +	if (node->id >= ICC_DYN_ID_START)
>> +		node->name = devm_kasprintf(provider->dev, GFP_KERNEL, "%s@%s",
>> +					    node->name, dev_name(provider->dev));
>> +
>>  	if (node->avg_bw || node->peak_bw) {
>>  		if (provider->pre_aggregate)
>>  			provider->pre_aggregate(node);
>> -- 
>> 2.39.2
>>
> 


  reply	other threads:[~2025-02-16 16:39 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-05 18:27 [PATCH V8 0/7] Add EPSS L3 provider support on SA8775P SoC Raviteja Laggyshetty
2025-02-05 18:27 ` [PATCH V8 1/7] dt-bindings: interconnect: Add EPSS L3 compatible for SA8775P Raviteja Laggyshetty
2025-02-10 10:11   ` Krzysztof Kozlowski
2025-02-05 18:27 ` [PATCH V8 2/7] interconnect: core: Add dynamic id allocation support Raviteja Laggyshetty
2025-02-10 10:50   ` Dmitry Baryshkov
2025-02-16 16:38     ` Raviteja Laggyshetty [this message]
2025-02-17  1:02       ` Dmitry Baryshkov
2025-02-21  6:18         ` Raviteja Laggyshetty
2025-02-05 18:27 ` [PATCH V8 3/7] interconnect: qcom: Add multidev EPSS L3 support Raviteja Laggyshetty
2025-02-10 10:57   ` Dmitry Baryshkov
2025-02-16 16:28     ` Raviteja Laggyshetty
2025-02-17  1:08       ` Dmitry Baryshkov
2025-02-21 11:09         ` Raviteja Laggyshetty
2025-02-05 18:27 ` [PATCH V8 4/7] interconnect: qcom: icc-rpmh: Add dynamic icc node id support Raviteja Laggyshetty
2025-02-05 18:27 ` [PATCH V8 5/7] interconnect: qcom: sa8775p: " Raviteja Laggyshetty
2025-02-06  1:00   ` Dmitry Baryshkov
2025-02-10  6:12     ` Raviteja Laggyshetty
2025-02-05 18:27 ` [PATCH V8 6/7] arm64: dts: qcom: sa8775p: add EPSS l3 interconnect provider Raviteja Laggyshetty
2025-02-11 14:36   ` Konrad Dybcio
2025-02-05 18:27 ` [PATCH V8 7/7] arm64: dts: qcom: sa8775p: Add CPU OPP tables to scale DDR/L3 Raviteja Laggyshetty
2025-02-11 15:31   ` Konrad Dybcio

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=f40f6b9d-8f31-4ce6-a912-1aa484863d5e@quicinc.com \
    --to=quic_rlaggysh@quicinc.com \
    --cc=ahalaney@redhat.com \
    --cc=andersson@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=djakov@kernel.org \
    --cc=dmitry.baryshkov@linaro.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=quic_jjohnson@quicinc.com \
    --cc=quic_mdtipton@quicinc.com \
    --cc=quic_okukatla@quicinc.com \
    --cc=quic_sibis@quicinc.com \
    --cc=robh@kernel.org \
    /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®