Merge tag 'icc-6.16-rc5' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/djakov/icc into char-misc-linus

Georgi writes:

interconnect fixes for v6.16-rc

This contains a few framework core fixes (related to the new dynamic node
id feature), as well as some misc Qualcomm and Samsung driver fixes.

- interconnect: qcom: sc7280: Add missing num_links to xm_pcie3_1 node
- interconnect: exynos: handle node name allocation failure
- interconnect: increase ICC_DYN_ID_START
- interconnect: icc-clk: destroy nodes in case of memory allocation failures
- interconnect: avoid memory allocation when 'icc_bw_lock' is held

Signed-off-by: Georgi Djakov <djakov@kernel.org>

* tag 'icc-6.16-rc5' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/djakov/icc:
  interconnect: avoid memory allocation when 'icc_bw_lock' is held
  interconnect: icc-clk: destroy nodes in case of memory allocation failures
  interconnect: increase ICC_DYN_ID_START
  interconnect: exynos: handle node name allocation failure
  interconnect: qcom: sc7280: Add missing num_links to xm_pcie3_1 node
This commit is contained in:
Greg Kroah-Hartman
2025-07-04 16:31:28 +02:00
7 changed files with 56 additions and 7 deletions
+29 -5
View File
@@ -20,7 +20,7 @@
#include "internal.h"
#define ICC_DYN_ID_START 10000
#define ICC_DYN_ID_START 100000
#define CREATE_TRACE_POINTS
#include "trace.h"
@@ -819,6 +819,9 @@ static struct icc_node *icc_node_create_nolock(int id)
{
struct icc_node *node;
if (id >= ICC_DYN_ID_START)
return ERR_PTR(-EINVAL);
/* check if node already exists */
node = node_find(id);
if (node)
@@ -906,10 +909,35 @@ void icc_node_destroy(int id)
return;
kfree(node->links);
if (node->id >= ICC_DYN_ID_START)
kfree(node->name);
kfree(node);
}
EXPORT_SYMBOL_GPL(icc_node_destroy);
/**
* icc_node_set_name() - set node name
* @node: node
* @provider: node provider
* @name: node name
*
* Return: 0 on success, or -ENOMEM on allocation failure
*/
int icc_node_set_name(struct icc_node *node, const struct icc_provider *provider, const char *name)
{
if (node->id >= ICC_DYN_ID_START) {
node->name = kasprintf(GFP_KERNEL, "%s@%s", name,
dev_name(provider->dev));
if (!node->name)
return -ENOMEM;
} else {
node->name = name;
}
return 0;
}
EXPORT_SYMBOL_GPL(icc_node_set_name);
/**
* icc_link_nodes() - create link between two nodes
* @src_node: source node
@@ -1038,10 +1066,6 @@ 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
View File
@@ -117,6 +117,7 @@ struct icc_provider *icc_clk_register(struct device *dev,
node->name = devm_kasprintf(dev, GFP_KERNEL, "%s_master", data[i].name);
if (!node->name) {
icc_node_destroy(node->id);
ret = -ENOMEM;
goto err;
}
@@ -135,6 +136,7 @@ struct icc_provider *icc_clk_register(struct device *dev,
node->name = devm_kasprintf(dev, GFP_KERNEL, "%s_slave", data[i].name);
if (!node->name) {
icc_node_destroy(node->id);
ret = -ENOMEM;
goto err;
}
+6 -1
View File
@@ -293,7 +293,12 @@ int qcom_icc_rpmh_probe(struct platform_device *pdev)
goto err_remove_nodes;
}
node->name = qn->name;
ret = icc_node_set_name(node, provider, qn->name);
if (ret) {
icc_node_destroy(node->id);
goto err_remove_nodes;
}
node->data = qn;
icc_node_add(node, provider);
+6 -1
View File
@@ -236,7 +236,12 @@ static int qcom_osm_l3_probe(struct platform_device *pdev)
goto err;
}
node->name = qnodes[i]->name;
ret = icc_node_set_name(node, provider, qnodes[i]->name);
if (ret) {
icc_node_destroy(node->id);
goto err;
}
/* Cast away const and add it back in qcom_osm_l3_set() */
node->data = (void *)qnodes[i];
icc_node_add(node, provider);
+1
View File
@@ -238,6 +238,7 @@ static struct qcom_icc_node xm_pcie3_1 = {
.id = SC7280_MASTER_PCIE_1,
.channels = 1,
.buswidth = 8,
.num_links = 1,
.links = { SC7280_SLAVE_ANOC_PCIE_GEM_NOC },
};
+5
View File
@@ -134,6 +134,11 @@ static int exynos_generic_icc_probe(struct platform_device *pdev)
priv->node = icc_node;
icc_node->name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%pOFn",
bus_dev->of_node);
if (!icc_node->name) {
icc_node_destroy(pdev->id);
return -ENOMEM;
}
if (of_property_read_u32(bus_dev->of_node, "samsung,data-clock-ratio",
&priv->bus_clk_ratio))
priv->bus_clk_ratio = EXYNOS_ICC_DEFAULT_BUS_CLK_RATIO;
+7
View File
@@ -119,6 +119,7 @@ int icc_std_aggregate(struct icc_node *node, u32 tag, u32 avg_bw,
struct icc_node *icc_node_create_dyn(void);
struct icc_node *icc_node_create(int id);
void icc_node_destroy(int id);
int icc_node_set_name(struct icc_node *node, const struct icc_provider *provider, const char *name);
int icc_link_nodes(struct icc_node *src_node, struct icc_node **dst_node);
int icc_link_create(struct icc_node *node, const int dst_id);
void icc_node_add(struct icc_node *node, struct icc_provider *provider);
@@ -152,6 +153,12 @@ static inline void icc_node_destroy(int id)
{
}
static inline int icc_node_set_name(struct icc_node *node, const struct icc_provider *provider,
const char *name)
{
return -EOPNOTSUPP;
}
static inline int icc_link_nodes(struct icc_node *src_node, struct icc_node **dst_node)
{
return -EOPNOTSUPP;