Skip to content

Commit ac73ce3

Browse files
committed
Merge branches 'pm-cpuidle', 'pm-core', 'pm-sleep' and 'powercap'
Merge cpuidle changes, PM core changes and power capping changes for 6.1-rc1: - Add AlderLake-N support to intel_idle (Zhang Rui). - Replace strlcpy() with unused retval with strscpy() in intel_idle (Wolfram Sang). - Remove redundant check from cpuidle_switch_governor() (Yu Liao). - Replace strlcpy() with unused retval with strscpy() in the powernv cpuidle driver (Wolfram Sang). - Drop duplicate word from a comment in the coupled cpuidle driver (Jason Wang). - Make rpm_resume() return -EINPROGRESS if RPM_NOWAIT is passed to it in the flags and the device is about to resume (Rafael Wysocki). - Add extra debugging statement for multiple active IRQs to system wakeup handling code (Mario Limonciello). - Replace strlcpy() with unused retval with strscpy() in the core system suspend support code (Wolfram Sang). - Update the intel_rapl power capping driver: * Use standard Energy Unit for SPR Dram RAPL domain (Zhang Rui). * Add support for RAPTORLAKE_S (Zhang Rui). * Fix UBSAN shift-out-of-bounds issue (Chao Qin). * pm-cpuidle: intel_idle: Add AlderLake-N support cpuidle: Remove redundant check in cpuidle_switch_governor() intel_idle: move from strlcpy() with unused retval to strscpy() cpuidle: powernv: move from strlcpy() with unused retval to strscpy() cpuidle: coupled: Drop duplicate word from a comment * pm-core: PM: runtime: Return -EINPROGRESS from rpm_resume() in the RPM_NOWAIT case * pm-sleep: PM: wakeup: Add extra debugging statement for multiple active IRQs PM: suspend: move from strlcpy() with unused retval to strscpy() * powercap: powercap: intel_rapl: Use standard Energy Unit for SPR Dram RAPL domain powercap: intel_rapl: fix UBSAN shift-out-of-bounds issue powercap: intel_rapl: Add support for RAPTORLAKE_S
5 parents 0766fa2 + 65c0c23 + e66332a + cb3e7d6 + 4c08132 commit ac73ce3

File tree

8 files changed

+72
-14
lines changed

8 files changed

+72
-14
lines changed

drivers/base/power/runtime.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -792,10 +792,13 @@ static int rpm_resume(struct device *dev, int rpmflags)
792792
DEFINE_WAIT(wait);
793793

794794
if (rpmflags & (RPM_ASYNC | RPM_NOWAIT)) {
795-
if (dev->power.runtime_status == RPM_SUSPENDING)
795+
if (dev->power.runtime_status == RPM_SUSPENDING) {
796796
dev->power.deferred_resume = true;
797-
else
797+
if (rpmflags & RPM_NOWAIT)
798+
retval = -EINPROGRESS;
799+
} else {
798800
retval = -EINPROGRESS;
801+
}
799802
goto out;
800803
}
801804

drivers/base/power/wakeup.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -944,6 +944,8 @@ void pm_system_irq_wakeup(unsigned int irq_number)
944944
else
945945
irq_number = 0;
946946

947+
pm_pr_dbg("Triggering wakeup from IRQ %d\n", irq_number);
948+
947949
raw_spin_unlock_irqrestore(&wakeup_irq_lock, flags);
948950

949951
if (irq_number)

drivers/cpuidle/coupled.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
* variable is not locked. It is only written from the cpu that
5555
* it stores (or by the on/offlining cpu if that cpu is offline),
5656
* and only read after all the cpus are ready for the coupled idle
57-
* state are are no longer updating it.
57+
* state are no longer updating it.
5858
*
5959
* Three atomic counters are used. alive_count tracks the number
6060
* of cpus in the coupled set that are currently or soon will be

