Skip to content

Commit f848b3c

Browse files
committed
Merge tag 'pm-6.1-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull more power management updates from Rafael Wysocki: "These update the turbostat utility, extend the macros used for defining device power management callbacks and add a diagnostic message to the generic power domains code. Specifics: - Add an error message to be printed when a power domain marked as "always on" is not actually on during initialization (Johan Hovold). - Extend macros used for defining power management callbacks to allow conditional exporting of noirq and late/early suspend/resume PM callbacks (Paul Cercueil). - Update the turbostat utility: - Add support for two new platforms (Zhang Rui). - Adjust energy unit for Sapphire Rapids (Zhang Rui). - Do not dump TRL if turbo is not supported (Artem Bityutskiy)" * tag 'pm-6.1-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: tools/power turbostat: version 2022.10.04 tools/power turbostat: Use standard Energy Unit for SPR Dram RAPL domain tools/power turbostat: Do not dump TRL if turbo is not supported tools/power turbostat: Add support for MeteorLake platforms tools/power turbostat: Add support for RPL-S PM: Improve EXPORT_*_DEV_PM_OPS macros PM: domains: log failures to register always-on domains
2 parents 3a1e24f + f7e6b99 commit f848b3c

File tree

4 files changed

+53
-30
lines changed

4 files changed

+53
-30
lines changed

drivers/base/power/domain.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2085,8 +2085,10 @@ int pm_genpd_init(struct generic_pm_domain *genpd,
20852085

20862086
/* Always-on domains must be powered on at initialization. */
20872087
if ((genpd_is_always_on(genpd) || genpd_is_rpm_always_on(genpd)) &&
2088-
!genpd_status_on(genpd))
2088+
!genpd_status_on(genpd)) {
2089+
pr_err("always-on PM domain %s is not on\n", genpd->name);
20892090
return -EINVAL;
2091+
}
20902092

20912093
/* Multiple states but no governor doesn't make sense. */
20922094
if (!gov && genpd->state_count > 1)

include/linux/pm.h

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -375,19 +375,20 @@ const struct dev_pm_ops name = { \
375375
}
376376

377377
#ifdef CONFIG_PM
378-
#define _EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, runtime_suspend_fn, \
379-
runtime_resume_fn, idle_fn, sec, ns) \
380-
_DEFINE_DEV_PM_OPS(name, suspend_fn, resume_fn, runtime_suspend_fn, \
381-
runtime_resume_fn, idle_fn); \
382-
__EXPORT_SYMBOL(name, sec, ns)
378+
#define _EXPORT_DEV_PM_OPS(name, sec, ns) \
379+
const struct dev_pm_ops name; \
380+
__EXPORT_SYMBOL(name, sec, ns); \
381+
const struct dev_pm_ops name
383382
#else
384-
#define _EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, runtime_suspend_fn, \
385-
runtime_resume_fn, idle_fn, sec, ns) \
386-
static __maybe_unused _DEFINE_DEV_PM_OPS(__static_##name, suspend_fn, \
387-
resume_fn, runtime_suspend_fn, \
388-
runtime_resume_fn, idle_fn)
383+
#define _EXPORT_DEV_PM_OPS(name, sec, ns) \
384+
static __maybe_unused const struct dev_pm_ops __static_##name
389385
#endif
390386

387+
#define EXPORT_DEV_PM_OPS(name) _EXPORT_DEV_PM_OPS(name, "", "")
388+
#define EXPORT_GPL_DEV_PM_OPS(name) _EXPORT_DEV_PM_OPS(name, "_gpl", "")
389+
#define EXPORT_NS_DEV_PM_OPS(name, ns) _EXPORT_DEV_PM_OPS(name, "", #ns)
390+
#define EXPORT_NS_GPL_DEV_PM_OPS(name, ns) _EXPORT_DEV_PM_OPS(name, "_gpl", #ns)
391+
391392
/*
392393
* Use this if you want to use the same suspend and resume callbacks for suspend
393394
* to RAM and hibernation.
@@ -399,13 +400,21 @@ static __maybe_unused _DEFINE_DEV_PM_OPS(__static_##name, suspend_fn, \
399400
_DEFINE_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL)
400401

401402
#define EXPORT_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
402-
_EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL, "", "")
403+
EXPORT_DEV_PM_OPS(name) = { \
404+
SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
405+
}
403406
#define EXPORT_GPL_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
404-
_EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL, "_gpl", "")
407+
EXPORT_GPL_DEV_PM_OPS(name) = { \
408+
SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
409+
}
405410
#define EXPORT_NS_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn, ns) \
406-
_EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL, "", #ns)
411+
EXPORT_NS_DEV_PM_OPS(name, ns) = { \
412+
SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
413+
}
407414
#define EXPORT_NS_GPL_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn, ns) \
408-
_EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL, "_gpl", #ns)
415+
EXPORT_NS_GPL_DEV_PM_OPS(name, ns) = { \
416+
SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
417+
}
409418

410419
/* Deprecated. Use DEFINE_SIMPLE_DEV_PM_OPS() instead. */
411420
#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \

include/linux/pm_runtime.h

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,21 @@
4040
resume_fn, idle_fn)
4141

