Skip to contentSkip to conversation

Add SiFive power provider driver

PATCH Superseded Nick Hu 3 participants 11 messages Jun 11, 2025 – Jun 16, 2025

Subsystems (5)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Nick Hu

author
#0 lore raw

v2 cover Add SiFive power provider driver

The v1 can be found in [1].

This patch introduces the SiFive power provider driver, which sets up a generic power domain (genpd) provider to coordinate with the RISC-V SBI cpuidle driver.

To enable this coordination, several functions from the cpuidle-riscv-sbi driver are exposed for use by the external power provider. This allows coordination between power domain management and CPU idle states on SiFive platforms.

Changes in v2:
- Add the driver for SiFive TMC, CMC and SMC
- Drop the sifive,feature-level property

Links:
- [1] https://lore.kernel.org/linux-riscv/[email protected]/

Nick Hu (3):
dt-bindings: power: Add SiFive Domain Management controllers
cpuidle: riscv-sbi: Work with the external pmdomain driver
cpuidle: Add SiFive power provider

 .../devicetree/bindings/power/sifive,tmc.yaml |  70 ++++++++++++
 drivers/cpuidle/Kconfig.riscv                 |  11 ++
 drivers/cpuidle/Makefile                      |   1 +
 drivers/cpuidle/cpuidle-riscv-sbi.c           |  17 +--
 drivers/cpuidle/cpuidle-riscv-sbi.h           |  20 ++++
 drivers/cpuidle/cpuidle-sifive-dmc-pd.c       | 102 ++++++++++++++++++
 6 files changed, 215 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/power/sifive,tmc.yaml
 create mode 100644 drivers/cpuidle/cpuidle-riscv-sbi.h
 create mode 100644 drivers/cpuidle/cpuidle-sifive-dmc-pd.c
Signature · 7 lines
2.17.1


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
author
#1 lore raw

PATCH v2 1/3 dt-bindings: power: Add SiFive Domain Management controllers

SiFive Domain Management controller includes the following components
- SiFive Tile Management Controller
- SiFive Cluster Management Controller
- SiFive Core Complex Management Controller

These controllers control the clock and power domain of the corresponding domain.

However, Since we don't have a SoC specific compatible string yet, so add '- {}' for the first entry [1][2].

Links:
- [1] https://lore.kernel.org/lkml/[email protected]/
- [2] https://lore.kernel.org/lkml/CAKddAkAzDGL-7MbroRqQnZzPXOquUMKNuGGppqB-d_XZXbcvBA@mail.gmail.com/T/#t

---
 .../devicetree/bindings/power/sifive,tmc.yaml | 70 +++++++++++++++++++
 1 file changed, 70 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/sifive,tmc.yaml
Documentation/devicetree/bindings/power/sifive,tmc.yaml new file +70 -0
new file mode 100644
index 000000000000..4567d51148e1
@@ -0,0 +1,70 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/sifive,tmc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: SiFive Domain Management Controller
+
+maintainers:
+  - Cyan Yang <[email protected]>
+  - Nick Hu <[email protected]>
+  - Samuel Holland <[email protected]>
+
+description: |
+  SiFive Domain Management Controllers includes the following components
+    - Tile Management Controller (TMC)
+    - Cluster Management Controller (CMC)
+    - Subsystem Management Controller (SMC)
+  These controllers manage both the clock and power domains of the
+  associated components. They support the SiFive Quiet Interface Protocol
+  (SQIP) starting from Version 1. The control method differs from Version
+  0, making them incompatible.
+
+allOf:
+  - $ref: power-domain.yaml#
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - {} # Leave a empty for future SoC specific compatible string
+          - const: sifive,cmc3
+          - const: sifive,cmc2
+      - items:
+          - {} # Leave a empty for future SoC specific compatible string
+          - const: sifive,cmc2
+      - items:
+          - {} # Leave a empty for future SoC specific compatible string
+          - const: sifive,smc0
+      - items:
+          - {} # Leave a empty for future SoC specific compatible string
+          - const: sifive,smc1
+      - items:
+          - {} # Leave a empty for future SoC specific compatible string
+          - const: sifive,smc3
+          - const: sifive,smc1
+      - items:
+          - {} # Leave a empty for future SoC specific compatible string
+          - const: sifive,tmc0
+      - items:
+          - {} # Leave a empty for future SoC specific compatible string
+          - const: sifive,tmc1
+      - items:
+          - {} # Leave a empty for future SoC specific compatible string
+          - const: sifive,tmc3
+          - const: sifive,tmc1
+
+  reg:
+    maxItems: 1
+
+  "#power-domain-cells":
+    const: 0
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+# The example will be added once the SoC specific compatible string is available
Signature · 1 line
2.17.1
#2 lore raw

