Skip to contentSkip to conversation

pmdomain: arm: Add the SCMI performance domain

PATCH Applied Ulf Hansson 2 participants 7 messages Sep 19, 2023 – Sep 25, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v4 13/13 pmdomain: arm: Add the SCMI performance domain

To enable support for performance scaling (DVFS) for generic devices with the SCMI performance protocol, let's add an SCMI performance domain. This is being modelled as a genpd provider, with support for performance scaling through genpd's ->set_performance_state() callback.

Note that, this adds the initial support that allows consumer drivers for attached devices, to vote for a new performance state via calling the dev_pm_genpd_set_performance_state(). However, this should be avoided as it's in most cases preferred to use the OPP library to vote for a new OPP instead. The support using the OPP library isn't part of this change, but needs to be implemented from subsequent changes.

---

Sudeep, Cristian,

I decided to just send this a single patch, rather than a new version of the complete series. If you prefer a new version of the series, please let me know.

Kind regards
Uffe

Changes in v4:
- Rebased on v6.6-rc2 to be able to put the files in the new pmdomain subsystem (was genpd in v6.6-rc1).

Changes in v3:
- Move files to drivers/genpd/arm/ and update MAINTAINERS.
- Updated the commit msg header.
- Prevent setting performance level 0.
- Initialize the genpd as always-on.
- Note, the corresponding Kconfigs should be placed in the genpd dir too, but that's better suited on top or through a later-version.

---
 MAINTAINERS                             |   1 +
 drivers/firmware/arm_scmi/Kconfig       |  12 ++
 drivers/pmdomain/Makefile               |   1 +
 drivers/pmdomain/arm/Makefile           |   3 +
 drivers/pmdomain/arm/scmi_perf_domain.c | 150 ++++++++++++++++++++++++
 5 files changed, 167 insertions(+)
 create mode 100644 drivers/pmdomain/arm/Makefile
 create mode 100644 drivers/pmdomain/arm/scmi_perf_domain.c
MAINTAINERS +1 -0
index bf0f54c24f81..aa8c58b16416 100644
@@ -20902,6 +20902,7 @@ F:	drivers/clk/clk-sc[mp]i.c
 F:	drivers/cpufreq/sc[mp]i-cpufreq.c
 F:	drivers/firmware/arm_scmi/
 F:	drivers/firmware/arm_scpi.c
+F:	drivers/pmdomain/arm/
 F:	drivers/powercap/arm_scmi_powercap.c
 F:	drivers/regulator/scmi-regulator.c
 F:	drivers/reset/reset-scmi.c
drivers/firmware/arm_scmi/Kconfig +12 -0
index ea0f5083ac47..706d1264d038 100644
@@ -181,6 +181,18 @@ config ARM_SCMI_POWER_DOMAIN
 	  will be called scmi_pm_domain. Note this may needed early in boot
 	  before rootfs may be available.
 
+config ARM_SCMI_PERF_DOMAIN
+	tristate "SCMI performance domain driver"
+	depends on ARM_SCMI_PROTOCOL || (COMPILE_TEST && OF)
+	default y
+	select PM_GENERIC_DOMAINS if PM
+	help
+	  This enables support for the SCMI performance domains which can be
+	  enabled or disabled via the SCP firmware.
+
+	  This driver can also be built as a module. If so, the module will be
+	  called scmi_perf_domain.
+
 config ARM_SCMI_POWER_CONTROL
 	tristate "SCMI system power control driver"
 	depends on ARM_SCMI_PROTOCOL || (COMPILE_TEST && OF)
drivers/pmdomain/Makefile +1 -0
index 666753676e5c..f0326b27b30b 100644
@@ -2,6 +2,7 @@
 obj-y					+= actions/
 obj-y					+= amlogic/
 obj-y					+= apple/
+obj-y					+= arm/
 obj-y					+= bcm/
 obj-y					+= imx/
 obj-y					+= mediatek/
drivers/pmdomain/arm/Makefile new file +3 -0
new file mode 100644
index 000000000000..7128db96deac
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+obj-$(CONFIG_ARM_SCMI_PERF_DOMAIN) += scmi_perf_domain.o
drivers/pmdomain/arm/scmi_perf_domain.c new file +150 -0

150 lines not on this page · raw message

Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/1 firmware: arm_scmi: Move power-domain driver to the pmdomain dir

To simplify with maintenance let's move the Arm SCMI power-domain driver to the new pmdomain directory.

Cc Ulf Hansson <[email protected]>
Cc Cristian Marussi <[email protected]>

---

Hi Ulf,

If you are happy with this, please cck. I would like to take this along with your scmi_perf_domain change as part of you series.

