mirror of
https://github.com/torvalds/linux.git
synced 2024-11-25 21:51:40 +00:00
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
This commit is contained in:
commit
ac73ce394a
@ -792,10 +792,13 @@ static int rpm_resume(struct device *dev, int rpmflags)
|
||||
DEFINE_WAIT(wait);
|
||||
|
||||
if (rpmflags & (RPM_ASYNC | RPM_NOWAIT)) {
|
||||
if (dev->power.runtime_status == RPM_SUSPENDING)
|
||||
if (dev->power.runtime_status == RPM_SUSPENDING) {
|
||||
dev->power.deferred_resume = true;
|
||||
else
|
||||
if (rpmflags & RPM_NOWAIT)
|
||||
retval = -EINPROGRESS;
|
||||
} else {
|
||||
retval = -EINPROGRESS;
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
@ -944,6 +944,8 @@ void pm_system_irq_wakeup(unsigned int irq_number)
|
||||
else
|
||||
irq_number = 0;
|
||||
|
||||
pm_pr_dbg("Triggering wakeup from IRQ %d\n", irq_number);
|
||||
|
||||
raw_spin_unlock_irqrestore(&wakeup_irq_lock, flags);
|
||||
|
||||
if (irq_number)
|
||||
|
@ -54,7 +54,7 @@
|
||||
* variable is not locked. It is only written from the cpu that
|
||||
* it stores (or by the on/offlining cpu if that cpu is offline),
|
||||
* and only read after all the cpus are ready for the coupled idle
|
||||
* state are are no longer updating it.
|
||||
* state are no longer updating it.
|
||||
*
|
||||
* Three atomic counters are used. alive_count tracks the number
|
||||
* of cpus in the coupled set that are currently or soon will be
|
||||
|
@ -233,8 +233,8 @@ static inline void add_powernv_state(int index, const char *name,
|
||||
unsigned int exit_latency,
|
||||
u64 psscr_val, u64 psscr_mask)
|
||||
{
|
||||
strlcpy(powernv_states[index].name, name, CPUIDLE_NAME_LEN);
|
||||
strlcpy(powernv_states[index].desc, name, CPUIDLE_NAME_LEN);
|
||||
strscpy(powernv_states[index].name, name, CPUIDLE_NAME_LEN);
|
||||
strscpy(powernv_states[index].desc, name, CPUIDLE_NAME_LEN);
|
||||
powernv_states[index].flags = flags;
|
||||
powernv_states[index].target_residency = target_residency;
|
||||
powernv_states[index].exit_latency = exit_latency;
|
||||
|
@ -63,12 +63,11 @@ int cpuidle_switch_governor(struct cpuidle_governor *gov)
|
||||
|
||||
cpuidle_curr_governor = gov;
|
||||
|
||||
if (gov) {
|
||||
list_for_each_entry(dev, &cpuidle_detected_devices, device_list)
|
||||
cpuidle_enable_device(dev);
|
||||
cpuidle_install_idle_handler();
|
||||
printk(KERN_INFO "cpuidle: using governor %s\n", gov->name);
|
||||
}
|
||||
list_for_each_entry(dev, &cpuidle_detected_devices, device_list)
|
||||
cpuidle_enable_device(dev);
|
||||
|
||||
cpuidle_install_idle_handler();
|
||||
pr_info("cpuidle: using governor %s\n", gov->name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -928,6 +928,51 @@ static struct cpuidle_state adl_l_cstates[] __initdata = {
|
||||
.enter = NULL }
|
||||
};
|
||||
|
||||
static struct cpuidle_state adl_n_cstates[] __initdata = {
|
||||
{
|
||||
.name = "C1",
|
||||
.desc = "MWAIT 0x00",
|
||||
.flags = MWAIT2flg(0x00) | CPUIDLE_FLAG_UNUSABLE,
|
||||
.exit_latency = 1,
|
||||
.target_residency = 1,
|
||||
.enter = &intel_idle,
|
||||
.enter_s2idle = intel_idle_s2idle, },
|
||||
{
|
||||
.name = "C1E",
|
||||
.desc = "MWAIT 0x01",
|
||||
.flags = MWAIT2flg(0x01) | CPUIDLE_FLAG_ALWAYS_ENABLE,
|
||||
.exit_latency = 2,
|
||||
.target_residency = 4,
|
||||
.enter = &intel_idle,
|
||||
.enter_s2idle = intel_idle_s2idle, },
|
||||
{
|
||||
.name = "C6",
|
||||
.desc = "MWAIT 0x20",
|
||||
.flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
|
||||
.exit_latency = 195,
|
||||
.target_residency = 585,
|
||||
.enter = &intel_idle,
|
||||
.enter_s2idle = intel_idle_s2idle, },
|
||||
{
|
||||
.name = "C8",
|
||||
.desc = "MWAIT 0x40",
|
||||
.flags = MWAIT2flg(0x40) | CPUIDLE_FLAG_TLB_FLUSHED,
|
||||
.exit_latency = 260,
|
||||
.target_residency = 1040,
|
||||
.enter = &intel_idle,
|
||||
.enter_s2idle = intel_idle_s2idle, },
|
||||
{
|
||||
.name = "C10",
|
||||
.desc = "MWAIT 0x60",
|
||||
.flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED,
|
||||
.exit_latency = 660,
|
||||
.target_residency = 1980,
|
||||
.enter = &intel_idle,
|
||||
.enter_s2idle = intel_idle_s2idle, },
|
||||
{
|
||||
.enter = NULL }
|
||||
};
|
||||
|
||||
static struct cpuidle_state spr_cstates[] __initdata = {
|
||||
{
|
||||
.name = "C1",
|
||||
@ -1309,6 +1354,10 @@ static const struct idle_cpu idle_cpu_adl_l __initconst = {
|
||||
.state_table = adl_l_cstates,
|
||||
};
|
||||
|
||||
static const struct idle_cpu idle_cpu_adl_n __initconst = {
|
||||
.state_table = adl_n_cstates,
|
||||
};
|
||||
|
||||
static const struct idle_cpu idle_cpu_spr __initconst = {
|
||||
.state_table = spr_cstates,
|
||||
.disable_promotion_to_c1e = true,
|
||||
@ -1379,6 +1428,7 @@ static const struct x86_cpu_id intel_idle_ids[] __initconst = {
|
||||
X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_D, &idle_cpu_icx),
|
||||
X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE, &idle_cpu_adl),
|
||||
X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_L, &idle_cpu_adl_l),
|
||||
X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_N, &idle_cpu_adl_n),
|
||||
X86_MATCH_INTEL_FAM6_MODEL(SAPPHIRERAPIDS_X, &idle_cpu_spr),
|
||||
X86_MATCH_INTEL_FAM6_MODEL(XEON_PHI_KNL, &idle_cpu_knl),
|
||||
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)
|
||||
state = &drv->states[drv->state_count++];
|
||||
|
||||
snprintf(state->name, CPUIDLE_NAME_LEN, "C%d_ACPI", cstate);
|
||||
strlcpy(state->desc, cx->desc, CPUIDLE_DESC_LEN);
|
||||
strscpy(state->desc, cx->desc, CPUIDLE_DESC_LEN);
|
||||
state->exit_latency = cx->latency;
|
||||
/*
|
||||
* 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)
|
||||
break;
|
||||
case INTEL_FAM6_ALDERLAKE:
|
||||
case INTEL_FAM6_ALDERLAKE_L:
|
||||
case INTEL_FAM6_ALDERLAKE_N:
|
||||
adl_idle_state_table_update();
|
||||
break;
|
||||
}
|
||||
|
@ -994,6 +994,9 @@ static u64 rapl_compute_time_window_core(struct rapl_package *rp, u64 value,
|
||||
y = value & 0x1f;
|
||||
value = (1 << y) * (4 + f) * rp->time_unit / 4;
|
||||
} else {
|
||||
if (value < rp->time_unit)
|
||||
return 0;
|
||||
|
||||
do_div(value, rp->time_unit);
|
||||
y = ilog2(value);
|
||||
f = div64_u64(4 * (value - (1 << y)), 1 << y);
|
||||
@ -1035,7 +1038,6 @@ static const struct rapl_defaults rapl_defaults_spr_server = {
|
||||
.check_unit = rapl_check_unit_core,
|
||||
.set_floor_freq = set_floor_freq_default,
|
||||
.compute_time_window = rapl_compute_time_window_core,
|
||||
.dram_domain_energy_unit = 15300,
|
||||
.psys_domain_energy_unit = 1000000000,
|
||||
.spr_psys_bits = true,
|
||||
};
|
||||
@ -1110,6 +1112,7 @@ static const struct x86_cpu_id rapl_ids[] __initconst = {
|
||||
X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_N, &rapl_defaults_core),
|
||||
X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE, &rapl_defaults_core),
|
||||
X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE_P, &rapl_defaults_core),
|
||||
X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE_S, &rapl_defaults_core),
|
||||
X86_MATCH_INTEL_FAM6_MODEL(SAPPHIRERAPIDS_X, &rapl_defaults_spr_server),
|
||||
X86_MATCH_INTEL_FAM6_MODEL(LAKEFIELD, &rapl_defaults_core),
|
||||
|
||||
|
@ -75,7 +75,7 @@ extern struct suspend_stats suspend_stats;
|
||||
|
||||
static inline void dpm_save_failed_dev(const char *name)
|
||||
{
|
||||
strlcpy(suspend_stats.failed_devs[suspend_stats.last_failed_dev],
|
||||
strscpy(suspend_stats.failed_devs[suspend_stats.last_failed_dev],
|
||||
name,
|
||||
sizeof(suspend_stats.failed_devs[0]));
|
||||
suspend_stats.last_failed_dev++;
|
||||
|
Loading…
Reference in New Issue
Block a user