183 lines
6.4 KiB
Diff
183 lines
6.4 KiB
Diff
From 0fd44206fc43d7199b93c191dd1486877c0f09c8 Mon Sep 17 00:00:00 2001
|
|
From: congyuyang <congyuyang@eswincomputing.com>
|
|
Date: Thu, 25 Jul 2024 16:21:19 +0800
|
|
Subject: [PATCH 127/219] feat:add cpu-idle framework support
|
|
|
|
Changelogs:
|
|
Add cpuidle driver.
|
|
|
|
Signed-off-by: congyuyang <congyuyang@eswincomputing.com>
|
|
---
|
|
.../dts/eswin/eswin-win2030-arch-d2d.dtsi | 25 ++++++++++++++++++-
|
|
.../boot/dts/eswin/eswin-win2030-arch.dtsi | 20 +++++++++++++++
|
|
arch/riscv/configs/win2030_defconfig | 2 ++
|
|
3 files changed, 46 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/arch/riscv/boot/dts/eswin/eswin-win2030-arch-d2d.dtsi b/arch/riscv/boot/dts/eswin/eswin-win2030-arch-d2d.dtsi
|
|
index 725d93d2165f..fa46f44bd3a1 100644
|
|
--- a/arch/riscv/boot/dts/eswin/eswin-win2030-arch-d2d.dtsi
|
|
+++ b/arch/riscv/boot/dts/eswin/eswin-win2030-arch-d2d.dtsi
|
|
@@ -34,7 +34,22 @@ L64: cpus {
|
|
#address-cells = <1>;
|
|
#size-cells = <0>;
|
|
timebase-frequency = <RTCCLK_FREQ>;
|
|
-
|
|
+ idle-states {
|
|
+ CPU_RET: cpu-retentive {
|
|
+ compatible = "riscv,idle-state";
|
|
+ riscv,sbi-suspend-param = <0x00000000>;
|
|
+ entry-latency-us = <20>;
|
|
+ exit-latency-us = <40>;
|
|
+ min-residency-us = <80>;
|
|
+ };
|
|
+ CPU_NONRET: cpu-nonretentive {
|
|
+ compatible = "riscv,idle-state";
|
|
+ riscv,sbi-suspend-param = <0x80000000>;
|
|
+ entry-latency-us = <250>;
|
|
+ exit-latency-us = <500>;
|
|
+ min-residency-us = <950>;
|
|
+ };
|
|
+ };
|
|
cpu-map {
|
|
#if (CHIPLET_AND_DIE & 0x2)
|
|
cluster0 {
|
|
@@ -109,6 +124,7 @@ cpu_0: cpu@0 {
|
|
numa-node-id = <0>;
|
|
clocks = <&d0_clock WIN2030_CLK_CPU_EXT_SRC_CORE_CLK_0>;
|
|
operating-points-v2 = <&d0_cpu_opp_table>;
|
|
+ cpu-idle-states = <&CPU_RET &CPU_NONRET>;
|
|
cpu0_intc: interrupt-controller {
|
|
#interrupt-cells = <1>;
|
|
compatible = "riscv,cpu-intc";
|
|
@@ -156,6 +172,7 @@ cpu_1: cpu@1 {
|
|
numa-node-id = <0>;
|
|
clocks = <&d0_clock WIN2030_CLK_CPU_EXT_SRC_CORE_CLK_1>;
|
|
operating-points-v2 = <&d0_cpu_opp_table>;
|
|
+ cpu-idle-states = <&CPU_RET &CPU_NONRET>;
|
|
cpu1_intc: interrupt-controller {
|
|
#interrupt-cells = <1>;
|
|
compatible = "riscv,cpu-intc";
|
|
@@ -203,6 +220,7 @@ cpu_2: cpu@2 {
|
|
numa-node-id = <0>;
|
|
clocks = <&d0_clock WIN2030_CLK_CPU_EXT_SRC_CORE_CLK_2>;
|
|
operating-points-v2 = <&d0_cpu_opp_table>;
|
|
+ cpu-idle-states = <&CPU_RET &CPU_NONRET>;
|
|
cpu2_intc: interrupt-controller {
|
|
#interrupt-cells = <1>;
|
|
compatible = "riscv,cpu-intc";
|
|
@@ -250,6 +268,7 @@ cpu_3: cpu@3 {
|
|
numa-node-id = <0>;
|
|
clocks = <&d0_clock WIN2030_CLK_CPU_EXT_SRC_CORE_CLK_3>;
|
|
operating-points-v2 = <&d0_cpu_opp_table>;
|
|
+ cpu-idle-states = <&CPU_RET &CPU_NONRET>;
|
|
cpu3_intc: interrupt-controller {
|
|
#interrupt-cells = <1>;
|
|
compatible = "riscv,cpu-intc";
|
|
@@ -309,6 +328,7 @@ cpu_4: cpu@4 {
|
|
numa-node-id = <1>;
|
|
clocks = <&d1_clock WIN2030_CLK_CPU_EXT_SRC_CORE_CLK_0>;
|
|
operating-points-v2 = <&d1_cpu_opp_table>;
|
|
+ cpu-idle-states = <&CPU_RET &CPU_NONRET>;
|
|
cpu4_intc: interrupt-controller {
|
|
#interrupt-cells = <1>;
|
|
compatible = "riscv,cpu-intc";
|
|
@@ -356,6 +376,7 @@ cpu_5: cpu@5 {
|
|
numa-node-id = <1>;
|
|
clocks = <&d1_clock WIN2030_CLK_CPU_EXT_SRC_CORE_CLK_1>;
|
|
operating-points-v2 = <&d1_cpu_opp_table>;
|
|
+ cpu-idle-states = <&CPU_RET &CPU_NONRET>;
|
|
cpu5_intc: interrupt-controller {
|
|
#interrupt-cells = <1>;
|
|
compatible = "riscv,cpu-intc";
|
|
@@ -402,6 +423,7 @@ cpu_6: cpu@6 {
|
|
numa-node-id = <1>;
|
|
clocks = <&d1_clock WIN2030_CLK_CPU_EXT_SRC_CORE_CLK_2>;
|
|
operating-points-v2 = <&d1_cpu_opp_table>;
|
|
+ cpu-idle-states = <&CPU_RET &CPU_NONRET>;
|
|
cpu6_intc: interrupt-controller {
|
|
#interrupt-cells = <1>;
|
|
compatible = "riscv,cpu-intc";
|
|
@@ -448,6 +470,7 @@ cpu_7: cpu@7 {
|
|
numa-node-id = <1>;
|
|
clocks = <&d1_clock WIN2030_CLK_CPU_EXT_SRC_CORE_CLK_3>;
|
|
operating-points-v2 = <&d1_cpu_opp_table>;
|
|
+ cpu-idle-states = <&CPU_RET &CPU_NONRET>;
|
|
cpu7_intc: interrupt-controller {
|
|
#interrupt-cells = <1>;
|
|
compatible = "riscv,cpu-intc";
|
|
diff --git a/arch/riscv/boot/dts/eswin/eswin-win2030-arch.dtsi b/arch/riscv/boot/dts/eswin/eswin-win2030-arch.dtsi
|
|
index cde282a61863..f20e1064ea7c 100644
|
|
--- a/arch/riscv/boot/dts/eswin/eswin-win2030-arch.dtsi
|
|
+++ b/arch/riscv/boot/dts/eswin/eswin-win2030-arch.dtsi
|
|
@@ -39,6 +39,22 @@ L64: cpus {
|
|
#address-cells = <1>;
|
|
#size-cells = <0>;
|
|
timebase-frequency = <RTCCLK_FREQ>;
|
|
+ idle-states {
|
|
+ CPU_RET: cpu-retentive {
|
|
+ compatible = "riscv,idle-state";
|
|
+ riscv,sbi-suspend-param = <0x00000000>;
|
|
+ entry-latency-us = <20>;
|
|
+ exit-latency-us = <40>;
|
|
+ min-residency-us = <80>;
|
|
+ };
|
|
+ CPU_NONRET: cpu-nonretentive {
|
|
+ compatible = "riscv,idle-state";
|
|
+ riscv,sbi-suspend-param = <0x80000000>;
|
|
+ entry-latency-us = <250>;
|
|
+ exit-latency-us = <500>;
|
|
+ min-residency-us = <950>;
|
|
+ };
|
|
+ };
|
|
L17: cpu@0 {
|
|
clock-frequency = <0>;
|
|
compatible = "eswin,eic770x", "riscv";
|
|
@@ -75,6 +91,7 @@ L17: cpu@0 {
|
|
tlb-split;
|
|
clocks = <&d0_clock WIN2030_CLK_CPU_EXT_SRC_CORE_CLK_0>;
|
|
operating-points-v2 = <&d0_cpu_opp_table>;
|
|
+ cpu-idle-states = <&CPU_RET &CPU_NONRET>;
|
|
L14: interrupt-controller {
|
|
#interrupt-cells = <1>;
|
|
compatible = "riscv,cpu-intc";
|
|
@@ -117,6 +134,7 @@ L22: cpu@1 {
|
|
tlb-split;
|
|
clocks = <&d0_clock WIN2030_CLK_CPU_EXT_SRC_CORE_CLK_1>;
|
|
operating-points-v2 = <&d0_cpu_opp_table>;
|
|
+ cpu-idle-states = <&CPU_RET &CPU_NONRET>;
|
|
L19: interrupt-controller {
|
|
#interrupt-cells = <1>;
|
|
compatible = "riscv,cpu-intc";
|
|
@@ -159,6 +177,7 @@ L27: cpu@2 {
|
|
tlb-split;
|
|
clocks = <&d0_clock WIN2030_CLK_CPU_EXT_SRC_CORE_CLK_2>;
|
|
operating-points-v2 = <&d0_cpu_opp_table>;
|
|
+ cpu-idle-states = <&CPU_RET &CPU_NONRET>;
|
|
L24: interrupt-controller {
|
|
#interrupt-cells = <1>;
|
|
compatible = "riscv,cpu-intc";
|
|
@@ -201,6 +220,7 @@ L32: cpu@3 {
|
|
tlb-split;
|
|
clocks = <&d0_clock WIN2030_CLK_CPU_EXT_SRC_CORE_CLK_3>;
|
|
operating-points-v2 = <&d0_cpu_opp_table>;
|
|
+ cpu-idle-states = <&CPU_RET &CPU_NONRET>;
|
|
L29: interrupt-controller {
|
|
#interrupt-cells = <1>;
|
|
compatible = "riscv,cpu-intc";
|
|
diff --git a/arch/riscv/configs/win2030_defconfig b/arch/riscv/configs/win2030_defconfig
|
|
index 1603e0ec1bf7..2ef6525451ad 100644
|
|
--- a/arch/riscv/configs/win2030_defconfig
|
|
+++ b/arch/riscv/configs/win2030_defconfig
|
|
@@ -50,6 +50,8 @@ CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y
|
|
CONFIG_CPUFREQ_DT=y
|
|
CONFIG_VIRTUALIZATION=y
|
|
CONFIG_KVM=m
|
|
+CONFIG_CPU_IDLE=y
|
|
+CONFIG_RISCV_SBI_CPUIDLE=y
|
|
CONFIG_JUMP_LABEL=y
|
|
CONFIG_MODULES=y
|
|
CONFIG_MODULE_UNLOAD=y
|
|
--
|
|
2.47.0
|
|
|