Re: [PATCH v2 1/3] dt-bindings: power: Add SiFive Domain Management controllers

Quoted 10 lines · Nick Hu

SiFive Domain Management controller includes the following components
- SiFive Tile Management Controller
- SiFive Cluster Management Controller
- SiFive Core Complex Management Controller

These controllers control the clock and power domain of the corresponding domain.

However, Since we don't have a SoC specific compatible string yet, so add '- {}' for the first entry [1][2].

But you must have Soc specific compatible strings. See previous discussion.

Best regards,
Krzysztof

author
#3 lore raw

Re: [PATCH v2 1/3] dt-bindings: power: Add SiFive Domain Management controllers

Quoted 7 lines · Krzysztof Kozlowski
Quoted 5 lines · Nick Hu

SiFive Domain Management controller includes the following components
- SiFive Tile Management Controller
- SiFive Cluster Management Controller
- SiFive Core Complex Management Controller

Quoted 9 lines
Quoted 5 lines

These controllers control the clock and power domain of the corresponding domain.

However, Since we don't have a SoC specific compatible string yet, so add '- {}' for the first entry [1][2].

But you must have Soc specific compatible strings. See previous discussion.

Maybe I'm missing something, but since we don't have a SoC-specific compatible string yet, I thought we agreed to include a - {} as the first entry, along with an
explanation in both the commit message and comments [1].

Links:
- [1] https://lore.kernel.org/linux-riscv/[email protected]/

Quoted 2 lines

Best regards,
Krzysztof

#4 lore raw

Re: [PATCH v2 1/3] dt-bindings: power: Add SiFive Domain Management controllers

Quoted 15 lines · Nick Hu
Quoted 14 lines · Krzysztof Kozlowski
Quoted 10 lines · Nick Hu

SiFive Domain Management controller includes the following components
- SiFive Tile Management Controller
- SiFive Cluster Management Controller
- SiFive Core Complex Management Controller

These controllers control the clock and power domain of the corresponding domain.

However, Since we don't have a SoC specific compatible string yet, so add '- {}' for the first entry [1][2].

Quoted 6 lines
Quoted 2 lines

But you must have Soc specific compatible strings. See previous discussion.

Maybe I'm missing something, but since we don't have a SoC-specific compatible string yet, I thought we agreed to include a - {} as the first entry, along with an
explanation in both the commit message and comments [1].

But your commit msg does not explain. You need to explain why you do not have SoC specific compatibles. Saying "I do not have a SoC specific compatible" is not an argument explaining why you do not have SoC specific compatible.

Best regards,
Krzysztof

author
#5 lore raw

Re: [PATCH v2 1/3] dt-bindings: power: Add SiFive Domain Management controllers

Quoted 19 lines · Krzysztof Kozlowski
Quoted 17 lines · Nick Hu
Quoted 16 lines · Krzysztof Kozlowski
Quoted 10 lines · Nick Hu

SiFive Domain Management controller includes the following components
- SiFive Tile Management Controller
- SiFive Cluster Management Controller
- SiFive Core Complex Management Controller

These controllers control the clock and power domain of the corresponding domain.

However, Since we don't have a SoC specific compatible string yet, so add '- {}' for the first entry [1][2].

But you must have Soc specific compatible strings. See previous discussion.

Quoted 9 lines
Quoted 4 lines

Maybe I'm missing something, but since we don't have a SoC-specific compatible string yet, I thought we agreed to include a - {} as the first entry, along with an
explanation in both the commit message and comments [1].

But your commit msg does not explain. You need to explain why you do not have SoC specific compatibles. Saying "I do not have a SoC specific compatible" is not an argument explaining why you do not have SoC specific compatible.

You're right. How about updating the commit msg to "When the SoCs are ready, we will add the SoC compatible string at that time" ?