drivers/cpuidle/cpuidle-powernv.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,8 @@ static inline void add_powernv_state(int index, const char *name,
233233
unsigned int exit_latency,
234234
u64 psscr_val, u64 psscr_mask)
235235
{
236-
strlcpy(powernv_states[index].name, name, CPUIDLE_NAME_LEN);
237-
strlcpy(powernv_states[index].desc, name, CPUIDLE_NAME_LEN);
236+
strscpy(powernv_states[index].name, name, CPUIDLE_NAME_LEN);
237+
strscpy(powernv_states[index].desc, name, CPUIDLE_NAME_LEN);
238238
powernv_states[index].flags = flags;
239239
powernv_states[index].target_residency = target_residency;
240240
powernv_states[index].exit_latency = exit_latency;

drivers/cpuidle/governor.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,11 @@ int cpuidle_switch_governor(struct cpuidle_governor *gov)
6363

6464
cpuidle_curr_governor = gov;
6565

66-
if (gov) {
67-
list_for_each_entry(dev, &cpuidle_detected_devices, device_list)
68-
cpuidle_enable_device(dev);
69-
cpuidle_install_idle_handler();
70-
printk(KERN_INFO "cpuidle: using governor %s\n", gov->name);
71-
}
66+
list_for_each_entry(dev, &cpuidle_detected_devices, device_list)
67+
cpuidle_enable_device(dev);
68+
69+
cpuidle_install_idle_handler();
70+
pr_info("cpuidle: using governor %s\n", gov->name);
7271

7372
return 0;
7473
}

drivers/idle/intel_idle.c

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,51 @@ static struct cpuidle_state adl_l_cstates[] __initdata = {
928928
.enter = NULL }
929929
};
930930

931+
static struct cpuidle_state adl_n_cstates[] __initdata = {
932+
{
933+
.name = "C1",
934+
.desc = "MWAIT 0x00",
935+
.flags = MWAIT2flg(0x00) | CPUIDLE_FLAG_UNUSABLE,
936+
.exit_latency = 1,
937+
.target_residency = 1,
938+
.enter = &intel_idle,
939+
.enter_s2idle = intel_idle_s2idle, },
940+
{
941+
.name = "C1E",
942+
.desc = "MWAIT 0x01",
943+
.flags = MWAIT2flg(0x01) | CPUIDLE_FLAG_ALWAYS_ENABLE,
944+
.exit_latency = 2,
945+
.target_residency = 4,
946+
.enter = &intel_idle,
947+
.enter_s2idle = intel_idle_s2idle, },
948+
{
949+
.name = "C6",
950+
.desc = "MWAIT 0x20",
951+
.flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
952+
.exit_latency = 195,
953+
.target_residency = 585,
954+
.enter = &intel_idle,
955+
.enter_s2idle = intel_idle_s2idle, },
956+
{
957+
.name = "C8",
958+
.desc = "MWAIT 0x40",
959+
.flags = MWAIT2flg(0x40) | CPUIDLE_FLAG_TLB_FLUSHED,
960+
.exit_latency = 260,
961+
.target_residency = 1040,
962+
.enter = &intel_idle,
963+
.enter_s2idle = intel_idle_s2idle, },
964+
{
965+
.name = "C10",
966+
.desc = "MWAIT 0x60",
967+
.flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED,
968+
.exit_latency = 660,
969+
.target_residency = 1980,
970+
.enter = &intel_idle,
971+
.enter_s2idle = intel_idle_s2idle, },
972+
{
973+
.enter = NULL }
974+
};
975+
931976
static struct cpuidle_state spr_cstates[] __initdata = {
932977
{
933978
.name = "C1",
@@ -1309,6 +1354,10 @@ static const struct idle_cpu idle_cpu_adl_l __initconst = {
13091354
.state_table = adl_l_cstates,
13101355
};
13111356

1357+
static const struct idle_cpu idle_cpu_adl_n __initconst = {
1358+
.state_table = adl_n_cstates,
1359+
};
1360+
13121361
static const struct idle_cpu idle_cpu_spr __initconst = {
13131362
.state_table = spr_cstates,
13141363
.disable_promotion_to_c1e = true,
@@ -1379,6 +1428,7 @@ static const struct x86_cpu_id intel_idle_ids[] __initconst = {
13791428
X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_D, &idle_cpu_icx),
13801429
X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE, &idle_cpu_adl),
13811430
X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_L, &idle_cpu_adl_l),
1431+
X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_N, &idle_cpu_adl_n),
13821432
X86_MATCH_INTEL_FAM6_MODEL(SAPPHIRERAPIDS_X, &idle_cpu_spr),
13831433
X86_MATCH_INTEL_FAM6_MODEL(XEON_PHI_KNL, &idle_cpu_knl),
13841434
X86_MATCH_INTEL_FAM6_MODEL(XEON_PHI_KNM, &idle_cpu_knl),
@@ -1507,7 +1557,7 @@ static void __init intel_idle_init_cstates_acpi(struct cpuidle_driver *drv)
15071557
state = &drv->states[drv->state_count++];
15081558