Regards,
Sudeep

 drivers/firmware/arm_scmi/Makefile                           | 1 -
 drivers/pmdomain/arm/Makefile                                | 1 +
 drivers/{firmware/arm_scmi => pmdomain/arm}/scmi_pm_domain.c | 0
 3 files changed, 1 insertion(+), 1 deletion(-)
 rename drivers/{firmware/arm_scmi => pmdomain/arm}/scmi_pm_domain.c (100%)
drivers/firmware/arm_scmi/Makefile +0 -1
index b31d78fa66cc..a7bc4796519c 100644
@@ -16,7 +16,6 @@ scmi-module-objs := $(scmi-driver-y) $(scmi-protocols-y) $(scmi-transport-y)
 obj-$(CONFIG_ARM_SCMI_PROTOCOL) += scmi-core.o
 obj-$(CONFIG_ARM_SCMI_PROTOCOL) += scmi-module.o
 
-obj-$(CONFIG_ARM_SCMI_POWER_DOMAIN) += scmi_pm_domain.o
 obj-$(CONFIG_ARM_SCMI_POWER_CONTROL) += scmi_power_control.o
 
 ifeq ($(CONFIG_THUMB2_KERNEL)$(CONFIG_CC_IS_CLANG),yy)
drivers/pmdomain/arm/Makefile +1 -0
index 7128db96deac..cfcb1f6cdd90 100644
@@ -1,3 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
 obj-$(CONFIG_ARM_SCMI_PERF_DOMAIN) += scmi_perf_domain.o
+obj-$(CONFIG_ARM_SCMI_POWER_DOMAIN) += scmi_pm_domain.o
drivers/pmdomain/arm/scmi_pm_domain.c renamed from drivers/firmware/arm_scmi/scmi_pm_domain.c +0 -0
similarity index 100%
rename from drivers/firmware/arm_scmi/scmi_pm_domain.c
rename to drivers/pmdomain/arm/scmi_pm_domain.c
Signature · 7 lines
2.42.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author Reviewed-by on v1 1/1
#2 lore raw

Re: [PATCH] firmware: arm_scmi: Move power-domain driver to the pmdomain dir

Quoted 7 lines · Sudeep Holla

To simplify with maintenance let's move the Arm SCMI power-domain driver to the new pmdomain directory.

Cc Ulf Hansson <[email protected]>
Cc Cristian Marussi <[email protected]>

Feel free to take it through your scmi tree!

Note that, we should move the Kconfig options too, but that requires changes that I am carrying in my pmdomain tree. We can either wait until the next cycle or you could send your pull-request to me this time (instead of through arm-soc), then we can fix this as a late minute change. The decision is yours.

Kind regards
Uffe

Quoted 42 lines

---

Hi Ulf,

If you are happy with this, please cck. I would like to take this along with your scmi_perf_domain change as part of you series.

Regards,
Sudeep

 drivers/firmware/arm_scmi/Makefile                           | 1 -
 drivers/pmdomain/arm/Makefile                                | 1 +
 drivers/{firmware/arm_scmi => pmdomain/arm}/scmi_pm_domain.c | 0
 3 files changed, 1 insertion(+), 1 deletion(-)
 rename drivers/{firmware/arm_scmi => pmdomain/arm}/scmi_pm_domain.c (100%)
drivers/firmware/arm_scmi/Makefile +0 -1
index b31d78fa66cc..a7bc4796519c 100644
@@ -16,7 +16,6 @@ scmi-module-objs := $(scmi-driver-y) $(scmi-protocols-y) $(scmi-transport-y)
 obj-$(CONFIG_ARM_SCMI_PROTOCOL) += scmi-core.o
 obj-$(CONFIG_ARM_SCMI_PROTOCOL) += scmi-module.o
 
-obj-$(CONFIG_ARM_SCMI_POWER_DOMAIN) += scmi_pm_domain.o
 obj-$(CONFIG_ARM_SCMI_POWER_CONTROL) += scmi_power_control.o
 
 ifeq ($(CONFIG_THUMB2_KERNEL)$(CONFIG_CC_IS_CLANG),yy)
drivers/pmdomain/arm/Makefile +1 -0
index 7128db96deac..cfcb1f6cdd90 100644
@@ -1,3 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
 obj-$(CONFIG_ARM_SCMI_PERF_DOMAIN) += scmi_perf_domain.o