Best regards,
Nick

author
#6 lore raw

PATCH v2 2/3 cpuidle: riscv-sbi: Work with the external pmdomain driver

In reply to Nick Hu

To work with the external pmdomain driver, exposing the sbi_cpuidle_pd_power_off and sbi_dt_parse_state_node so the external pmdomain driver can parse the riscv idle state data and set the domain idle state where powering off. In addition, defer the driver without error message when the parent domain is not ready.

---
 drivers/cpuidle/cpuidle-riscv-sbi.c | 17 +++++++++++------
 drivers/cpuidle/cpuidle-riscv-sbi.h | 20 ++++++++++++++++++++
 2 files changed, 31 insertions(+), 6 deletions(-)
 create mode 100644 drivers/cpuidle/cpuidle-riscv-sbi.h
drivers/cpuidle/cpuidle-riscv-sbi.c +11 -6
index 0fe1ece9fbdc..d53254601522 100644
@@ -27,6 +27,7 @@
 #include <asm/suspend.h>
 
 #include "cpuidle.h"
+#include "cpuidle-riscv-sbi.h"
 #include "dt_idle_states.h"
 #include "dt_idle_genpd.h"
 
@@ -188,7 +189,7 @@ static const struct of_device_id sbi_cpuidle_state_match[] = {
 	{ },
 };
 
