2020-05-21 12:30:41

by Sylwester Nawrocki

[permalink] [raw]
Subject: [PATCH v5 0/3] interconnect: Support Samsung Exynos use-case

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/[email protected]/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


2020-05-21 12:30:47

by Sylwester Nawrocki

[permalink] [raw]
Subject: [PATCH v5 1/3] interconnect: Export of_icc_get_from_provider()

From: Artur Świgoń <[email protected]>

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

Signed-off-by: Artur Świgoń <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: Chanwoo Choi <[email protected]>
Signed-off-by: Sylwester Nawrocki <[email protected]>
---
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

2020-05-21 12:30:50

by Sylwester Nawrocki

[permalink] [raw]
Subject: [PATCH v5 2/3] interconnect: Relax requirement in of_icc_get_from_provider()

From: Artur Świgoń <[email protected]>

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ń <[email protected]>
Acked-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: Chanwoo Choi <[email protected]>
Signed-off-by: Sylwester Nawrocki <[email protected]>
---
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

2020-05-21 12:31:02

by Sylwester Nawrocki

[permalink] [raw]
Subject: [PATCH v5 3/3] interconnect: Allow inter-provider pairs to be configured

From: Artur Świgoń <[email protected]>

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ń <[email protected]>
Signed-off-by: Sylwester Nawrocki <[email protected]>
---
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

2020-05-27 17:49:42

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v5 3/3] interconnect: Allow inter-provider pairs to be configured

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

Acked-by: Krzysztof Kozlowski <[email protected]>

Best regards,
Krzysztof

2020-05-27 17:58:42

by Georgi Djakov

[permalink] [raw]
Subject: Re: [PATCH v5 0/3] interconnect: Support Samsung Exynos use-case

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

2020-05-27 18:47:14

by Sylwester Nawrocki

[permalink] [raw]
Subject: Re: [PATCH v5 0/3] interconnect: Support Samsung Exynos use-case

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