+obj-$(CONFIG_ARM_SCMI_POWER_DOMAIN) += scmi_pm_domain.o
drivers/pmdomain/arm/scmi_pm_domain.c renamed from drivers/firmware/arm_scmi/scmi_pm_domain.c +0 -1
similarity index 100%
rename from drivers/firmware/arm_scmi/scmi_pm_domain.c
rename to drivers/pmdomain/arm/scmi_pm_domain.c
--
Quoted 2 lines

2.42.0

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#3 lore raw

Re: [PATCH] firmware: arm_scmi: Move power-domain driver to the pmdomain dir

Quoted 11 lines · Ulf Hansson
Quoted 7 lines · Sudeep Holla

To simplify with maintenance let's move the Arm SCMI power-domain driver to the new pmdomain directory.

Cc Ulf Hansson <[email protected]>
Cc Cristian Marussi <[email protected]>
Quoted 8 lines

Feel free to take it through your scmi tree!

Note that, we should move the Kconfig options too, but that requires changes that I am carrying in my pmdomain tree. We can either wait until the next cycle or you could send your pull-request to me this time (instead of through arm-soc), then we can fix this as a late minute change. The decision is yours.

OK. Lets us just delay SCMI Kconfig changes for the next cycle then. I assume you would have other changes merged by then. Or may be as a fix as it would be hardlt 10-15 line with 2 Kconfig options. Let me know if you disagree or have other ideas.

Signature · 7 lines
Regards,
Sudeep

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#4 lore raw

Re: [PATCH] firmware: arm_scmi: Move power-domain driver to the pmdomain dir

Quoted 22 lines · Sudeep Holla
Quoted 11 lines · Ulf Hansson
Quoted 7 lines · Sudeep Holla

To simplify with maintenance let's move the Arm SCMI power-domain driver to the new pmdomain directory.

Cc Ulf Hansson <[email protected]>
Cc Cristian Marussi <[email protected]>
Quoted 8 lines

Feel free to take it through your scmi tree!

Note that, we should move the Kconfig options too, but that requires changes that I am carrying in my pmdomain tree. We can either wait until the next cycle or you could send your pull-request to me this time (instead of through arm-soc), then we can fix this as a late minute change. The decision is yours.

Quoted 4 lines

OK. Lets us just delay SCMI Kconfig changes for the next cycle then. I assume you would have other changes merged by then. Or may be as a fix as it would be hardlt 10-15 line with 2 Kconfig options. Let me know if you disagree or have other ideas.

Let's delay, it's probably easier. Maybe a fix for rc1 would be best.

Kind regards
Uffe

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Applied
#5 lore raw

Re: [PATCH] firmware: arm_scmi: Move power-domain driver to the pmdomain dir

In reply to Sudeep Holla
Quoted 13 lines · Sudeep Holla

To simplify with maintenance let's move the Arm SCMI power-domain driver to the new pmdomain directory.

Cc Ulf Hansson <[email protected]>
Cc Cristian Marussi <[email protected]>

---

Hi Ulf,

If you are happy with this, please cck. I would like to take this along with your scmi_perf_domain change as part of you series.

Quoted 9 lines

Regards,
Sudeep

 drivers/firmware/arm_scmi/Makefile                           | 1 -
 drivers/pmdomain/arm/Makefile                                | 1 +
 drivers/{firmware/arm_scmi => pmdomain/arm}/scmi_pm_domain.c | 0
 3 files changed, 1 insertion(+), 1 deletion(-)
 rename drivers/{firmware/arm_scmi => pmdomain/arm}/scmi_pm_domain.c (100%)

Applied to sudeep.holla/linux (for-next/scmi/updates), thanks!

[1/1] firmware: arm_scmi: firmware: arm_scmi: Move power-domain driver to thepmdomain dir

      https://git.kernel.org/sudeep.holla/c/af78e5c309c4
Signature · 2 lines
Regards,
Sudeep
Applied
#6 lore raw
In reply to Ulf Hansson
Quoted 5 lines · Ulf Hansson

To enable support for performance scaling (DVFS) for generic devices with the SCMI performance protocol, let's add an SCMI performance domain. This is being modelled as a genpd provider, with support for performance scaling through genpd's ->set_performance_state() callback.

Quoted 8 lines

Note that, this adds the initial support that allows consumer drivers for attached devices, to vote for a new performance state via calling the dev_pm_genpd_set_performance_state(). However, this should be avoided as it's in most cases preferred to use the OPP library to vote for a new OPP instead. The support using the OPP library isn't part of this change, but needs to be implemented from subsequent changes.

[...]

Applied to sudeep.holla/linux (for-next/scmi/updates), thanks!

[13/13] pmdomain: arm: Add the SCMI performance domain

        https://git.kernel.org/sudeep.holla/c/2af23ceb8624

--
Regards,
Sudeep