Linux-PM Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v5 0/3] interconnect: Support Samsung Exynos use-case
       [not found] <CGME20200521122848eucas1p27ce74486ea2044cb0b942b2619426e21@eucas1p2.samsung.com>
@ 2020-05-21 12:28 ` Sylwester Nawrocki
       [not found]   ` <CGME20200521122854eucas1p2800cc56585f6f18512de270469cde59c@eucas1p2.samsung.com>
                     ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Sylwester Nawrocki @ 2020-05-21 12:28 UTC (permalink / raw)
  To: georgi.djakov
  Cc: a.swigon, cw00.choi, b.zolnierkie, m.szyprowski, krzk, linux-pm,
	linux-kernel, linux-samsung-soc, Sylwester Nawrocki

Hi All,

This is a continuation of Artur's efforts to add interconnect and PM QoS
support for Exynos SoCs. Previous version of the patch set can be found 
at [1]. The only change comparing to v4 is an addition of missing 'static
inline' qualifier to the of_icc_get_from_provider() function stub, i.e.
addresing Georgi's review comments.

The patches have been tested on Odroid U3 (Exynos4412 SoC). 

Below is detailed description of the patch set as in v3.

                              ---------
Previously posted as a part of a larger RFC [2].

The Exynos SoC family relies on the devfreq driver for frequency
scaling. However, a means for programmatically enforcing QoS constraints
(i.e., minimum frequency) for devices is required. A solution which uses 
the interconnect framework to ensure QoS is currently being developed [2].

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 an 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 [2]).
* 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 we will not cause regressions in any existing driver.

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

[1] https://lore.kernel.org/linux-pm/20200116144202.12116-4-a.swigon@samsung.com/T
[2] https://patchwork.kernel.org/patch/11305287/

--
Regards,
Sylwester


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(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v5 1/3] interconnect: Export of_icc_get_from_provider()
       [not found]   ` <CGME20200521122854eucas1p2800cc56585f6f18512de270469cde59c@eucas1p2.samsung.com>
@ 2020-05-21 12:28     ` Sylwester Nawrocki
  0 siblings, 0 replies; 7+ messages in thread
From: Sylwester Nawrocki @ 2020-05-21 12:28 UTC (permalink / raw)
  To: georgi.djakov
  Cc: a.swigon, cw00.choi, b.zolnierkie, m.szyprowski, krzk, linux-pm,
	linux-kernel, linux-samsung-soc, Sylwester Nawrocki

From: Artur Świgoń <a.swigon@samsung.com>

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

Signed-off-by: Artur Świgoń <a.swigon@samsung.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
---
 drivers/interconnect/core.c           | 3 ++-
 include/linux/interconnect-provider.h | 6 ++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c
index ece2a57..1b51e0c 100644
--- a/drivers/interconnect/core.c
+++ b/drivers/interconnect/core.c
@@ -334,7 +334,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;
@@ -353,6 +353,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);
 
 static void devm_icc_release(struct device *dev, void *res)
 {
diff --git a/include/linux/interconnect-provider.h b/include/linux/interconnect-provider.h
index 0c49453..c92be2a 100644
--- a/include/linux/interconnect-provider.h
+++ b/include/linux/interconnect-provider.h
@@ -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;
 }
 
+static inline 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 */
-- 
2.7.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v5 2/3] interconnect: Relax requirement in of_icc_get_from_provider()
       [not found]   ` <CGME20200521122855eucas1p2b8dec2202f9913c80d93aa01842ea83f@eucas1p2.samsung.com>
@ 2020-05-21 12:28     ` Sylwester Nawrocki
  0 siblings, 0 replies; 7+ messages in thread
From: Sylwester Nawrocki @ 2020-05-21 12:28 UTC (permalink / raw)
  To: georgi.djakov
  Cc: a.swigon, cw00.choi, b.zolnierkie, m.szyprowski, krzk, linux-pm,
	linux-kernel, linux-samsung-soc, Sylwester Nawrocki

From: Artur Świgoń <a.swigon@samsung.com>

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.