-static int sbi_dt_parse_state_node(struct device_node *np, u32 *state)
+int sbi_dt_parse_state_node(struct device_node *np, u32 *state)
 {
 	int err = of_property_read_u32(np, "riscv,sbi-suspend-param", state);
 
@@ -325,8 +326,9 @@ static int sbi_cpuidle_init_cpu(struct device *dev, int cpu)
 	/* Initialize idle states from DT. */
 	ret = sbi_cpuidle_dt_init_states(dev, drv, cpu, state_count);
 	if (ret) {
-		pr_err("HART%ld: failed to init idle states\n",
-		       cpuid_to_hartid_map(cpu));
+		if (ret != -EPROBE_DEFER)
+			pr_err("HART%ld: failed to init idle states\n",
+			       cpuid_to_hartid_map(cpu));
 		return ret;
 	}
 
@@ -356,7 +358,7 @@ static void sbi_cpuidle_domain_sync_state(struct device *dev)
 
 #ifdef CONFIG_DT_IDLE_GENPD
 
-static int sbi_cpuidle_pd_power_off(struct generic_pm_domain *pd)
+int sbi_cpuidle_pd_power_off(struct generic_pm_domain *pd)
 {
 	struct genpd_power_state *state = &pd->states[pd->state_idx];
 	u32 *pd_state;
@@ -533,8 +535,11 @@ static int sbi_cpuidle_probe(struct platform_device *pdev)
 	for_each_present_cpu(cpu) {
 		ret = sbi_cpuidle_init_cpu(&pdev->dev, cpu);
 		if (ret) {
-			pr_debug("HART%ld: idle driver init failed\n",
-				 cpuid_to_hartid_map(cpu));
+			if (ret == -EPROBE_DEFER)
+				pr_debug("idle driver probe deferred\n");
+			else
+				pr_debug("HART%ld: idle driver init failed\n",
+					 cpuid_to_hartid_map(cpu));
 			goto out_fail;
 		}
 	}
drivers/cpuidle/cpuidle-riscv-sbi.h new file +20 -0
new file mode 100644
index 000000000000..f39186b65a10
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __CPUIDLE_RISCV_SBI
+#define __CPUIDLE_RISCV_SBI
+
+#ifdef CONFIG_DT_IDLE_GENPD
+
+int sbi_cpuidle_pd_power_off(struct generic_pm_domain *pd);
+
+#else
+
+static inline int sbi_cpuidle_pd_power_off(struct generic_pm_domain *pd)
+{
+	return 0;
+}
+
+#endif
+
+int sbi_dt_parse_state_node(struct device_node *np, u32 *state);
+
+#endif
Signature · 1 line
2.17.1
author
#7 lore raw

PATCH v2 3/3 cpuidle: Add SiFive power provider

In reply to Nick Hu

The SiFive DMC is the power provider of the devices that inside the SiFive CPU power domains, which include Tile, Cluster and Core Complex power domains. Before the cpu entering the firmware-based idle state, each devices that inside the corresponding domain should be suspended properly. So this driver will create the power provider and set the correct idle state.

---
 drivers/cpuidle/Kconfig.riscv           |  11 +++
 drivers/cpuidle/Makefile                |   1 +
 drivers/cpuidle/cpuidle-sifive-dmc-pd.c | 102 ++++++++++++++++++++++++
 3 files changed, 114 insertions(+)
 create mode 100644 drivers/cpuidle/cpuidle-sifive-dmc-pd.c
drivers/cpuidle/Kconfig.riscv +11 -0
index 78518c26af74..af802afefa21 100644
@@ -13,3 +13,14 @@ config RISCV_SBI_CPUIDLE
 	  Select this option to enable RISC-V SBI firmware based CPU idle
 	  driver for RISC-V systems. This drivers also supports hierarchical
 	  DT based layout of the idle state.
+
+config SIFIVE_DMC_PD_CPUIDLE
+	bool "SiFive DMC SBI PD Provider Driver"
+	depends on ARCH_SIFIVE
+	select PM_GENERIC_DOMAINS_OF
+	select RISCV_SBI_CPUIDLE
+	default y
+	help
+	  Select this option to enable SiFive DMC SBI PD Provider driver.
+	  This driver will create the genpd provider and work with the
+	  RISC-V SBI firmware based CPU idle driver.
drivers/cpuidle/Makefile +1 -0
index 1de9e92c5b0f..1f8e01b415e8 100644
@@ -42,3 +42,4 @@ obj-$(CONFIG_POWERNV_CPUIDLE)		+= cpuidle-powernv.o
 ###############################################################################
 # RISC-V drivers
 obj-$(CONFIG_RISCV_SBI_CPUIDLE)		+= cpuidle-riscv-sbi.o
+obj-$(CONFIG_SIFIVE_DMC_PD_CPUIDLE)	+= cpuidle-sifive-dmc-pd.o
drivers/cpuidle/cpuidle-sifive-dmc-pd.c new file +102 -0

102 lines not on this page · raw message

Signature · 1 line
2.17.1
#8 lore raw

Re: [PATCH v2 3/3] cpuidle: Add SiFive power provider

kernel test robot noticed the following build warnings:

Hi Nick,

kernel test robot noticed the following build warnings:

[auto build test WARNING on rafael-pm/linux-next]
[also build test WARNING on rafael-pm/bleeding-edge robh/for-next linus/master v6.16-rc1 next-20250611] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Nick-Hu/cpuidle-riscv-sbi-Work-with-the-external-pmdomain-driver/20250611-121115
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link:    https://lore.kernel.org/r/20250611031023.28769-4-nick.hu%40sifive.com
patch subject: [PATCH v2 3/3] cpuidle: Add SiFive power provider
config: riscv-kismet-CONFIG_PM_GENERIC_DOMAINS_OF-CONFIG_SIFIVE_DMC_PD_CPUIDLE-0-0 (https://download.01.org/0day-ci/archive/20250612/[email protected]/config)
reproduce: (https://download.01.org/0day-ci/archive/20250612/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

kismet warnings: (new ones prefixed by >>)

>> kismet: WARNING: unmet direct dependencies detected for PM_GENERIC_DOMAINS_OF when selected by SIFIVE_DMC_PD_CPUIDLE

WARNING: unmet direct dependencies detected for PM_GENERIC_DOMAINS_OF
Depends on [n]: PM_GENERIC_DOMAINS [=n] && OF [=y]
Selected by [y]:
- SIFIVE_DMC_PD_CPUIDLE [=y] && CPU_IDLE [=y] && RISCV [=y] && ARCH_SIFIVE [=y]

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#9 lore raw

Re: [PATCH v2 3/3] cpuidle: Add SiFive power provider

In reply to Nick Hu
kernel test robot noticed the following build warnings:

Hi Nick,

kernel test robot noticed the following build warnings:

[auto build test WARNING on rafael-pm/linux-next]
[also build test WARNING on rafael-pm/bleeding-edge robh/for-next linus/master v6.16-rc1 next-20250611] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Nick-Hu/cpuidle-riscv-sbi-Work-with-the-external-pmdomain-driver/20250611-121115
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link:    https://lore.kernel.org/r/20250611031023.28769-4-nick.hu%40sifive.com
patch subject: [PATCH v2 3/3] cpuidle: Add SiFive power provider
config: riscv-kismet-CONFIG_RISCV_SBI_CPUIDLE-CONFIG_SIFIVE_DMC_PD_CPUIDLE-0-0 (https://download.01.org/0day-ci/archive/20250612/[email protected]/config)
reproduce: (https://download.01.org/0day-ci/archive/20250612/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

kismet warnings: (new ones prefixed by >>)

>> kismet: WARNING: unmet direct dependencies detected for RISCV_SBI_CPUIDLE when selected by SIFIVE_DMC_PD_CPUIDLE

WARNING: unmet direct dependencies detected for PM_GENERIC_DOMAINS_OF
Depends on [n]: PM_GENERIC_DOMAINS [=n] && OF [=y]
Selected by [y]:
- SIFIVE_DMC_PD_CPUIDLE [=y] && CPU_IDLE [=y] && RISCV [=y] && ARCH_SIFIVE [=y]

WARNING: unmet direct dependencies detected for RISCV_SBI_CPUIDLE
Depends on [n]: CPU_IDLE [=y] && RISCV [=y] && RISCV_SBI [=n] Selected by [y]:
- SIFIVE_DMC_PD_CPUIDLE [=y] && CPU_IDLE [=y] && RISCV [=y] && ARCH_SIFIVE [=y]

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#10 lore raw

Re: [PATCH v2 3/3] cpuidle: Add SiFive power provider

In reply to Nick Hu
kernel test robot noticed the following build errors:

Hi Nick,

kernel test robot noticed the following build errors:

[auto build test ERROR on rafael-pm/linux-next]
[also build test ERROR on rafael-pm/bleeding-edge robh/for-next linus/master v6.16-rc1 next-20250611] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Nick-Hu/cpuidle-riscv-sbi-Work-with-the-external-pmdomain-driver/20250611-121115
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link:    https://lore.kernel.org/r/20250611031023.28769-4-nick.hu%40sifive.com
patch subject: [PATCH v2 3/3] cpuidle: Add SiFive power provider
config: riscv-randconfig-002-20250612 (https://download.01.org/0day-ci/archive/20250612/[email protected]/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project f819f46284f2a79790038e1f6649172789734ae8)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250612/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from drivers/cpuidle/cpuidle-sifive-dmc-pd.c:8:
In file included from include/linux/of_device.h:5:
In file included from include/linux/device/driver.h:21:
In file included from include/linux/module.h:19:
In file included from include/linux/elf.h:6:
In file included from arch/riscv/include/asm/elf.h:12:
In file included from include/linux/compat.h:17:
include/linux/fs.h:3975:15: warning: label followed by a declaration is a C23 extension [-Wc23-extensions]

    3975 |         if (unlikely(get_user(c, path)))
         |                      ^
   arch/riscv/include/asm/uaccess.h:274:3: note: expanded from macro 'get_user'
     274 |                 __get_user((x), __p) :                          \
         |                 ^
   arch/riscv/include/asm/uaccess.h:244:2: note: expanded from macro '__get_user'
     244 |         __get_user_error(__gu_val, __gu_ptr, __gu_err);         \
         |         ^
   arch/riscv/include/asm/uaccess.h:207:2: note: expanded from macro '__get_user_error'
     207 |         __get_user_nocheck(x, ptr, __gu_failed);                        \
         |         ^
   arch/riscv/include/asm/uaccess.h:196:3: note: expanded from macro '__get_user_nocheck'
     196 |                 __get_user_8((x), __gu_ptr, label);             \
         |                 ^
   arch/riscv/include/asm/uaccess.h:130:2: note: expanded from macro '__get_user_8'
     130 |         u32 __user *__ptr = (u32 __user *)(ptr);                \
         |         ^
>> drivers/cpuidle/cpuidle-sifive-dmc-pd.c:42:27: error: use of undeclared identifier 'pm_domain_cpu_gov'
      42 |         ret = pm_genpd_init(pd, &pm_domain_cpu_gov, false);
         |                                  ^

1 warning and 1 error generated.
--
In file included from drivers/cpuidle/cpuidle-riscv-sbi.c:16:
In file included from include/linux/cpu_cooling.h:17:
In file included from include/linux/thermal.h:15:
In file included from include/linux/device.h:32:
In file included from include/linux/device/driver.h:21:
In file included from include/linux/module.h:19:
In file included from include/linux/elf.h:6:
In file included from arch/riscv/include/asm/elf.h:12:
In file included from include/linux/compat.h:17:
include/linux/fs.h:3975:15: warning: label followed by a declaration is a C23 extension [-Wc23-extensions]

    3975 |         if (unlikely(get_user(c, path)))
         |                      ^
   arch/riscv/include/asm/uaccess.h:274:3: note: expanded from macro 'get_user'
     274 |                 __get_user((x), __p) :                          \
         |                 ^
   arch/riscv/include/asm/uaccess.h:244:2: note: expanded from macro '__get_user'
     244 |         __get_user_error(__gu_val, __gu_ptr, __gu_err);         \
         |         ^
   arch/riscv/include/asm/uaccess.h:207:2: note: expanded from macro '__get_user_error'
     207 |         __get_user_nocheck(x, ptr, __gu_failed);                        \
         |         ^
   arch/riscv/include/asm/uaccess.h:196:3: note: expanded from macro '__get_user_nocheck'
     196 |                 __get_user_8((x), __gu_ptr, label);             \
         |                 ^
   arch/riscv/include/asm/uaccess.h:130:2: note: expanded from macro '__get_user_8'
     130 |         u32 __user *__ptr = (u32 __user *)(ptr);                \
         |         ^
>> drivers/cpuidle/cpuidle-riscv-sbi.c:410:25: error: use of undeclared identifier 'pm_domain_cpu_gov'
     410 |         pd_gov = pd->states ? &pm_domain_cpu_gov : NULL;
         |                                ^

1 warning and 1 error generated.

Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for PM_GENERIC_DOMAINS_OF Depends on [n]: PM_GENERIC_DOMAINS [=n] && OF [=y]
Selected by [y]:
- SIFIVE_DMC_PD_CPUIDLE [=y] && CPU_IDLE [=y] && RISCV [=y] && ARCH_SIFIVE [=y]

vim +/pm_domain_cpu_gov +42 drivers/cpuidle/cpuidle-sifive-dmc-pd.c

    26	
    27	static int sifive_dmc_probe(struct platform_device *pdev)
    28	{
    29		struct device *dev = &pdev->dev;
    30		struct device_node *np = dev->of_node;
    31		struct generic_pm_domain *pd;
    32		struct of_phandle_args child, parent;
    33		int ret = -ENOMEM;
    34	
    35		pd = dt_idle_pd_alloc(np, sbi_dt_parse_state_node);
    36		if (!pd)
    37			goto fail;
    38	
    39		pd->flags |= GENPD_FLAG_IRQ_SAFE | GENPD_FLAG_CPU_DOMAIN;
    40		pd->power_off = sbi_cpuidle_pd_power_off;
    41	
  > 42		ret = pm_genpd_init(pd, &pm_domain_cpu_gov, false);
    43		if (ret)
    44			goto free_pd;
    45	
    46		ret = of_genpd_add_provider_simple(np, pd);
    47		if (ret)
    48			goto remove_pd;
    49	
    50		if (of_parse_phandle_with_args(np, "power-domains",
    51					       "#power-domain-cells", 0,
    52					       &parent) == 0) {
    53			child.np = np;
    54			child.args_count = 0;
    55	
    56			if (of_genpd_add_subdomain(&parent, &child))
    57				pr_warn("%pOF failed to add subdomain: %pOF\n",
    58					parent.np, child.np);
    59			else
    60				pr_debug("%pOF has a child subdomain: %pOF.\n",
    61					 parent.np, child.np);
    62		}
    63	
    64		platform_set_drvdata(pdev, pd);
    65		pm_runtime_enable(dev);
    66		pr_info("%s create success\n", pd->name);
    67		return 0;
    68	
    69	remove_pd:
    70		pm_genpd_remove(pd);
    71	free_pd:
    72		dt_idle_pd_free(pd);
    73	fail:
    74		pr_info("%s create fail\n", pd->name);
    75	
    76		return ret;
    77	}
    78	
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki