Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * linux/include/linux/amd-pstate.h
4 *
5 * Copyright (C) 2022 Advanced Micro Devices, Inc.
6 *
7 * Author: Meng Li <li.meng@amd.com>
8 */
9
10#ifndef _LINUX_AMD_PSTATE_H
11#define _LINUX_AMD_PSTATE_H
12
13#include <linux/pm_qos.h>
14
15/*********************************************************************
16 * AMD P-state INTERFACE *
17 *********************************************************************/
18/**
19 * struct amd_aperf_mperf
20 * @aperf: actual performance frequency clock count
21 * @mperf: maximum performance frequency clock count
22 * @tsc: time stamp counter
23 */
24struct amd_aperf_mperf {
25 u64 aperf;
26 u64 mperf;
27 u64 tsc;
28};
29
30/**
31 * struct amd_cpudata - private CPU data for AMD P-State
32 * @cpu: CPU number
33 * @req: constraint request to apply
34 * @cppc_req_cached: cached performance request hints
35 * @highest_perf: the maximum performance an individual processor may reach,
36 * assuming ideal conditions
37 * @nominal_perf: the maximum sustained performance level of the processor,
38 * assuming ideal operating conditions
39 * @lowest_nonlinear_perf: the lowest performance level at which nonlinear power
40 * savings are achieved
41 * @lowest_perf: the absolute lowest performance level of the processor
42 * @max_freq: the frequency that mapped to highest_perf
43 * @min_freq: the frequency that mapped to lowest_perf
44 * @nominal_freq: the frequency that mapped to nominal_perf
45 * @lowest_nonlinear_freq: the frequency that mapped to lowest_nonlinear_perf
46 * @cur: Difference of Aperf/Mperf/tsc count between last and current sample
47 * @prev: Last Aperf/Mperf/tsc count value read from register
48 * @freq: current cpu frequency value
49 * @boost_supported: check whether the Processor or SBIOS supports boost mode
50 *
51 * The amd_cpudata is key private data for each CPU thread in AMD P-State, and
52 * represents all the attributes and goals that AMD P-State requests at runtime.
53 */
54struct amd_cpudata {
55 int cpu;
56
57 struct freq_qos_request req[2];
58 u64 cppc_req_cached;
59
60 u32 highest_perf;
61 u32 nominal_perf;
62 u32 lowest_nonlinear_perf;
63 u32 lowest_perf;
64
65 u32 max_freq;
66 u32 min_freq;
67 u32 nominal_freq;
68 u32 lowest_nonlinear_freq;
69
70 struct amd_aperf_mperf cur;
71 struct amd_aperf_mperf prev;
72
73 u64 freq;
74 bool boost_supported;
75};
76
77#endif /* _LINUX_AMD_PSTATE_H */