amd-pstate.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 <[email protected]>
  8. */
  9. #ifndef _LINUX_AMD_PSTATE_H
  10. #define _LINUX_AMD_PSTATE_H
  11. #include <linux/pm_qos.h>
  12. /*********************************************************************
  13. * AMD P-state INTERFACE *
  14. *********************************************************************/
  15. /**
  16. * struct amd_aperf_mperf
  17. * @aperf: actual performance frequency clock count
  18. * @mperf: maximum performance frequency clock count
  19. * @tsc: time stamp counter
  20. */
  21. struct amd_aperf_mperf {
  22. u64 aperf;
  23. u64 mperf;
  24. u64 tsc;
  25. };
  26. /**
  27. * struct amd_cpudata - private CPU data for AMD P-State
  28. * @cpu: CPU number
  29. * @req: constraint request to apply
  30. * @cppc_req_cached: cached performance request hints
  31. * @highest_perf: the maximum performance an individual processor may reach,
  32. * assuming ideal conditions
  33. * @nominal_perf: the maximum sustained performance level of the processor,
  34. * assuming ideal operating conditions
  35. * @lowest_nonlinear_perf: the lowest performance level at which nonlinear power
  36. * savings are achieved
  37. * @lowest_perf: the absolute lowest performance level of the processor
  38. * @max_freq: the frequency that mapped to highest_perf
  39. * @min_freq: the frequency that mapped to lowest_perf
  40. * @nominal_freq: the frequency that mapped to nominal_perf
  41. * @lowest_nonlinear_freq: the frequency that mapped to lowest_nonlinear_perf
  42. * @cur: Difference of Aperf/Mperf/tsc count between last and current sample
  43. * @prev: Last Aperf/Mperf/tsc count value read from register
  44. * @freq: current cpu frequency value
  45. * @boost_supported: check whether the Processor or SBIOS supports boost mode
  46. *
  47. * The amd_cpudata is key private data for each CPU thread in AMD P-State, and
  48. * represents all the attributes and goals that AMD P-State requests at runtime.
  49. */
  50. struct amd_cpudata {
  51. int cpu;
  52. struct freq_qos_request req[2];
  53. u64 cppc_req_cached;
  54. u32 highest_perf;
  55. u32 nominal_perf;
  56. u32 lowest_nonlinear_perf;
  57. u32 lowest_perf;
  58. u32 max_freq;
  59. u32 min_freq;
  60. u32 nominal_freq;
  61. u32 lowest_nonlinear_freq;
  62. struct amd_aperf_mperf cur;
  63. struct amd_aperf_mperf prev;
  64. u64 freq;
  65. bool boost_supported;
  66. };
  67. #endif /* _LINUX_AMD_PSTATE_H */