Signed-off-by: Artur Świgoń <a.swigon@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
---
 drivers/interconnect/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c
index 1b51e0c..6a342ef 100644
--- a/drivers/interconnect/core.c
+++ b/drivers/interconnect/core.c
@@ -339,7 +339,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);
-- 
2.7.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v5 3/3] interconnect: Allow inter-provider pairs to be configured
       [not found]   ` <CGME20200521122857eucas1p1db29d5dd09e801ca22214e94022a951b@eucas1p1.samsung.com>
@ 2020-05-21 12:28     ` Sylwester Nawrocki
  2020-05-27 13:46       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 7+ messages in thread
From: Sylwester Nawrocki @ 2020-05-21 12:28 UTC (permalink / raw)
  To: georgi.djakov
  Cc: a.swigon, cw00.choi, b.zolnierkie, m.szyprowski, krzk, linux-pm,
	linux-kernel, linux-samsung-soc, Sylwester Nawrocki

From: Artur Świgoń <a.swigon@samsung.com>

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.

Signed-off-by: Artur Świgoń <a.swigon@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
---
 drivers/interconnect/core.c           | 11 +++++------
 include/linux/interconnect-provider.h |  2 ++
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c
index 6a342ef..b549249 100644
--- a/drivers/interconnect/core.c
+++ b/drivers/interconnect/core.c
@@ -263,23 +263,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;
 
diff --git a/include/linux/interconnect-provider.h b/include/linux/interconnect-provider.h
index c92be2a..38701925 100644
--- a/include/linux/interconnect-provider.h
+++ b/include/linux/interconnect-provider.h
@@ -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;
 };
 
-- 
2.7.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v5 3/3] interconnect: Allow inter-provider pairs to be configured
  2020-05-21 12:28     ` [PATCH v5 3/3] interconnect: Allow inter-provider pairs to be configured Sylwester Nawrocki
@ 2020-05-27 13:46       ` Krzysztof Kozlowski
  0 siblings, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2020-05-27 13:46 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: georgi.djakov, a.swigon, cw00.choi, b.zolnierkie, m.szyprowski,
	linux-pm, linux-kernel, linux-samsung-soc

On Thu, May 21, 2020 at 02:28:41PM +0200, Sylwester Nawrocki wrote:
> From: Artur Świgoń <a.swigon@samsung.com>
> 
> 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.
> 
> Signed-off-by: Artur Świgoń <a.swigon@samsung.com>
> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> ---
>  drivers/interconnect/core.c           | 11 +++++------
>  include/linux/interconnect-provider.h |  2 ++
>  2 files changed, 7 insertions(+), 6 deletions(-)

Acked-by: Krzysztof Kozlowski <krzk@kernel.org>

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v5 0/3] interconnect: Support Samsung Exynos use-case
  2020-05-21 12:28 ` [PATCH v5 0/3] interconnect: Support Samsung Exynos use-case Sylwester Nawrocki
                     ` (2 preceding siblings ...)
       [not found]   ` <CGME20200521122857eucas1p1db29d5dd09e801ca22214e94022a951b@eucas1p1.samsung.com>
@ 2020-05-27 13:49   ` Georgi Djakov
  2020-05-27 14:41     ` Sylwester Nawrocki
  3 siblings, 1 reply; 7+ messages in thread
From: Georgi Djakov @ 2020-05-27 13:49 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: a.swigon, cw00.choi, b.zolnierkie, m.szyprowski, krzk, linux-pm,
	linux-kernel, linux-samsung-soc

Hi Sylwester,

Thank you for re-sending these!

On 5/21/20 15:28, Sylwester Nawrocki wrote:
> Hi All,
> 
> This is a continuation of Artur's efforts to add interconnect and PM QoS
> support for Exynos SoCs. Previous version of the patch set can be found 
> at [1]. The only change comparing to v4 is an addition of missing 'static
> inline' qualifier to the of_icc_get_from_provider() function stub, i.e.
> addresing Georgi's review comments.
> 
> The patches have been tested on Odroid U3 (Exynos4412 SoC). 
> 
> Below is detailed description of the patch set as in v3.
> 
>                               ---------
> Previously posted as a part of a larger RFC [2].

The patches look good to me and i am planning to apply them for v5.9,
but what happened to the devfreq patches, which will make use of this?
Are they posted separately?

Thanks,
Georgi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v5 0/3] interconnect: Support Samsung Exynos use-case
  2020-05-27 13:49   ` [PATCH v5 0/3] interconnect: Support Samsung Exynos use-case Georgi Djakov
