drivers/cpufreq/amd-pstate.h

Source file repositories/reference/linux-study-clean/drivers/cpufreq/amd-pstate.h

File Facts

System
Linux kernel
Corpus path
drivers/cpufreq/amd-pstate.h
Extension
.h
Size
5482 bytes
Lines
162
Domain
Driver Families
Bucket
drivers/cpufreq
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct amd_aperf_mperf {
	u64 aperf;
	u64 mperf;
	u64 tsc;
};

/**
 * struct amd_cpudata - private CPU data for AMD P-State
 * @cpu: CPU number
 * @req: constraint request to apply
 * @cppc_req_cached: cached performance request hints
 * @cppc_req2_cached: cached value of MSR_AMD_CPPC_REQ2
 * @perf: cached performance-related data
 * @prefcore_ranking: the preferred core ranking, the higher value indicates a higher
 * 		  priority.
 * @floor_perf_cnt: Cached value of the number of distinct floor
 *                  performance levels supported
 * @bios_floor_perf: Cached value of the boot-time floor performance level from
 *                   MSR_AMD_CPPC_REQ2
 * @min_limit_freq: Cached value of policy->min (in khz)
 * @max_limit_freq: Cached value of policy->max (in khz)
 * @nominal_freq: the frequency (in khz) that mapped to nominal_perf
 * @max_freq: in ideal conditions the maximum frequency (in khz) possible frequency
 * @lowest_nonlinear_freq: the frequency (in khz) that mapped to lowest_nonlinear_perf
 * @floor_freq: Cached value of the user requested floor_freq
 * @cur: Difference of Aperf/Mperf/tsc count between last and current sample
 * @prev: Last Aperf/Mperf/tsc count value read from register
 * @freq: current cpu frequency value (in khz)
 * @boost_supported: check whether the Processor or SBIOS supports boost mode
 * @hw_prefcore: check whether HW supports preferred core featue.
 * 		  Only when hw_prefcore and early prefcore param are true,
 * 		  AMD P-State driver supports preferred core featue.
 * @policy: Cpufreq policy value
 * @suspended: If CPU core if offlined
 * @epp_default_ac: Default EPP value for AC power source
 * @epp_default_dc: Default EPP value for DC power source
 * @dynamic_epp: Whether dynamic EPP is enabled
 * @power_nb: Notifier block for power events
 *
 * The amd_cpudata is key private data for each CPU thread in AMD P-State, and
 * represents all the attributes and goals that AMD P-State requests at runtime.
 */
struct amd_cpudata {
	int	cpu;

	struct	freq_qos_request req[2];
	u64	cppc_req_cached;
	u64	cppc_req2_cached;

	union perf_cached perf;

	u8	prefcore_ranking;
	u8	floor_perf_cnt;
	u8	bios_floor_perf;
	u32	min_limit_freq;
	u32	max_limit_freq;
	u32	nominal_freq;
	u32	max_freq;
	u32	lowest_nonlinear_freq;
	u32	floor_freq;

	struct amd_aperf_mperf cur;
	struct amd_aperf_mperf prev;

	u64	freq;
	bool	boost_supported;
	bool	hw_prefcore;

	/* EPP feature related attributes*/
	u32	policy;
	bool	suspended;
	u8	epp_default_ac;
	u8	epp_default_dc;
	bool	dynamic_epp;
	bool	raw_epp;
	struct notifier_block power_nb;

	/* platform profile */
	enum platform_profile_option current_profile;
	struct device *ppdev;
	char *profile_name;
};

/*
 * enum amd_pstate_mode - driver working mode of amd pstate
 */
enum amd_pstate_mode {
	AMD_PSTATE_UNDEFINED = 0,
	AMD_PSTATE_DISABLE,
	AMD_PSTATE_PASSIVE,

Annotation

Implementation Notes