4242
#define EXPORT_RUNTIME_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn) \
43-
_EXPORT_DEV_PM_OPS(name, pm_runtime_force_suspend, pm_runtime_force_resume, \
44-
suspend_fn, resume_fn, idle_fn, "", "")
43+
EXPORT_DEV_PM_OPS(name) = { \
44+
RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
45+
}
4546
#define EXPORT_GPL_RUNTIME_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn) \
46-
_EXPORT_DEV_PM_OPS(name, pm_runtime_force_suspend, pm_runtime_force_resume, \
47-
suspend_fn, resume_fn, idle_fn, "_gpl", "")
47+
EXPORT_GPL_DEV_PM_OPS(name) = { \
48+
RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
49+
}
4850
#define EXPORT_NS_RUNTIME_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn, ns) \
49-
_EXPORT_DEV_PM_OPS(name, pm_runtime_force_suspend, pm_runtime_force_resume, \
50-
suspend_fn, resume_fn, idle_fn, "", #ns)
51+
EXPORT_NS_DEV_PM_OPS(name, ns) = { \
52+
RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
53+
}
5154
#define EXPORT_NS_GPL_RUNTIME_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn, ns) \
52-
_EXPORT_DEV_PM_OPS(name, pm_runtime_force_suspend, pm_runtime_force_resume, \
53-
suspend_fn, resume_fn, idle_fn, "_gpl", #ns)
55+
EXPORT_NS_GPL_DEV_PM_OPS(name, ns) = { \
56+
RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
57+
}
5458

5559
#ifdef CONFIG_PM
5660
extern struct workqueue_struct *pm_wq;

tools/power/x86/turbostat/turbostat.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ unsigned int do_slm_cstates;
230230
unsigned int use_c1_residency_msr;
231231
unsigned int has_aperf;
232232
unsigned int has_epb;
233+
unsigned int has_turbo;
233234
unsigned int is_hybrid;
234235
unsigned int do_irtl_snb;
235236
unsigned int do_irtl_hsw;
@@ -4080,13 +4081,11 @@ static void remove_underbar(char *s)
40804081
*to = 0;
40814082
}
40824083

4083-
static void dump_cstate_pstate_config_info(unsigned int family, unsigned int model)
4084+
static void dump_turbo_ratio_info(unsigned int family, unsigned int model)
40844085
{
4085-
if (!do_nhm_platform_info)
4086+
if (!has_turbo)
40864087
return;
40874088

4088-
dump_nhm_platform_info();
4089-
40904089
if (has_hsw_turbo_ratio_limit(family, model))
40914090
dump_hsw_turbo_ratio_limits();
40924091

@@ -4108,7 +4107,15 @@ static void dump_cstate_pstate_config_info(unsigned int family, unsigned int mod
41084107

41094108
if (has_config_tdp(family, model))
41104109
dump_config_tdp();
4110+
}
4111+
4112+
static void dump_cstate_pstate_config_info(unsigned int family, unsigned int model)
4113+
{
4114+
if (!do_nhm_platform_info)
4115+
return;
41114116

4117+
dump_nhm_platform_info();
4118+
dump_turbo_ratio_info(family, model);
41124119
dump_nhm_cst_cfg();
41134120
}
41144121

@@ -4560,7 +4567,6 @@ static double rapl_dram_energy_units_probe(int model, double rapl_energy_units)
45604567
case INTEL_FAM6_SKYLAKE_X: /* SKX */
45614568
case INTEL_FAM6_XEON_PHI_KNL: /* KNL */
45624569
case INTEL_FAM6_ICELAKE_X: /* ICX */
4563-
case INTEL_FAM6_SAPPHIRERAPIDS_X: /* SPR */
45644570
return (rapl_dram_energy_units = 15.3 / 1000000);
45654571
default:
45664572
return (rapl_energy_units);
@@ -5447,6 +5453,9 @@ unsigned int intel_model_duplicates(unsigned int model)
54475453
case INTEL_FAM6_ALDERLAKE_N:
54485454
case INTEL_FAM6_RAPTORLAKE:
54495455
case INTEL_FAM6_RAPTORLAKE_P:
5456+
case INTEL_FAM6_RAPTORLAKE_S:
5457+
case INTEL_FAM6_METEORLAKE:
5458+
case INTEL_FAM6_METEORLAKE_L:
54505459
return INTEL_FAM6_CANNONLAKE_L;
54515460

54525461
case INTEL_FAM6_ATOM_TREMONT_L:
@@ -5505,7 +5514,6 @@ void process_cpuid()
55055514
{
55065515
unsigned int eax, ebx, ecx, edx;
55075516
unsigned int fms, family, model, stepping, ecx_flags, edx_flags;
5508-
unsigned int has_turbo;
55095517
unsigned long long ucode_patch = 0;
55105518

55115519
eax = ebx = ecx = edx = 0;
@@ -6217,7 +6225,7 @@ int get_and_dump_counters(void)
62176225

62186226
void print_version()
62196227
{
6220-
fprintf(outf, "turbostat version 2022.07.28 - Len Brown <[email protected]>\n");
6228+
fprintf(outf, "turbostat version 2022.10.04 - Len Brown <[email protected]>\n");
62216229
}
62226230

62236231
#define COMMAND_LINE_SIZE 2048

0 commit comments

Comments
 (0)