[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5310f549-fdb0-4554-87fc-33bf61e752b7@kernel.org>
Date: Mon, 14 Apr 2025 12:57:23 +0300
From: Georgi Djakov <djakov@...nel.org>
To: Raviteja Laggyshetty <quic_rlaggysh@...cinc.com>,
Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley
<conor+dt@...nel.org>, Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konradybcio@...nel.org>,
Odelu Kukatla <quic_okukatla@...cinc.com>,
Mike Tipton <quic_mdtipton@...cinc.com>,
Jagadeesh Kona <quic_jkona@...cinc.com>
Cc: Jeff Johnson <jeff.johnson@....qualcomm.com>,
Sibi Sankar <quic_sibis@...cinc.com>, linux-arm-msm@...r.kernel.org,
linux-pm@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH V10 2/7] interconnect: core: Add dynamic id allocation
support
On 24.03.25 20:31, 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,
> introduce icc_node_create_dyn() and icc_link_nodes() APIs to
> dynamically allocate IDs for interconnect nodes during creation
> and link. This change removes the dependency on static IDs,
> allowing multiple instances of the same hardware, such as EPSS L3.
>
Hi Raviteja,
Thank you for working on this!
> Signed-off-by: Raviteja Laggyshetty <quic_rlaggysh@...cinc.com>
> ---
> drivers/interconnect/core.c | 83 ++++++++++++++++++++++++++-
> include/linux/interconnect-provider.h | 12 ++++
> include/linux/interconnect.h | 3 +
> 3 files changed, 97 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c
> index 9d5404a07e8a..d4c40c2b3ec1 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);
> + /* dynamic id allocation */
> + if (id == ICC_ALLOC_DYN_ID)
> + 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);
> @@ -838,6 +845,26 @@ static struct icc_node *icc_node_create_nolock(int id)
> return node;
> }
>
> +/**
> + * icc_node_create_dyn() - create a node with dynamic id
> + * @id: node id
This function does not take any arguments. Please remove.
> + *
> + * Return: icc_node pointer on success, or ERR_PTR() on error
> + */
> +struct icc_node *icc_node_create_dyn(void)
> +{
> + struct icc_node *node;
> +
> + mutex_lock(&icc_lock);
> +
> + node = icc_node_create_nolock(ICC_ALLOC_DYN_ID);
> +
> + mutex_unlock(&icc_lock);
> +
> + return node;
> +}
> +EXPORT_SYMBOL_GPL(icc_node_create_dyn);
BR,
Georgi
Powered by blists - more mailing lists