Skip to contentSkip to conversation

interconnect: Support Samsung Exynos use-case

PATCH In review Artur Świgoń 3 participants 10 messages Jan 16, 2020 – Jan 24, 2020 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CGME20200116144241eucas1p226c1d7fc2fad5bd1b9fb6d0fb1b22bff@eucas1p2.samsung.com

#1 lore raw

v4 cover interconnect: Support Samsung Exynos use-case

Previously posted as a part of a larger RFC: [1].

The Exynos SoC family relies on the devfreq driver for frequency scaling. However, a way to programmatically enforce QoS contraints (i.e., minimum frequency) is desired. A solution which uses the interconnect framework to ensure QoS is currently being developed[1].

The exynos-bus hierarchy is composed of multiple buses which are probed separately. Sometimes the DMC is even handled by a different driver. Since the exynos-bus driver is generic and supports multiple differing bus hierarchies, IDs for nodes (i.e. buses) are assigned dynamically. Due to the unspecified relative probing order, every bus registers its own interconnect provider.

Rationale for each patch in this series:
* Patch 01 (exporting of_icc_get_from_provider()) makes it easy to retrieve the parent node from the DT (cf. patch 05 in [1]).
* Patch 02 (allowing #interconnect-cells = <0>) allows to remove dummy node IDs from the DT.
* Patch 03 (allowing inter-provider node pairs) is necessary to make such multi-provider hierarchy work. A new approach implemented in v3 ensures not to break any existing drivers.

---
Changes since v3 (to patches in this series):
* Improve commit messages.

---
Artur Świgoń
Samsung R&D Institute Poland
Samsung Electronics

---
References:
[1] https://patchwork.kernel.org/patch/11305287/

Artur Świgoń (3):
interconnect: Export of_icc_get_from_provider()
interconnect: Relax requirement in of_icc_get_from_provider()
interconnect: Allow inter-provider pairs to be configured

 drivers/interconnect/core.c           | 16 ++++++++--------
 include/linux/interconnect-provider.h |  8 ++++++++
 2 files changed, 16 insertions(+), 8 deletions(-)
Signature · 1 line
2.17.1
#2 lore raw

PATCH v4 1/3 interconnect: Export of_icc_get_from_provider()

This patch makes the above function public (for use in exynos-bus devfreq driver).

---
 drivers/interconnect/core.c           | 3 ++-
 include/linux/interconnect-provider.h | 6 ++++++
 2 files changed, 8 insertions(+), 1 deletion(-)
drivers/interconnect/core.c +2 -1
index f277e467156f..0be1764d3528 100644
@@ -330,7 +330,7 @@ EXPORT_SYMBOL_GPL(of_icc_xlate_onecell);
  * Returns a valid pointer to struct icc_node on success or ERR_PTR()
  * on failure.
  */
-static struct icc_node *of_icc_get_from_provider(struct of_phandle_args *spec)
+struct icc_node *of_icc_get_from_provider(struct of_phandle_args *spec)
 {
 	struct icc_node *node = ERR_PTR(-EPROBE_DEFER);
 	struct icc_provider *provider;
@@ -349,6 +349,7 @@ static struct icc_node *of_icc_get_from_provider(struct of_phandle_args *spec)
 
 	return node;
 }
+EXPORT_SYMBOL_GPL(of_icc_get_from_provider);
 
 /**
  * of_icc_get() - get a path handle from a DT node based on name
include/linux/interconnect-provider.h +6 -0
index 0c494534b4d3..cc965b8fab53 100644
@@ -103,6 +103,7 @@ void icc_node_del(struct icc_node *node);
 int icc_nodes_remove(struct icc_provider *provider);
 int icc_provider_add(struct icc_provider *provider);
 int icc_provider_del(struct icc_provider *provider);
+struct icc_node *of_icc_get_from_provider(struct of_phandle_args *spec);
 
 #else
 
@@ -154,6 +155,11 @@ static inline int icc_provider_del(struct icc_provider *provider)
 	return -ENOTSUPP;
 }
 
+struct icc_node *of_icc_get_from_provider(struct of_phandle_args *spec)
+{
+	return ERR_PTR(-ENOTSUPP);
+}
+
 #endif /* CONFIG_INTERCONNECT */
 
 #endif /* __LINUX_INTERCONNECT_PROVIDER_H */
Signature · 1 line
2.17.1
#3 lore raw

Re: [PATCH v4 1/3] interconnect: Export of_icc_get_from_provider()

Hi Artur,

Quoted 45 lines · Artur Świgoń

This patch makes the above function public (for use in exynos-bus devfreq driver).

---
 drivers/interconnect/core.c           | 3 ++-
 include/linux/interconnect-provider.h | 6 ++++++
 2 files changed, 8 insertions(+), 1 deletion(-)
drivers/interconnect/core.c +2 -1
index f277e467156f..0be1764d3528 100644
@@ -330,7 +330,7 @@ EXPORT_SYMBOL_GPL(of_icc_xlate_onecell);
  * Returns a valid pointer to struct icc_node on success or ERR_PTR()
  * on failure.
  */
-static struct icc_node *of_icc_get_from_provider(struct of_phandle_args *spec)
+struct icc_node *of_icc_get_from_provider(struct of_phandle_args *spec)
 {
 	struct icc_node *node = ERR_PTR(-EPROBE_DEFER);
 	struct icc_provider *provider;
@@ -349,6 +349,7 @@ static struct icc_node *of_icc_get_from_provider(struct of_phandle_args *spec)
 
 	return node;
 }
+EXPORT_SYMBOL_GPL(of_icc_get_from_provider);
 
 /**
  * of_icc_get() - get a path handle from a DT node based on name
include/linux/interconnect-provider.h +1 -0
index 0c494534b4d3..cc965b8fab53 100644
@@ -103,6 +103,7 @@ void icc_node_del(struct icc_node *node);
 int icc_nodes_remove(struct icc_provider *provider);
 int icc_provider_add(struct icc_provider *provider);
 int icc_provider_del(struct icc_provider *provider);
+struct icc_node *of_icc_get_from_provider(struct of_phandle_args *spec);
 
 #else
 

include/linux/interconnect-provider.h static inline int icc_provider_del(struct icc_provider *provider) · line 158

Quoted 4 lines
include/linux/interconnect-provider.h +1 -0
@@ -154,6 +155,11 @@ static inline int icc_provider_del(struct icc_provider *provider)
 	return -ENOTSUPP;
 }
 
+struct icc_node *of_icc_get_from_provider(struct of_phandle_args *spec)

Please make this static inline, as we may see a warning in some configurations:

In file included from drivers/devfreq/exynos-bus.c:18:
./include/linux/interconnect-provider.h:160:18: warning: no previous prototype for ‘of_icc_get_from_provider’ [-Wmissing-prototypes]
160 | struct icc_node *of_icc_get_from_provider(struct of_phandle_args *spec)

      |                  ^~~~~~~~~~~~~~~~~~~~~~~~

include/linux/interconnect-provider.h static inline int icc_provider_del(struct icc_provider *provider) · line 165

Quoted 8 lines
include/linux/interconnect-provider.h +4 -0
+{
+	return ERR_PTR(-ENOTSUPP);
+}
+
 #endif /* CONFIG_INTERCONNECT */
 
 #endif /* __LINUX_INTERCONNECT_PROVIDER_H */

Thanks,
Georgi

#4 lore raw

Re: [PATCH v4 1/3] interconnect: Export of_icc_get_from_provider()

Hi,

Quoted 47 lines · Georgi Djakov

Hi Artur,

Quoted 44 lines · Artur Świgoń

This patch makes the above function public (for use in exynos-bus devfreq driver).

---
 drivers/interconnect/core.c           | 3 ++-
 include/linux/interconnect-provider.h | 6 ++++++
 2 files changed, 8 insertions(+), 1 deletion(-)
drivers/interconnect/core.c +2 -1
index f277e467156f..0be1764d3528 100644
@@ -330,7 +330,7 @@ EXPORT_SYMBOL_GPL(of_icc_xlate_onecell);
  * Returns a valid pointer to struct icc_node on success or ERR_PTR()
  * on failure.
  */
-static struct icc_node *of_icc_get_from_provider(struct of_phandle_args *spec)
+struct icc_node *of_icc_get_from_provider(struct of_phandle_args *spec)
 {
 	struct icc_node *node = ERR_PTR(-EPROBE_DEFER);
 	struct icc_provider *provider;
@@ -349,6 +349,7 @@ static struct icc_node *of_icc_get_from_provider(struct of_phandle_args *spec)
 
 	return node;
 }
+EXPORT_SYMBOL_GPL(of_icc_get_from_provider);
 
 /**
  * of_icc_get() - get a path handle from a DT node based on name
include/linux/interconnect-provider.h +1 -0
index 0c494534b4d3..cc965b8fab53 100644
@@ -103,6 +103,7 @@ void icc_node_del(struct icc_node *node);
 int icc_nodes_remove(struct icc_provider *provider);
 int icc_provider_add(struct icc_provider *provider);
 int icc_provider_del(struct icc_provider *provider);
+struct icc_node *of_icc_get_from_provider(struct of_phandle_args *spec);
 
 #else
 
Quoted 7 lines

include/linux/interconnect-provider.h static inline int icc_provider_del(struct icc_provider *provider) · line 158

Quoted 5 lines
include/linux/interconnect-provider.h +1 -0
@@ -154,6 +155,11 @@ static inline int icc_provider_del(struct icc_provider *provider)
 	return -ENOTSUPP;
 }
 
+struct icc_node *of_icc_get_from_provider(struct of_phandle_args *spec)

Please make this static inline, as we may see a warning in some configurations:

Sure, will fix.

Quoted 14 lines

In file included from drivers/devfreq/exynos-bus.c:18:
./include/linux/interconnect-provider.h:160:18: warning: no previous prototype for ‘of_icc_get_from_provider’ [-Wmissing-prototypes]
160 | struct icc_node *of_icc_get_from_provider(struct of_phandle_args *spec)

      |                  ^~~~~~~~~~~~~~~~~~~~~~~~
Quoted 8 lines
include/linux/interconnect-provider.h +4 -0
+{
+	return ERR_PTR(-ENOTSUPP);
+}
+
 #endif /* CONFIG_INTERCONNECT */
 
 #endif /* __LINUX_INTERCONNECT_PROVIDER_H */
Signature · 3 lines
Artur Świgoń
Samsung R&D Institute Poland
Samsung Electronics
#5 lore raw

PATCH v4 2/3 interconnect: Relax requirement in of_icc_get_from_provider()

In reply to Artur Świgoń

This patch relaxes the condition in of_icc_get_from_provider() so that it is no longer required to set '#interconnect-cells' to <1> in the DT, and therefore it is not required to supply dummy node IDs in the 'interconnects' property when node IDs are dynamically generated rather than hardcoded (statically allocated).

In case of the devfreq driver for exynos-bus, node IDs are dynamically allocated and '#interconnect-cells' is always zero.

---
 drivers/interconnect/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/interconnect/core.c +1 -1
index 0be1764d3528..5ea270af5ff4 100644
@@ -335,7 +335,7 @@ struct icc_node *of_icc_get_from_provider(struct of_phandle_args *spec)
 	struct icc_node *node = ERR_PTR(-EPROBE_DEFER);
 	struct icc_provider *provider;
 
-	if (!spec || spec->args_count != 1)
+	if (!spec)
 		return ERR_PTR(-EINVAL);
 
 	mutex_lock(&icc_lock);
Signature · 1 line
2.17.1
Reviewed-by on v4 2/3
#6 lore raw

Re: [PATCH v4 2/3] interconnect: Relax requirement in of_icc_get_from_provider()

Hi,

Quoted 21 lines · Artur Świgoń

This patch relaxes the condition in of_icc_get_from_provider() so that it is no longer required to set '#interconnect-cells' to <1> in the DT, and therefore it is not required to supply dummy node IDs in the 'interconnects' property when node IDs are dynamically generated rather than hardcoded (statically allocated).

In case of the devfreq driver for exynos-bus, node IDs are dynamically allocated and '#interconnect-cells' is always zero.

---
 drivers/interconnect/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/interconnect/core.c +0 -0
index 0be1764d3528..5ea270af5ff4 100644

drivers/interconnect/core.c struct icc_node *of_icc_get_from_provider(struct of_phandle_args *spec) · line 341

Quoted 8 lines
drivers/interconnect/core.c +1 -1
@@ -335,7 +335,7 @@ struct icc_node *of_icc_get_from_provider(struct of_phandle_args *spec)
 	struct icc_node *node = ERR_PTR(-EPROBE_DEFER);
 	struct icc_provider *provider;
 
-	if (!spec || spec->args_count != 1)
+	if (!spec)
 		return ERR_PTR(-EINVAL);
 
 	mutex_lock(&icc_lock);
Signature · 3 lines
Best Regards,
Chanwoo Choi
Samsung Electronics
#7 lore raw

PATCH v4 3/3 interconnect: Allow inter-provider pairs to be configured

In reply to Artur Świgoń

This patch adds support for a new boolean 'inter_set' field in struct icc_provider. Setting it to 'true' enables calling '->set' for inter-provider node pairs. All existing users of the interconnect framework allocate this structure with kzalloc, and are therefore unaffected by this change.

This makes it easier for hierarchies like exynos-bus, where every bus is probed separately and registers a separate interconnect provider, to model constraints between buses (or between buses and DMC, handled by two separate drivers in case of Exynos5422).

---
 drivers/interconnect/core.c           | 11 +++++------
 include/linux/interconnect-provider.h |  2 ++
 2 files changed, 7 insertions(+), 6 deletions(-)
drivers/interconnect/core.c +5 -6
index 5ea270af5ff4..caa9e35f06a3 100644
@@ -259,23 +259,22 @@ static int aggregate_requests(struct icc_node *node)
 static int apply_constraints(struct icc_path *path)
 {
 	struct icc_node *next, *prev = NULL;
+	struct icc_provider *p;
 	int ret = -EINVAL;
 	int i;
 
 	for (i = 0; i < path->num_nodes; i++) {
 		next = path->reqs[i].node;
+		p = next->provider;
 
-		/*
-		 * Both endpoints should be valid master-slave pairs of the
-		 * same interconnect provider that will be configured.
-		 */
-		if (!prev || next->provider != prev->provider) {
+		/* both endpoints should be valid master-slave pairs */
+		if (!prev || (p != prev->provider && !p->inter_set)) {
 			prev = next;
 			continue;
 		}
 
 		/* set the constraints */
-		ret = next->provider->set(prev, next);
+		ret = p->set(prev, next);
 		if (ret)
 			goto out;
 
include/linux/interconnect-provider.h +2 -0
index cc965b8fab53..b6ae0ee686c5 100644
@@ -41,6 +41,7 @@ struct icc_node *of_icc_xlate_onecell(struct of_phandle_args *spec,
  * @xlate: provider-specific callback for mapping nodes from phandle arguments
  * @dev: the device this interconnect provider belongs to
  * @users: count of active users
+ * @inter_set: whether inter-provider pairs will be configured with @set
  * @data: pointer to private data
  */
 struct icc_provider {
@@ -53,6 +54,7 @@ struct icc_provider {
 	struct icc_node* (*xlate)(struct of_phandle_args *spec, void *data);
 	struct device		*dev;
 	int			users;
+	bool			inter_set;
 	void			*data;
 };
 
Signature · 1 line
2.17.1
#8 lore raw
In reply to Artur Świgoń

Hi Artur,

I'm concerned about that make it the separate series without use-case like exynos-bus, exynos-drm.
If this series is applied to v5.6, it doesn't make the problem and the patches for exynos-bus/exynos-drm will be reviewed and then merged on later kernel version.

But, if not, the interconnect, exynos-bus and exynos-drm patches should be merged into the same kernel version, it must require the immutable branch among interconnect, devfreq and exynos-drm. I think that you need to consider it between different subsystems.

Regards,
Chanwoo Choi

Quoted 45 lines · Artur Świgoń

Previously posted as a part of a larger RFC: [1].

The Exynos SoC family relies on the devfreq driver for frequency scaling. However, a way to programmatically enforce QoS contraints (i.e., minimum frequency) is desired. A solution which uses the interconnect framework to ensure QoS is currently being developed[1].

The exynos-bus hierarchy is composed of multiple buses which are probed separately. Sometimes the DMC is even handled by a different driver. Since the exynos-bus driver is generic and supports multiple differing bus hierarchies, IDs for nodes (i.e. buses) are assigned dynamically. Due to the unspecified relative probing order, every bus registers its own interconnect provider.

Rationale for each patch in this series:
* Patch 01 (exporting of_icc_get_from_provider()) makes it easy to retrieve the parent node from the DT (cf. patch 05 in [1]).
* Patch 02 (allowing #interconnect-cells = <0>) allows to remove dummy node IDs from the DT.
* Patch 03 (allowing inter-provider node pairs) is necessary to make such multi-provider hierarchy work. A new approach implemented in v3 ensures not to break any existing drivers.

---
Changes since v3 (to patches in this series):
* Improve commit messages.

---
Artur Świgoń
Samsung R&D Institute Poland
Samsung Electronics

---
References:
[1] https://patchwork.kernel.org/patch/11305287/

Artur Świgoń (3):
interconnect: Export of_icc_get_from_provider()
interconnect: Relax requirement in of_icc_get_from_provider()
interconnect: Allow inter-provider pairs to be configured

 drivers/interconnect/core.c           | 16 ++++++++--------
 include/linux/interconnect-provider.h |  8 ++++++++
 2 files changed, 16 insertions(+), 8 deletions(-)
Signature · 3 lines
Best Regards,
Chanwoo Choi
Samsung Electronics
#9 lore raw

Hi Chanwoo,

Quoted 8 lines · Chanwoo Choi

Hi Artur,

I'm concerned about that make it the separate series without use-case like exynos-bus, exynos-drm.
If this series is applied to v5.6, it doesn't make the problem and the patches for exynos-bus/exynos-drm will be reviewed and then merged on later kernel version.

Quoted 5 lines

But, if not, the interconnect, exynos-bus and exynos-drm patches should be merged into the same kernel version, it must require the immutable branch among interconnect, devfreq and exynos-drm. I think that you need to consider it between different subsystems.

Thanks for the feedback. Due to the fact that the RFC depends on the proposed changes to the interconnect framework, I need to ensure that these three patches come first.

If there is any disagreement over any of these three patches, the rest of the RFC might need to be modified. In such case, I will update the RFC and send the rest of v4 patches (for exynos-bus, exynos-mixer, and probably also exynos5-dmc).

Quoted 48 lines · Artur Świgoń
Quoted 45 lines

Previously posted as a part of a larger RFC: [1].

The Exynos SoC family relies on the devfreq driver for frequency scaling. However, a way to programmatically enforce QoS contraints (i.e., minimum frequency) is desired. A solution which uses the interconnect framework to ensure QoS is currently being developed[1].

The exynos-bus hierarchy is composed of multiple buses which are probed separately. Sometimes the DMC is even handled by a different driver. Since the exynos-bus driver is generic and supports multiple differing bus hierarchies, IDs for nodes (i.e. buses) are assigned dynamically. Due to the unspecified relative probing order, every bus registers its own interconnect provider.

Rationale for each patch in this series:
* Patch 01 (exporting of_icc_get_from_provider()) makes it easy to retrieve the parent node from the DT (cf. patch 05 in [1]).
* Patch 02 (allowing #interconnect-cells = <0>) allows to remove dummy node IDs from the DT.
* Patch 03 (allowing inter-provider node pairs) is necessary to make such multi-provider hierarchy work. A new approach implemented in v3 ensures not to break any existing drivers.

---
Changes since v3 (to patches in this series):
* Improve commit messages.

---
Artur Świgoń
Samsung R&D Institute Poland
Samsung Electronics

---
References:
[1] https://patchwork.kernel.org/patch/11305287/

Artur Świgoń (3):
interconnect: Export of_icc_get_from_provider()
interconnect: Relax requirement in of_icc_get_from_provider()
interconnect: Allow inter-provider pairs to be configured

 drivers/interconnect/core.c           | 16 ++++++++--------
 include/linux/interconnect-provider.h |  8 ++++++++
 2 files changed, 16 insertions(+), 8 deletions(-)
Signature · 3 lines
Artur Świgoń
Samsung R&D Institute Poland
Samsung Electronics
#10 lore raw

Hi,

Quoted 17 lines · Artur Świgoń

Hi Chanwoo,

Quoted 8 lines · Chanwoo Choi

Hi Artur,

I'm concerned about that make it the separate series without use-case like exynos-bus, exynos-drm.
If this series is applied to v5.6, it doesn't make the problem and the patches for exynos-bus/exynos-drm will be reviewed and then merged on later kernel version.

Quoted 5 lines

But, if not, the interconnect, exynos-bus and exynos-drm patches should be merged into the same kernel version, it must require the immutable branch among interconnect, devfreq and exynos-drm. I think that you need to consider it between different subsystems.

Quoted 8 lines

Thanks for the feedback. Due to the fact that the RFC depends on the proposed changes to the interconnect framework, I need to ensure that these three patches come first.

If there is any disagreement over any of these three patches, the rest of the RFC might need to be modified. In such case, I will update the RFC and send the rest of v4 patches (for exynos-bus, exynos-mixer, and probably also exynos5-dmc).

OK. Thanks.

Quoted 49 lines
Quoted 49 lines · Artur Świgoń
Quoted 45 lines

Previously posted as a part of a larger RFC: [1].

The Exynos SoC family relies on the devfreq driver for frequency scaling. However, a way to programmatically enforce QoS contraints (i.e., minimum frequency) is desired. A solution which uses the interconnect framework to ensure QoS is currently being developed[1].

The exynos-bus hierarchy is composed of multiple buses which are probed separately. Sometimes the DMC is even handled by a different driver. Since the exynos-bus driver is generic and supports multiple differing bus hierarchies, IDs for nodes (i.e. buses) are assigned dynamically. Due to the unspecified relative probing order, every bus registers its own interconnect provider.

Rationale for each patch in this series:
* Patch 01 (exporting of_icc_get_from_provider()) makes it easy to retrieve the parent node from the DT (cf. patch 05 in [1]).
* Patch 02 (allowing #interconnect-cells = <0>) allows to remove dummy node IDs from the DT.
* Patch 03 (allowing inter-provider node pairs) is necessary to make such multi-provider hierarchy work. A new approach implemented in v3 ensures not to break any existing drivers.

---
Changes since v3 (to patches in this series):
* Improve commit messages.

---
Artur Świgoń
Samsung R&D Institute Poland
Samsung Electronics

---
References:
[1] https://protect2.fireeye.com/url?k=c69d0cf5-9b4f1bfc-c69c87ba-0cc47a31cdf8-2143c550c0e479bd&u=https://patchwork.kernel.org/patch/11305287/

Artur Świgoń (3):
interconnect: Export of_icc_get_from_provider()
interconnect: Relax requirement in of_icc_get_from_provider()
interconnect: Allow inter-provider pairs to be configured

 drivers/interconnect/core.c           | 16 ++++++++--------
 include/linux/interconnect-provider.h |  8 ++++++++
 2 files changed, 16 insertions(+), 8 deletions(-)
Signature · 3 lines
Best Regards,
Chanwoo Choi
Samsung Electronics