interconnect: qcom: icc-rpmh: Add dynamic icc node id support
authorRaviteja Laggyshetty <quic_rlaggysh@quicinc.com>
Tue, 15 Apr 2025 09:53:40 +0000 (09:53 +0000)
committerGeorgi Djakov <djakov@kernel.org>
Tue, 15 Apr 2025 11:13:47 +0000 (14:13 +0300)
Interconnect framework relies on static IDs for creating,
linking and maintaning the topology. This dependency on static
IDs prevents creating two instances of same provider. To overcome
the dependency on static IDs, dynamic ID support is being added.
To facilitate dynamic node ID support, the driver now uses
node pointers for links instead of static node IDs and icc_node
pointer is added as member in qcom_icc_node structure to track
the node creation.

Signed-off-by: Raviteja Laggyshetty <quic_rlaggysh@quicinc.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20250415095343.32125-5-quic_rlaggysh@quicinc.com
Signed-off-by: Georgi Djakov <djakov@kernel.org>
drivers/interconnect/qcom/icc-rpmh.c
drivers/interconnect/qcom/icc-rpmh.h

index f2d63745be54c489061e29803ac64d22de88a848..41bfc6e7ee1d53d34b919dd8afa97698bc69d79c 100644 (file)
@@ -280,7 +280,14 @@ int qcom_icc_rpmh_probe(struct platform_device *pdev)
                if (!qn)
                        continue;
 
-               node = icc_node_create(qn->id);
+               if (desc->alloc_dyn_id) {
+                       if (!qn->node)
+                               qn->node = icc_node_create_dyn();
+                       node = qn->node;
+               } else {
+                       node = icc_node_create(qn->id);
+               }
+
                if (IS_ERR(node)) {
                        ret = PTR_ERR(node);
                        goto err_remove_nodes;
@@ -290,8 +297,12 @@ int qcom_icc_rpmh_probe(struct platform_device *pdev)
                node->data = qn;
                icc_node_add(node, provider);
 
-               for (j = 0; j < qn->num_links; j++)
-                       icc_link_create(node, qn->links[j]);
+               for (j = 0; j < qn->num_links; j++) {
+                       if (desc->alloc_dyn_id)
+                               icc_link_nodes(node, &qn->link_nodes[j]->node);
+                       else
+                               icc_link_create(node, qn->links[j]);
+               }
 
                data->nodes[i] = node;
        }
index 82344c734091eae78350c00ef8f05f8998739cce..bd8d730249b1c9e5b37afbee485b9500a8028c2e 100644 (file)
@@ -83,6 +83,8 @@ struct qcom_icc_qosbox {
  * @name: the node name used in debugfs
  * @links: an array of nodes where we can go next while traversing
  * @id: a unique node identifier
+ * @link_nodes: links associated with this node
+ * @node: icc_node associated with this node
  * @num_links: the total number of @links
  * @channels: num of channels at this node
  * @buswidth: width of the interconnect between a node and the bus
@@ -96,6 +98,8 @@ struct qcom_icc_node {
        const char *name;
        u16 links[MAX_LINKS];
        u16 id;
+       struct qcom_icc_node **link_nodes;
+       struct icc_node *node;
        u16 num_links;
        u16 channels;
        u16 buswidth;
@@ -154,6 +158,7 @@ struct qcom_icc_desc {
        struct qcom_icc_bcm * const *bcms;
        size_t num_bcms;
        bool qos_requires_clocks;
+       bool alloc_dyn_id;
 };
 
 int qcom_icc_aggregate(struct icc_node *node, u32 tag, u32 avg_bw,