@ 2020-05-27 14:41     ` Sylwester Nawrocki
  0 siblings, 0 replies; 7+ messages in thread
From: Sylwester Nawrocki @ 2020-05-27 14:41 UTC (permalink / raw)
  To: Georgi Djakov
  Cc: a.swigon, cw00.choi, b.zolnierkie, m.szyprowski, krzk, linux-pm,
	linux-kernel, linux-samsung-soc

Hi Georgi,

On 27.05.2020 15:49, Georgi Djakov wrote:
> Hi Sylwester,
> 
> Thank you for re-sending these!
> 
> On 5/21/20 15:28, Sylwester Nawrocki wrote:
>> Hi All,
>>
>> This is a continuation of Artur's efforts to add interconnect and PM QoS
>> support for Exynos SoCs. Previous version of the patch set can be found 
>> at [1]. The only change comparing to v4 is an addition of missing 'static
>> inline' qualifier to the of_icc_get_from_provider() function stub, i.e.
>> addresing Georgi's review comments.
>>
>> The patches have been tested on Odroid U3 (Exynos4412 SoC). 
>>
>> Below is detailed description of the patch set as in v4.
>>
>>                               ---------
>> Previously posted as a part of a larger RFC [2].
> 
> The patches look good to me and i am planning to apply them for v5.9,
> but what happened to the devfreq patches, which will make use of this?
> Are they posted separately?

Thank you, remaining patches are not posted yet. I'm still working on them
and should be posting them this week. They are almost ready and I'm doing
some more tests. 

I have converted the code that was previously added to the exynos-bus driver
to a separate interconnect driver as you suggested. In the exynos devfreq 
only a child platform device is registered for the interconnect driver,
which then registers a PM QoS request for its parent device. After rebasing 
today I noticed something very similar has been recently added in the devfreq
subsystem for the imx platforms. Let's discuss further after I actually post 
the patches.

--
Regards,
Sylwester

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, back to index

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20200521122848eucas1p27ce74486ea2044cb0b942b2619426e21@eucas1p2.samsung.com>
2020-05-21 12:28 ` [PATCH v5 0/3] interconnect: Support Samsung Exynos use-case Sylwester Nawrocki
     [not found]   ` <CGME20200521122854eucas1p2800cc56585f6f18512de270469cde59c@eucas1p2.samsung.com>
2020-05-21 12:28     ` [PATCH v5 1/3] interconnect: Export of_icc_get_from_provider() Sylwester Nawrocki
     [not found]   ` <CGME20200521122855eucas1p2b8dec2202f9913c80d93aa01842ea83f@eucas1p2.samsung.com>
2020-05-21 12:28     ` [PATCH v5 2/3] interconnect: Relax requirement in of_icc_get_from_provider() Sylwester Nawrocki
     [not found]   ` <CGME20200521122857eucas1p1db29d5dd09e801ca22214e94022a951b@eucas1p1.samsung.com>
2020-05-21 12:28     ` [PATCH v5 3/3] interconnect: Allow inter-provider pairs to be configured Sylwester Nawrocki
2020-05-27 13:46       ` Krzysztof Kozlowski
2020-05-27 13:49   ` [PATCH v5 0/3] interconnect: Support Samsung Exynos use-case Georgi Djakov
2020-05-27 14:41     ` Sylwester Nawrocki

Linux-PM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-pm/0 linux-pm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-pm linux-pm/ https://lore.kernel.org/linux-pm \
		linux-pm@vger.kernel.org
	public-inbox-index linux-pm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-pm


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git