15091559
snprintf(state->name, CPUIDLE_NAME_LEN, "C%d_ACPI", cstate);
1510-
strlcpy(state->desc, cx->desc, CPUIDLE_DESC_LEN);
1560+
strscpy(state->desc, cx->desc, CPUIDLE_DESC_LEN);
15111561
state->exit_latency = cx->latency;
15121562
/*
15131563
* For C1-type C-states use the same number for both the exit
@@ -1816,6 +1866,7 @@ static void __init intel_idle_init_cstates_icpu(struct cpuidle_driver *drv)
18161866
break;
18171867
case INTEL_FAM6_ALDERLAKE:
18181868
case INTEL_FAM6_ALDERLAKE_L:
1869+
case INTEL_FAM6_ALDERLAKE_N:
18191870
adl_idle_state_table_update();
18201871
break;
18211872
}

drivers/powercap/intel_rapl_common.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -994,6 +994,9 @@ static u64 rapl_compute_time_window_core(struct rapl_package *rp, u64 value,
994994
y = value & 0x1f;
995995
value = (1 << y) * (4 + f) * rp->time_unit / 4;
996996
} else {
997+
if (value < rp->time_unit)
998+
return 0;
999+
9971000
do_div(value, rp->time_unit);
9981001
y = ilog2(value);
9991002
f = div64_u64(4 * (value - (1 << y)), 1 << y);
@@ -1035,7 +1038,6 @@ static const struct rapl_defaults rapl_defaults_spr_server = {
10351038
.check_unit = rapl_check_unit_core,
10361039
.set_floor_freq = set_floor_freq_default,
10371040
.compute_time_window = rapl_compute_time_window_core,
1038-
.dram_domain_energy_unit = 15300,
10391041
.psys_domain_energy_unit = 1000000000,
10401042
.spr_psys_bits = true,
10411043
};
@@ -1110,6 +1112,7 @@ static const struct x86_cpu_id rapl_ids[] __initconst = {
11101112
X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_N, &rapl_defaults_core),
11111113
X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE, &rapl_defaults_core),
11121114
X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE_P, &rapl_defaults_core),
1115+
X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE_S, &rapl_defaults_core),
11131116
X86_MATCH_INTEL_FAM6_MODEL(SAPPHIRERAPIDS_X, &rapl_defaults_spr_server),
11141117
X86_MATCH_INTEL_FAM6_MODEL(LAKEFIELD, &rapl_defaults_core),
11151118

include/linux/suspend.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ extern struct suspend_stats suspend_stats;
7575

7676
static inline void dpm_save_failed_dev(const char *name)
7777
{
78-
strlcpy(suspend_stats.failed_devs[suspend_stats.last_failed_dev],
78+
strscpy(suspend_stats.failed_devs[suspend_stats.last_failed_dev],
7979
name,
8080
sizeof(suspend_stats.failed_devs[0]));
8181
suspend_stats.last_failed_dev++;

0 commit comments

Comments
 (0)