mirror of
https://github.com/torvalds/linux.git
synced 2024-11-25 05:32:00 +00:00
02824a5fd1
- Remove LATENCY_MULTIPLIER from cpufreq (Qais Yousef). - Add support for Granite Rapids and Sierra Forest in OOB mode to the intel_pstate cpufreq driver (Srinivas Pandruvada). - Add basic support for CPU capacity scaling on x86 and make the intel_pstate driver set asymmetric CPU capacity on hybrid systems without SMT (Rafael Wysocki). - Add missing MODULE_DESCRIPTION() macros to the powerpc cpufreq driver (Jeff Johnson). - Several OF related cleanups in cpufreq drivers (Rob Herring). - Enable COMPILE_TEST for ARM drivers (Rob Herrring). - Introduce quirks for syscon failures and use socinfo to get revision for TI cpufreq driver (Dhruva Gole, Nishanth Menon). - Minor cleanups in amd-pstate driver (Anastasia Belova, Dhananjay Ugwekar). - Minor cleanups for loongson, cpufreq-dt and powernv cpufreq drivers (Danila Tikhonov, Huacai Chen, and Liu Jing). - Make amd-pstate validate return of any attempt to update EPP limits, which fixes the masking hardware problems (Mario Limonciello). - Move the calculation of the AMD boost numerator outside of amd-pstate, correcting acpi-cpufreq on systems with preferred cores (Mario Limonciello). - Harden preferred core detection in amd-pstate to avoid potential false positives (Mario Limonciello). - Add extra unit test coverage for mode state machine (Mario Limonciello). - Fix an "Uninitialized variables" issue in amd-pstste (Qianqiang Liu). - Add Granite Rapids Xeon support to intel_idle (Artem Bityutskiy). - Disable promotion to C1E on Jasper Lake and Elkhart Lake in intel_idle (Kai-Heng Feng). - Use scoped device node handling to fix missing of_node_put() and simplify walking OF children in the riscv-sbi cpuidle driver (Krzysztof Kozlowski). - Remove dead code from cpuidle_enter_state() (Dhruva Gole). - Change an error pointer to NULL to fix error handling in the intel_rapl power capping driver (Dan Carpenter). - Fix off by one in get_rpi() in the intel_rapl power capping driver (Dan Carpenter). - Add support for ArrowLake-U to the intel_rapl power capping driver (Sumeet Pawnikar). - Fix the energy-pkg event for AMD CPUs in the intel_rapl power capping driver (Dhananjay Ugwekar). - Add support for AMD family 1Ah processors to the intel_rapl power capping driver (Dhananjay Ugwekar). - Remove unused stub for saveable_highmem_page() and remove deprecated macros from power management documentation (Andy Shevchenko). - Use ysfs_emit() and sysfs_emit_at() in "show" functions in the PM sysfs interface (Xueqin Luo). - Update the maintainers information for the operating-points-v2-ti-cpu DT binding (Dhruva Gole). - Drop unnecessary of_match_ptr() from ti-opp-supply (Rob Herring). - Add missing MODULE_DESCRIPTION() macros to devfreq governors (Jeff Johnson). - Use devm_clk_get_enabled() in the exynos-bus devfreq driver (Anand Moon). - Use of_property_present() instead of of_get_property() in the imx-bus devfreq driver (Rob Herring). - Update directory handling and installation process in the pm-graph Makefile and add .gitignore to ignore sleepgraph.py artifacts to pm-graph (Amit Vadhavana, Yo-Jung Lin). - Make cpupower display residency value in idle-info (Aboorva Devarajan). - Add missing powercap_set_enabled() stub function to cpupower (John B. Wyatt IV). - Add SWIG support to cpupower (John B. Wyatt IV). -----BEGIN PGP SIGNATURE----- iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAmbjKEQSHHJqd0Byand5 c29ja2kubmV0AAoJEILEb/54YlRx8g8P/1RqL6NuCxH4eobwZigeyBS6/sLHPmKo wqHcerZsU7EH8DOlmBU0SH1Br2WBQAbaP8d1ukT5qkGBrZ+IM/A2ipZct0yAHH2D aBKwg7V3LvXo2mPuLve0knpM6W7zibPHJJlcjh8DmGQJabhWO7jr+p/0eS4JE2ek iE5FCXTxhvbcNJ9yWSt7+3HHmvj74P81As7txysLSzhWSZDcqXb0XJRgVJnWDt+x OyTAMEEAY2BuqmijHzqxxHcA1fxOBK/pa9yfPdKP7ePynLnpP7xd9A5oLbXQ4BL9 PHqpD06ZBdSMQzKkyCODypZt8PL+FcEALE4u9chV/nzVwp7TrtDneXWA7RA0GXgq mp9hm51GmdptRayePR3s4TCA6a2BUw3Ue4fgs6XF/bexNpc3nx0wtP8HEevcuy8q Z7XQkpqW942vOohfoN42JwTjfDJhYTwSH3dcIY8UghHtzwZ5YKV1M4f97kNR7V2i QLJvaGJ5yTTcaHndkpc4EKknPyLRaWPh8h/yVmMRBcAaGBWaImul3a5NI07f0wLM LTenlpEcls7WSu9n3uvFXvT7nSS2CBV0huTbg449X4T2J0T6EooYsVuHNsFMNFLy Xm3lUtdm5QjAXFf+azOCO+26XQt8wObC0ttZtCC2j1b8D+9Riuwh5QHLr99rRTzn 7Ic4U5Lkimzx =JM+K -----END PGP SIGNATURE----- Merge tag 'pm-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm Pull power management updates from Rafael Wysocki: "By the number of new lines of code, the most visible change here is the addition of hybrid CPU capacity scaling support to the intel_pstate driver. Next are the amd-pstate driver changes related to the calculation of the AMD boost numerator and preferred core detection. As far as new hardware support is concerned, the intel_idle driver will now handle Granite Rapids Xeon processors natively, the intel_rapl power capping driver will recognize family 1Ah of AMD processors and Intel ArrowLake-U chipos, and intel_pstate will handle Granite Rapids and Sierra Forest chips in the out-of-band (OOB) mode. Apart from the above, there is a usual collection of assorted fixes and code cleanups in many places and there are tooling updates. Specifics: - Remove LATENCY_MULTIPLIER from cpufreq (Qais Yousef) - Add support for Granite Rapids and Sierra Forest in OOB mode to the intel_pstate cpufreq driver (Srinivas Pandruvada) - Add basic support for CPU capacity scaling on x86 and make the intel_pstate driver set asymmetric CPU capacity on hybrid systems without SMT (Rafael Wysocki) - Add missing MODULE_DESCRIPTION() macros to the powerpc cpufreq driver (Jeff Johnson) - Several OF related cleanups in cpufreq drivers (Rob Herring) - Enable COMPILE_TEST for ARM drivers (Rob Herrring) - Introduce quirks for syscon failures and use socinfo to get revision for TI cpufreq driver (Dhruva Gole, Nishanth Menon) - Minor cleanups in amd-pstate driver (Anastasia Belova, Dhananjay Ugwekar) - Minor cleanups for loongson, cpufreq-dt and powernv cpufreq drivers (Danila Tikhonov, Huacai Chen, and Liu Jing) - Make amd-pstate validate return of any attempt to update EPP limits, which fixes the masking hardware problems (Mario Limonciello) - Move the calculation of the AMD boost numerator outside of amd-pstate, correcting acpi-cpufreq on systems with preferred cores (Mario Limonciello) - Harden preferred core detection in amd-pstate to avoid potential false positives (Mario Limonciello) - Add extra unit test coverage for mode state machine (Mario Limonciello) - Fix an "Uninitialized variables" issue in amd-pstste (Qianqiang Liu) - Add Granite Rapids Xeon support to intel_idle (Artem Bityutskiy) - Disable promotion to C1E on Jasper Lake and Elkhart Lake in intel_idle (Kai-Heng Feng) - Use scoped device node handling to fix missing of_node_put() and simplify walking OF children in the riscv-sbi cpuidle driver (Krzysztof Kozlowski) - Remove dead code from cpuidle_enter_state() (Dhruva Gole) - Change an error pointer to NULL to fix error handling in the intel_rapl power capping driver (Dan Carpenter) - Fix off by one in get_rpi() in the intel_rapl power capping driver (Dan Carpenter) - Add support for ArrowLake-U to the intel_rapl power capping driver (Sumeet Pawnikar) - Fix the energy-pkg event for AMD CPUs in the intel_rapl power capping driver (Dhananjay Ugwekar) - Add support for AMD family 1Ah processors to the intel_rapl power capping driver (Dhananjay Ugwekar) - Remove unused stub for saveable_highmem_page() and remove deprecated macros from power management documentation (Andy Shevchenko) - Use ysfs_emit() and sysfs_emit_at() in "show" functions in the PM sysfs interface (Xueqin Luo) - Update the maintainers information for the operating-points-v2-ti-cpu DT binding (Dhruva Gole) - Drop unnecessary of_match_ptr() from ti-opp-supply (Rob Herring) - Add missing MODULE_DESCRIPTION() macros to devfreq governors (Jeff Johnson) - Use devm_clk_get_enabled() in the exynos-bus devfreq driver (Anand Moon) - Use of_property_present() instead of of_get_property() in the imx-bus devfreq driver (Rob Herring) - Update directory handling and installation process in the pm-graph Makefile and add .gitignore to ignore sleepgraph.py artifacts to pm-graph (Amit Vadhavana, Yo-Jung Lin) - Make cpupower display residency value in idle-info (Aboorva Devarajan) - Add missing powercap_set_enabled() stub function to cpupower (John B. Wyatt IV) - Add SWIG support to cpupower (John B. Wyatt IV)" * tag 'pm-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (62 commits) cpufreq/amd-pstate-ut: Fix an "Uninitialized variables" issue cpufreq/amd-pstate-ut: Add test case for mode switches cpufreq/amd-pstate: Export symbols for changing modes amd-pstate: Add missing documentation for `amd_pstate_prefcore_ranking` cpufreq: amd-pstate: Add documentation for `amd_pstate_hw_prefcore` cpufreq: amd-pstate: Optimize amd_pstate_update_limits() cpufreq: amd-pstate: Merge amd_pstate_highest_perf_set() into amd_get_boost_ratio_numerator() x86/amd: Detect preferred cores in amd_get_boost_ratio_numerator() x86/amd: Move amd_get_highest_perf() out of amd-pstate ACPI: CPPC: Adjust debug messages in amd_set_max_freq_ratio() to warn ACPI: CPPC: Drop check for non zero perf ratio x86/amd: Rename amd_get_highest_perf() to amd_get_boost_ratio_numerator() ACPI: CPPC: Adjust return code for inline functions in !CONFIG_ACPI_CPPC_LIB x86/amd: Move amd_get_highest_perf() from amd.c to cppc.c PM: hibernate: Remove unused stub for saveable_highmem_page() pm:cpupower: Add error warning when SWIG is not installed MAINTAINERS: Add Maintainers for SWIG Python bindings pm:cpupower: Include test_raw_pylibcpupower.py pm:cpupower: Add SWIG bindings files for libcpupower pm:cpupower: Add missing powercap_set_enabled() stub function ...
255 lines
6.2 KiB
C
255 lines
6.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* CPPC (Collaborative Processor Performance Control) methods used
|
|
* by CPUfreq drivers.
|
|
*
|
|
* (C) Copyright 2014, 2015 Linaro Ltd.
|
|
* Author: Ashwin Chaugule <ashwin.chaugule@linaro.org>
|
|
*/
|
|
|
|
#ifndef _CPPC_ACPI_H
|
|
#define _CPPC_ACPI_H
|
|
|
|
#include <linux/acpi.h>
|
|
#include <linux/cpufreq.h>
|
|
#include <linux/types.h>
|
|
|
|
#include <acpi/pcc.h>
|
|
#include <acpi/processor.h>
|
|
|
|
/* CPPCv2 and CPPCv3 support */
|
|
#define CPPC_V2_REV 2
|
|
#define CPPC_V3_REV 3
|
|
#define CPPC_V2_NUM_ENT 21
|
|
#define CPPC_V3_NUM_ENT 23
|
|
|
|
#define PCC_CMD_COMPLETE_MASK (1 << 0)
|
|
#define PCC_ERROR_MASK (1 << 2)
|
|
|
|
#define MAX_CPC_REG_ENT 21
|
|
|
|
/* CPPC specific PCC commands. */
|
|
#define CMD_READ 0
|
|
#define CMD_WRITE 1
|
|
|
|
/* Each register has the folowing format. */
|
|
struct cpc_reg {
|
|
u8 descriptor;
|
|
u16 length;
|
|
u8 space_id;
|
|
u8 bit_width;
|
|
u8 bit_offset;
|
|
u8 access_width;
|
|
u64 address;
|
|
} __packed;
|
|
|
|
/*
|
|
* Each entry in the CPC table is either
|
|
* of type ACPI_TYPE_BUFFER or
|
|
* ACPI_TYPE_INTEGER.
|
|
*/
|
|
struct cpc_register_resource {
|
|
acpi_object_type type;
|
|
u64 __iomem *sys_mem_vaddr;
|
|
union {
|
|
struct cpc_reg reg;
|
|
u64 int_value;
|
|
} cpc_entry;
|
|
};
|
|
|
|
/* Container to hold the CPC details for each CPU */
|
|
struct cpc_desc {
|
|
int num_entries;
|
|
int version;
|
|
int cpu_id;
|
|
int write_cmd_status;
|
|
int write_cmd_id;
|
|
/* Lock used for RMW operations in cpc_write() */
|
|
spinlock_t rmw_lock;
|
|
struct cpc_register_resource cpc_regs[MAX_CPC_REG_ENT];
|
|
struct acpi_psd_package domain_info;
|
|
struct kobject kobj;
|
|
};
|
|
|
|
/* These are indexes into the per-cpu cpc_regs[]. Order is important. */
|
|
enum cppc_regs {
|
|
HIGHEST_PERF,
|
|
NOMINAL_PERF,
|
|
LOW_NON_LINEAR_PERF,
|
|
LOWEST_PERF,
|
|
GUARANTEED_PERF,
|
|
DESIRED_PERF,
|
|
MIN_PERF,
|
|
MAX_PERF,
|
|
PERF_REDUC_TOLERANCE,
|
|
TIME_WINDOW,
|
|
CTR_WRAP_TIME,
|
|
REFERENCE_CTR,
|
|
DELIVERED_CTR,
|
|
PERF_LIMITED,
|
|
ENABLE,
|
|
AUTO_SEL_ENABLE,
|
|
AUTO_ACT_WINDOW,
|
|
ENERGY_PERF,
|
|
REFERENCE_PERF,
|
|
LOWEST_FREQ,
|
|
NOMINAL_FREQ,
|
|
};
|
|
|
|
/*
|
|
* Categorization of registers as described
|
|
* in the ACPI v.5.1 spec.
|
|
* XXX: Only filling up ones which are used by governors
|
|
* today.
|
|
*/
|
|
struct cppc_perf_caps {
|
|
u32 guaranteed_perf;
|
|
u32 highest_perf;
|
|
u32 nominal_perf;
|
|
u32 lowest_perf;
|
|
u32 lowest_nonlinear_perf;
|
|
u32 lowest_freq;
|
|
u32 nominal_freq;
|
|
u32 energy_perf;
|
|
bool auto_sel;
|
|
};
|
|
|
|
struct cppc_perf_ctrls {
|
|
u32 max_perf;
|
|
u32 min_perf;
|
|
u32 desired_perf;
|
|
u32 energy_perf;
|
|
};
|
|
|
|
struct cppc_perf_fb_ctrs {
|
|
u64 reference;
|
|
u64 delivered;
|
|
u64 reference_perf;
|
|
u64 wraparound_time;
|
|
};
|
|
|
|
/* Per CPU container for runtime CPPC management. */
|
|
struct cppc_cpudata {
|
|
struct list_head node;
|
|
struct cppc_perf_caps perf_caps;
|
|
struct cppc_perf_ctrls perf_ctrls;
|
|
struct cppc_perf_fb_ctrs perf_fb_ctrs;
|
|
unsigned int shared_type;
|
|
cpumask_var_t shared_cpu_map;
|
|
};
|
|
|
|
#ifdef CONFIG_ACPI_CPPC_LIB
|
|
extern int cppc_get_desired_perf(int cpunum, u64 *desired_perf);
|
|
extern int cppc_get_nominal_perf(int cpunum, u64 *nominal_perf);
|
|
extern int cppc_get_highest_perf(int cpunum, u64 *highest_perf);
|
|
extern int cppc_get_perf_ctrs(int cpu, struct cppc_perf_fb_ctrs *perf_fb_ctrs);
|
|
extern int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls);
|
|
extern int cppc_set_enable(int cpu, bool enable);
|
|
extern int cppc_get_perf_caps(int cpu, struct cppc_perf_caps *caps);
|
|
extern bool cppc_perf_ctrs_in_pcc(void);
|
|
extern unsigned int cppc_perf_to_khz(struct cppc_perf_caps *caps, unsigned int perf);
|
|
extern unsigned int cppc_khz_to_perf(struct cppc_perf_caps *caps, unsigned int freq);
|
|
extern bool acpi_cpc_valid(void);
|
|
extern bool cppc_allow_fast_switch(void);
|
|
extern int acpi_get_psd_map(unsigned int cpu, struct cppc_cpudata *cpu_data);
|
|
extern unsigned int cppc_get_transition_latency(int cpu);
|
|
extern bool cpc_ffh_supported(void);
|
|
extern bool cpc_supported_by_cpu(void);
|
|
extern int cpc_read_ffh(int cpunum, struct cpc_reg *reg, u64 *val);
|
|
extern int cpc_write_ffh(int cpunum, struct cpc_reg *reg, u64 val);
|
|
extern int cppc_get_epp_perf(int cpunum, u64 *epp_perf);
|
|
extern int cppc_set_epp_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls, bool enable);
|
|
extern int cppc_get_auto_sel_caps(int cpunum, struct cppc_perf_caps *perf_caps);
|
|
extern int cppc_set_auto_sel(int cpu, bool enable);
|
|
extern int amd_get_highest_perf(unsigned int cpu, u32 *highest_perf);
|
|
extern int amd_get_boost_ratio_numerator(unsigned int cpu, u64 *numerator);
|
|
extern int amd_detect_prefcore(bool *detected);
|
|
#else /* !CONFIG_ACPI_CPPC_LIB */
|
|
static inline int cppc_get_desired_perf(int cpunum, u64 *desired_perf)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
static inline int cppc_get_nominal_perf(int cpunum, u64 *nominal_perf)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
static inline int cppc_get_highest_perf(int cpunum, u64 *highest_perf)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
static inline int cppc_get_perf_ctrs(int cpu, struct cppc_perf_fb_ctrs *perf_fb_ctrs)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
static inline int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
static inline int cppc_set_enable(int cpu, bool enable)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
static inline int cppc_get_perf_caps(int cpu, struct cppc_perf_caps *caps)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
static inline bool cppc_perf_ctrs_in_pcc(void)
|
|
{
|
|
return false;
|
|
}
|
|
static inline bool acpi_cpc_valid(void)
|
|
{
|
|
return false;
|
|
}
|
|
static inline bool cppc_allow_fast_switch(void)
|
|
{
|
|
return false;
|
|
}
|
|
static inline unsigned int cppc_get_transition_latency(int cpu)
|
|
{
|
|
return CPUFREQ_ETERNAL;
|
|
}
|
|
static inline bool cpc_ffh_supported(void)
|
|
{
|
|
return false;
|
|
}
|
|
static inline int cpc_read_ffh(int cpunum, struct cpc_reg *reg, u64 *val)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
static inline int cpc_write_ffh(int cpunum, struct cpc_reg *reg, u64 val)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
static inline int cppc_set_epp_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls, bool enable)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
static inline int cppc_get_epp_perf(int cpunum, u64 *epp_perf)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
static inline int cppc_set_auto_sel(int cpu, bool enable)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
static inline int cppc_get_auto_sel_caps(int cpunum, struct cppc_perf_caps *perf_caps)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
static inline int amd_get_highest_perf(unsigned int cpu, u32 *highest_perf)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
static inline int amd_get_boost_ratio_numerator(unsigned int cpu, u64 *numerator)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
static inline int amd_detect_prefcore(bool *detected)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
#endif /* !CONFIG_ACPI_CPPC_LIB */
|
|
|
|
#endif /* _CPPC_ACPI_H*/
|