AI Trajectory


Trajectory: (Expand/Collapse All)
Seq Timestamp Type Name Duration
0/0 2026/09/20 09:51 flow patch-triage
1m Args:
null

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [],
  "KMSANReasoning": "",
  "NeedsKMSAN": false,
  "Reasoning": "The patch modifies `shmem_init_perf()` in `drivers/cpufreq/amd-pstate.c`. The `amd-pstate` driver is a cpufreq driver for physical AMD processors that requires AMD CPU features (X86_FEATURE_HW_PSTATE) and firmware ACPI _CPC table objects (acpi_cpc_valid()). Standard virtualized fuzzing environments (such as QEMU or GCE) do not emulate AMD HW-PState or provide CPPC ACPI objects, so `amd_pstate_init()` aborts during boot with -ENODEV or -EOPNOTSUPP. Furthermore, `shmem_init_perf()` specifically runs on systems using ACPI shared-memory CPPC (Zen 2 platforms lacking MSR-based CPPC). The modified code is therefore structurally unreachable in standard virtualized environments.",
  "WorthFuzzing": false
}

1/1 2026/09/20 09:51 action read-patch-diff
0m Args:
null

Results:
{
  "PatchDiff": "commit 512a015fdd4f92db35d6fab8762361fc69e3be5e\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate:   Sun Sep 20 09:51:30 2026 +0000\n\n    syz-cluster: applied patch under review\n\ndiff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c\nindex 3a6b4b224a66d..91ec44f9fbb96 100644\n--- a/drivers/cpufreq/amd-pstate.c\n+++ b/drivers/cpufreq/amd-pstate.c\n@@ -535,6 +535,9 @@ static int shmem_init_perf(struct amd_cpudata *cpudata)\n \t\treturn 0;\n \t}\n \n+\tif ((cppc_state != AMD_PSTATE_PASSIVE) == auto_sel)\n+\t\treturn 0;\n+\n \tret = cppc_set_auto_sel(cpudata-\u003ecpu,\n \t\t\t(cppc_state == AMD_PSTATE_PASSIVE) ? 0 : 1);\n \n"
}

2/1 2026/09/20 09:51 agent patch-evaluator
1m Model:
core

Args:
null

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [],
  "Reasoning": "The patch modifies `shmem_init_perf()` in `drivers/cpufreq/amd-pstate.c`. The `amd-pstate` driver is a cpufreq driver for physical AMD processors that requires AMD CPU features (X86_FEATURE_HW_PSTATE) and firmware ACPI _CPC table objects (acpi_cpc_valid()). Standard virtualized fuzzing environments (such as QEMU or GCE) do not emulate AMD HW-PState or provide CPPC ACPI objects, so `amd_pstate_init()` aborts during boot with -ENODEV or -EOPNOTSUPP. Furthermore, `shmem_init_perf()` specifically runs on systems using ACPI shared-memory CPPC (Zen 2 platforms lacking MSR-based CPPC). The modified code is therefore structurally unreachable in standard virtualized environments.",
  "WorthFuzzing": false
}

Instruction:
You are an expert Linux kernel maintainer and security engineer.
Your job is to review a provided patch series and evaluate whether it warrants fuzzing with syzkaller.

IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in
your workspace. Do NOT rely on internal assumptions. You must actively use your code access
tools to inspect the actual source code, callers, and surrounding context.

================================================================================
1. CORE TRIAGE PHILOSOPHY
================================================================================
The goal of patch fuzzing is to discover crashes, regressions, exposed latent bugs,
and newly triggered assertions introduced by the patch series.

- REACHABILITY IS THE PRIMARY GATE:
  Fuzzing can only discover bugs in code that can actually execute in standard virtualized
  environments (GCE or QEMU, utilizing software-emulated devices like USB gadgets, netdev, tun/tap).
  If the modified code is structurally unreachable (see Section 2), it MUST NOT be fuzzed,
  regardless of whether it adds assertions or complex logic.

- DO NOT BLINDLY TRUST "NO FUNCTIONAL CHANGE" (NFCI) OR "REFACTORING" CLAIMS:
  Patch authors routinely label changes as "cleanups", "refactorings", or state
  "No functional change intended". Do NOT take these claims at face value.
  Code refactorings that rearrange logic, introduce helper functions, or alter state management
  in core subsystems frequently introduce subtle semantic shifts or uncover latent kernel bugs.
  If reachable executable code is modified or refactored, it MUST be fuzzed.

- NEW OR MODIFIED ASSERTIONS IN REACHABLE CODE MUST BE FUZZED:
  When a patch introduces or modifies runtime checks or assertions (e.g., WARN_ON*, VM_WARN_ON*,
  BUG_ON*, lockdep_assert*) in reachable code paths, it enforces new or stricter invariants.
  Even if the author believes the invariant always holds, fuzzing is essential to verify whether
  an unusual sequence of operations can violate it.

================================================================================
2. WHEN TO RETURN WorthFuzzing=false (NEGATIVE CRITERIA)
================================================================================
Return WorthFuzzing=false ONLY IF all modified code falls strictly into one or more of these categories:

- Non-kernel and non-executable changes:
  * Modifications to Documentation/, comments, or spelling fixes.
  * User-space directories, self-tests, samples, or scripts (e.g., tools/, samples/, scripts/, usr/)
    that do not affect the compiled kernel image (vmlinux) or kernel modules.
  * Purely decorative logging (e.g., message strings in pr_err, printk, dev_info) or tracepoints
    that do not alter control flow or data structures.
  * Build system or Kconfig changes that do not alter compiled C logic.
- Structurally unreachable hardware:
  * Vendor-specific PCIe switches, SmartNICs, or GPU drivers (e.g., mlxsw, pds_core, qed,
    ionic, amdgpu) requiring physical ASIC/PCIe cards not emulated in standard QEMU.
- Unreachable execution paths:
  * Driver teardown callbacks (.remove, .shutdown, pci_unregister_driver) executed only during
    physical PCI hot-unplug or manual sysfs driver unbinding.
  * Code paths exclusive to architectures other than the target architecture.

================================================================================
3. WHEN TO RETURN WorthFuzzing=true (POSITIVE CRITERIA)
================================================================================
Return WorthFuzzing=true whenever the patch touches reachable executable code, including:
- Core Subsystems:
  * Any logic modifications in memory management (mm/), synchronization/locking (kernel/locking/),
    BPF, scheduler, core networking, VFS, or syscall handling.
- Refactorings and Code Cleanups:
  * Any restructuring of reachable data structures, helper abstractions, or algorithm flows.
- Runtime Assertions and Defensive Checks:
  * Any introduction or alteration of assertions (WARN_ON*, VM_WARN_ON*, BUG_ON*, etc.) in reachable paths.
- Reachable Drivers and Protocols:
  * Drivers accessible via virtual buses (virtio, USB gadget, loopback, netlink, binder, sockets, etc.).

================================================================================
4. EXTRACTING FocusSymbols (PREVENTING DILUTION)
================================================================================
When WorthFuzzing=true, you must extract specific kernel functions into FocusSymbols to guide the fuzzer:

- AVOID UBIQUITOUS LIFECYCLE HOT-PATHS:
  Do NOT list generic, ubiquitous functions called by almost every program in the corpus
  (including, but not limited to: general memory allocators and deallocators, page fault
  and trap handlers, or core synchronization primitives; this is not an exhaustive list).
  Listing ubiquitous functions causes the fuzzer to classify thousands of unrelated tests as "focused",
  which severely dilutes fuzzing effort away from the actual changes.

- TARGET SPECIFIC FEATURE LOGIC AND ENTRYPOINTS:
  List functions that specifically implement the logic being added or altered, or direct API entrypoints
  for the subsystem feature under review.

- HANDLING STATIC INLINE FUNCTIONS IN HEADERS (.h):
  Compiler-inlined static functions (such as static inlines in mm/*.h or include/linux/*.h) lack
  distinct symbol addresses in vmlinux and cannot be targeted directly by symbol coverage filters.
  If the changes are primarily in static inline helpers, identify non-static, feature-specific caller
  functions in .c files that exercise them (avoiding ubiquitous lifecycle wrappers).

================================================================================
5. IDENTIFYING EnableConfigs
================================================================================
Identify any specific CONFIG_ options required to properly compile and reach the modified code:
- Inspect Kconfig files and #ifdef guards; do not make assumptions.
- Check "depends on" lines in Kconfig to include any non-standard parent subsystem configs needed.
- Strip any 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4").
Prefer calling several tools at the same time to save round-trips.


Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.

Prompt:
Target architecture: amd64

For your convenience, here is the diff of the changes:
commit 512a015fdd4f92db35d6fab8762361fc69e3be5e
Author: syz-cluster <triage@syzkaller.com>
Date:   Sun Sep 20 09:51:30 2026 +0000

    syz-cluster: applied patch under review

diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index 3a6b4b224a66d..91ec44f9fbb96 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -535,6 +535,9 @@ static int shmem_init_perf(struct amd_cpudata *cpudata)
 		return 0;
 	}
 
+	if ((cppc_state != AMD_PSTATE_PASSIVE) == auto_sel)
+		return 0;
+
 	ret = cppc_set_auto_sel(cpudata->cpu,
 			(cppc_state == AMD_PSTATE_PASSIVE) ? 0 : 1);
 

3/2 2026/09/20 09:51 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 2885
							output: 40
							thoughts: 162
						

Thoughts:
**Analyzing the AMD-PState Driver Patch**

Alright, let's dive into this. The diff points us to a change in `drivers/cpufreq/amd-pstate.c`. It looks like we're looking at modifications within `shmem_init_perf`. Specifically, I see an added conditional check:

```c
+	if ((cppc_state != AMD_PSTATE_PASSIVE) == auto_sel)
+		return 0;
+
 	ret = cppc_set_auto_sel(cpudata->cpu,
 			(cppc_state == AMD_PSTATE_PASSIVE) ? 0 : 1);
```

Okay, so we're comparing `cppc_state` with `auto_sel` and short circuiting `cppc_set_auto_sel` with a `return 0` depending on the outcome of the comparison. My intuition says that this is likely optimizing a call or addressing a possible redundant call. The goal seems to be avoiding calling `cppc_set_auto_sel` when the desired `auto_sel` setting is already in place.

Let's do a quick check around line 535 to see the context of this function call. I need the surrounding code to understand the precise implications of this change. It would be good to see how `cppc_state` and `auto_sel` are defined and how they relate to the underlying CPPC implementation. I'll need to know whether `auto_sel` is a locally cached value, or dynamically derived.



4/2 2026/09/20 09:51 tool read-file
0m Args:
{
  "File": "drivers/cpufreq/amd-pstate.c",
  "FirstLine": 520,
  "LineCount": 40
}

Results:
{
  "Contents": " 520:\t\tperf.highest_perf = numerator;\n 521:\t\tperf.max_limit_perf = numerator;\n 522:\t\tperf.min_limit_perf = cppc_perf.lowest_perf;\n 523:\t\tperf.nominal_perf = cppc_perf.nominal_perf;\n 524:\t\tperf.lowest_nonlinear_perf = cppc_perf.lowest_nonlinear_perf;\n 525:\t\tperf.lowest_perf = cppc_perf.lowest_perf;\n 526:\t\tWRITE_ONCE(cpudata-\u003eperf, perf);\n 527:\t\tWRITE_ONCE(cpudata-\u003eprefcore_ranking, cppc_perf.highest_perf);\n 528:\t\n 529:\t\tif (cppc_state == AMD_PSTATE_ACTIVE)\n 530:\t\t\treturn 0;\n 531:\t\n 532:\t\tret = cppc_get_auto_sel(cpudata-\u003ecpu, \u0026auto_sel);\n 533:\t\tif (ret) {\n 534:\t\t\tpr_warn(\"failed to get auto_sel, ret: %d\\n\", ret);\n 535:\t\t\treturn 0;\n 536:\t\t}\n 537:\t\n 538:\t\tif ((cppc_state != AMD_PSTATE_PASSIVE) == auto_sel)\n 539:\t\t\treturn 0;\n 540:\t\n 541:\t\tret = cppc_set_auto_sel(cpudata-\u003ecpu,\n 542:\t\t\t\t(cppc_state == AMD_PSTATE_PASSIVE) ? 0 : 1);\n 543:\t\n 544:\t\tif (ret)\n 545:\t\t\tpr_warn(\"failed to set auto_sel, ret: %d\\n\", ret);\n 546:\t\n 547:\t\treturn ret;\n 548:\t}\n 549:\t\n 550:\tDEFINE_STATIC_CALL(amd_pstate_init_perf, msr_init_perf);\n 551:\t\n 552:\tstatic inline int amd_pstate_init_perf(struct amd_cpudata *cpudata)\n 553:\t{\n 554:\t\treturn static_call(amd_pstate_init_perf)(cpudata);\n 555:\t}\n 556:\t\n 557:\tstatic int shmem_update_perf(struct cpufreq_policy *policy, u8 min_perf,\n 558:\t\t\t\t     u8 des_perf, u8 max_perf, u8 epp, bool fast_switch)\n 559:\t{\n"
}

5/2 2026/09/20 09:51 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 4112
							output: 30
							thoughts: 83
						

Thoughts:
**Investigating AMD P-State Driver Compatibility**

Okay, so I'm looking at `amd-pstate.c`, the frequency scaling driver for AMD processors. The immediate question in my mind is, does this thing play nicely in virtualized environments like standard QEMU or Google Compute Engine? Or am I going to be hitting a wall because it's expecting specific AMD hardware, the right CPPC ACPI tables, or a particular AMD CPU?

Time to dig into the kernel source. I'll start with `drivers/cpufreq/Kconfig` to get a handle on the build configuration, and then trace the initialization process of `amd-pstate`. Hopefully, this will give me a clear picture of its dependencies and any potential gotchas in a virtualized setting. Let's see what we can find.



6/2 2026/09/20 09:51 tool grepper
0m Args:
{
  "Expression": "amd_pstate",
  "PathPrefix": "drivers/cpufreq/"
}

Results:
{
  "Output": "\nFull output is too long, showing 500 out of 1076 lines.\nUse more precise expression if possible.\n\ndrivers/cpufreq/Makefile=24=CFLAGS_powernv-cpufreq.o                := -I$(src)\ndrivers/cpufreq/Makefile:25:amd_pstate-y\t\t\t\t:= amd-pstate.o amd-pstate-trace.o\ndrivers/cpufreq/Makefile-26-\n--\ndrivers/cpufreq/Makefile=34=obj-$(CONFIG_X86_ACPI_CPUFREQ)\t\t+= acpi-cpufreq.o\ndrivers/cpufreq/Makefile:35:obj-$(CONFIG_X86_AMD_PSTATE)\t\t+= amd_pstate.o\ndrivers/cpufreq/Makefile-36-obj-$(CONFIG_X86_AMD_PSTATE_UT)\t\t+= amd-pstate-ut.o\n--\ndrivers/cpufreq/amd-pstate-trace.h-24-\ndrivers/cpufreq/amd-pstate-trace.h:25:TRACE_EVENT(amd_pstate_perf,\ndrivers/cpufreq/amd-pstate-trace.h-26-\n--\ndrivers/cpufreq/amd-pstate-trace.h-85-\ndrivers/cpufreq/amd-pstate-trace.h:86:TRACE_EVENT(amd_pstate_epp_perf,\ndrivers/cpufreq/amd-pstate-trace.h-87-\n--\ndrivers/cpufreq/amd-pstate-trace.h-135-\ndrivers/cpufreq/amd-pstate-trace.h:136:TRACE_EVENT(amd_pstate_cppc_req2,\ndrivers/cpufreq/amd-pstate-trace.h-137-\n--\ndrivers/cpufreq/amd-pstate-ut.c=45=DEFINE_FREE(cleanup_page, void *, if (_T) free_page((unsigned long)_T))\ndrivers/cpufreq/amd-pstate-ut.c-46-\ndrivers/cpufreq/amd-pstate-ut.c:47:struct amd_pstate_ut_struct {\ndrivers/cpufreq/amd-pstate-ut.c-48-\tconst char *name;\n--\ndrivers/cpufreq/amd-pstate-ut.c-54- */\ndrivers/cpufreq/amd-pstate-ut.c:55:static int amd_pstate_ut_acpi_cpc_valid(u32 index);\ndrivers/cpufreq/amd-pstate-ut.c:56:static int amd_pstate_ut_check_enabled(u32 index);\ndrivers/cpufreq/amd-pstate-ut.c:57:static int amd_pstate_ut_check_perf(u32 index);\ndrivers/cpufreq/amd-pstate-ut.c:58:static int amd_pstate_ut_check_freq(u32 index);\ndrivers/cpufreq/amd-pstate-ut.c:59:static int amd_pstate_ut_epp(u32 index);\ndrivers/cpufreq/amd-pstate-ut.c:60:static int amd_pstate_ut_check_driver(u32 index);\ndrivers/cpufreq/amd-pstate-ut.c:61:static int amd_pstate_ut_check_freq_attrs(u32 index);\ndrivers/cpufreq/amd-pstate-ut.c-62-\ndrivers/cpufreq/amd-pstate-ut.c:63:static struct amd_pstate_ut_struct amd_pstate_ut_cases[] = {\ndrivers/cpufreq/amd-pstate-ut.c:64:\t{\"amd_pstate_ut_acpi_cpc_valid\",    amd_pstate_ut_acpi_cpc_valid   },\ndrivers/cpufreq/amd-pstate-ut.c:65:\t{\"amd_pstate_ut_check_enabled\",     amd_pstate_ut_check_enabled    },\ndrivers/cpufreq/amd-pstate-ut.c:66:\t{\"amd_pstate_ut_check_perf\",        amd_pstate_ut_check_perf       },\ndrivers/cpufreq/amd-pstate-ut.c:67:\t{\"amd_pstate_ut_check_freq\",        amd_pstate_ut_check_freq       },\ndrivers/cpufreq/amd-pstate-ut.c:68:\t{\"amd_pstate_ut_epp\",               amd_pstate_ut_epp              },\ndrivers/cpufreq/amd-pstate-ut.c:69:\t{\"amd_pstate_ut_check_driver\",      amd_pstate_ut_check_driver     },\ndrivers/cpufreq/amd-pstate-ut.c:70:\t{\"amd_pstate_ut_check_freq_attrs\",  amd_pstate_ut_check_freq_attrs },\ndrivers/cpufreq/amd-pstate-ut.c-71-};\n--\ndrivers/cpufreq/amd-pstate-ut.c=92=static bool get_shared_mem(void)\n--\ndrivers/cpufreq/amd-pstate-ut.c-104- */\ndrivers/cpufreq/amd-pstate-ut.c:105:static int amd_pstate_ut_acpi_cpc_valid(u32 index)\ndrivers/cpufreq/amd-pstate-ut.c-106-{\n--\ndrivers/cpufreq/amd-pstate-ut.c-117- */\ndrivers/cpufreq/amd-pstate-ut.c:118:static int amd_pstate_ut_check_enabled(u32 index)\ndrivers/cpufreq/amd-pstate-ut.c-119-{\n--\ndrivers/cpufreq/amd-pstate-ut.c-143- */\ndrivers/cpufreq/amd-pstate-ut.c:144:static int amd_pstate_ut_check_perf(u32 index)\ndrivers/cpufreq/amd-pstate-ut.c-145-{\n--\ndrivers/cpufreq/amd-pstate-ut.c-219- */\ndrivers/cpufreq/amd-pstate-ut.c:220:static int amd_pstate_ut_check_freq(u32 index)\ndrivers/cpufreq/amd-pstate-ut.c-221-{\n--\ndrivers/cpufreq/amd-pstate-ut.c-265-\ndrivers/cpufreq/amd-pstate-ut.c:266:static int amd_pstate_set_mode(enum amd_pstate_mode mode)\ndrivers/cpufreq/amd-pstate-ut.c-267-{\ndrivers/cpufreq/amd-pstate-ut.c:268:\tconst char *mode_str = amd_pstate_get_mode_string(mode);\ndrivers/cpufreq/amd-pstate-ut.c-269-\n--\ndrivers/cpufreq/amd-pstate-ut.c-271-\ndrivers/cpufreq/amd-pstate-ut.c:272:\treturn amd_pstate_update_status(mode_str, strlen(mode_str));\ndrivers/cpufreq/amd-pstate-ut.c-273-}\ndrivers/cpufreq/amd-pstate-ut.c-274-\ndrivers/cpufreq/amd-pstate-ut.c:275:static int amd_pstate_ut_epp(u32 index)\ndrivers/cpufreq/amd-pstate-ut.c-276-{\n--\ndrivers/cpufreq/amd-pstate-ut.c-284-\tstruct cpufreq_policy *policy = NULL;\ndrivers/cpufreq/amd-pstate-ut.c:285:\tenum amd_pstate_mode orig_mode;\ndrivers/cpufreq/amd-pstate-ut.c-286-\tstruct amd_cpudata *cpudata;\n--\ndrivers/cpufreq/amd-pstate-ut.c-297-\tcpudata = policy-\u003edriver_data;\ndrivers/cpufreq/amd-pstate-ut.c:298:\torig_mode = amd_pstate_get_status();\ndrivers/cpufreq/amd-pstate-ut.c-299-\torig_dynamic_epp = cpudata-\u003edynamic_epp;\n--\ndrivers/cpufreq/amd-pstate-ut.c-308-\ndrivers/cpufreq/amd-pstate-ut.c:309:\tret = amd_pstate_set_mode(AMD_PSTATE_ACTIVE);\ndrivers/cpufreq/amd-pstate-ut.c-310-\tif (ret)\n--\ndrivers/cpufreq/amd-pstate-ut.c-330-\t\tpr_debug(\"Dynamic EPP is enabled, disabling it\\n\");\ndrivers/cpufreq/amd-pstate-ut.c:331:\t\tamd_pstate_clear_dynamic_epp(policy);\ndrivers/cpufreq/amd-pstate-ut.c-332-\t}\n--\ndrivers/cpufreq/amd-pstate-ut.c-389-\ndrivers/cpufreq/amd-pstate-ut.c:390:\t\tret2 = amd_pstate_set_mode(AMD_PSTATE_DISABLE);\ndrivers/cpufreq/amd-pstate-ut.c-391-\t\tif (!ret \u0026\u0026 ret2)\n--\ndrivers/cpufreq/amd-pstate-ut.c-394-\ndrivers/cpufreq/amd-pstate-ut.c:395:\tif (orig_mode != amd_pstate_get_status()) {\ndrivers/cpufreq/amd-pstate-ut.c-396-\t\tint ret2;\ndrivers/cpufreq/amd-pstate-ut.c-397-\ndrivers/cpufreq/amd-pstate-ut.c:398:\t\tret2 = amd_pstate_set_mode(orig_mode);\ndrivers/cpufreq/amd-pstate-ut.c-399-\t\tif (!ret \u0026\u0026 ret2)\n--\ndrivers/cpufreq/amd-pstate-ut.c-405-\ndrivers/cpufreq/amd-pstate-ut.c:406:static int amd_pstate_ut_check_driver(u32 index)\ndrivers/cpufreq/amd-pstate-ut.c-407-{\ndrivers/cpufreq/amd-pstate-ut.c:408:\tenum amd_pstate_mode mode1, mode2 = AMD_PSTATE_DISABLE;\ndrivers/cpufreq/amd-pstate-ut.c:409:\tenum amd_pstate_mode orig_mode = amd_pstate_get_status();\ndrivers/cpufreq/amd-pstate-ut.c-410-\tint ret;\n--\ndrivers/cpufreq/amd-pstate-ut.c-412-\tfor (mode1 = AMD_PSTATE_DISABLE; mode1 \u003c AMD_PSTATE_MAX; mode1++) {\ndrivers/cpufreq/amd-pstate-ut.c:413:\t\tret = amd_pstate_set_mode(mode1);\ndrivers/cpufreq/amd-pstate-ut.c-414-\t\tif (ret)\n--\ndrivers/cpufreq/amd-pstate-ut.c-418-\t\t\t\tcontinue;\ndrivers/cpufreq/amd-pstate-ut.c:419:\t\t\tret = amd_pstate_set_mode(mode2);\ndrivers/cpufreq/amd-pstate-ut.c-420-\t\t\tif (ret)\n--\ndrivers/cpufreq/amd-pstate-ut.c-427-\t\tpr_warn(\"%s: failed to update status for %s-\u003e%s: %d\\n\", __func__,\ndrivers/cpufreq/amd-pstate-ut.c:428:\t\t\tamd_pstate_get_mode_string(mode1),\ndrivers/cpufreq/amd-pstate-ut.c:429:\t\t\tamd_pstate_get_mode_string(mode2), ret);\ndrivers/cpufreq/amd-pstate-ut.c-430-\ndrivers/cpufreq/amd-pstate-ut.c:431:\tamd_pstate_set_mode(orig_mode);\ndrivers/cpufreq/amd-pstate-ut.c-432-\treturn ret;\n--\ndrivers/cpufreq/amd-pstate-ut.c=442=static const struct {\n--\ndrivers/cpufreq/amd-pstate-ut.c-445-} expected_freq_attrs[] = {\ndrivers/cpufreq/amd-pstate-ut.c:446:\t{\"amd_pstate_max_freq\",\t\t\t\tATTR_ALWAYS},\ndrivers/cpufreq/amd-pstate-ut.c:447:\t{\"amd_pstate_lowest_nonlinear_freq\",\t\tATTR_ALWAYS},\ndrivers/cpufreq/amd-pstate-ut.c:448:\t{\"amd_pstate_highest_perf\",\t\t\tATTR_ALWAYS},\ndrivers/cpufreq/amd-pstate-ut.c:449:\t{\"amd_pstate_prefcore_ranking\",\t\t\tATTR_PREFCORE},\ndrivers/cpufreq/amd-pstate-ut.c:450:\t{\"amd_pstate_hw_prefcore\",\t\t\tATTR_PREFCORE},\ndrivers/cpufreq/amd-pstate-ut.c-451-\t{\"energy_performance_preference\",\t\tATTR_EPP},\ndrivers/cpufreq/amd-pstate-ut.c-452-\t{\"energy_performance_available_preferences\",\tATTR_EPP},\ndrivers/cpufreq/amd-pstate-ut.c:453:\t{\"amd_pstate_floor_freq\",\t\t\tATTR_FLOOR_FREQ},\ndrivers/cpufreq/amd-pstate-ut.c:454:\t{\"amd_pstate_floor_count\",\t\t\tATTR_FLOOR_FREQ},\ndrivers/cpufreq/amd-pstate-ut.c-455-};\n--\ndrivers/cpufreq/amd-pstate-ut.c=457=static bool attr_in_driver(struct freq_attr **driver_attrs, const char *name)\n--\ndrivers/cpufreq/amd-pstate-ut.c-473- */\ndrivers/cpufreq/amd-pstate-ut.c:474:static int amd_pstate_ut_check_freq_attrs(u32 index)\ndrivers/cpufreq/amd-pstate-ut.c-475-{\ndrivers/cpufreq/amd-pstate-ut.c:476:\tenum amd_pstate_mode orig_mode = amd_pstate_get_status();\ndrivers/cpufreq/amd-pstate-ut.c:477:\tstatic const enum amd_pstate_mode modes[] = {\ndrivers/cpufreq/amd-pstate-ut.c-478-\t\tAMD_PSTATE_PASSIVE, AMD_PSTATE_ACTIVE, AMD_PSTATE_GUIDED,\n--\ndrivers/cpufreq/amd-pstate-ut.c-504-\ndrivers/cpufreq/amd-pstate-ut.c:505:\t\tret = amd_pstate_set_mode(modes[m]);\ndrivers/cpufreq/amd-pstate-ut.c-506-\t\tif (ret)\n--\ndrivers/cpufreq/amd-pstate-ut.c-508-\ndrivers/cpufreq/amd-pstate-ut.c:509:\t\tdriver_attrs = amd_pstate_get_current_attrs();\ndrivers/cpufreq/amd-pstate-ut.c-510-\t\tif (!driver_attrs) {\ndrivers/cpufreq/amd-pstate-ut.c-511-\t\t\tpr_err(\"%s: no driver attrs in mode %s\\n\",\ndrivers/cpufreq/amd-pstate-ut.c:512:\t\t\t       __func__, amd_pstate_get_mode_string(modes[m]));\ndrivers/cpufreq/amd-pstate-ut.c-513-\t\t\tret = -EINVAL;\n--\ndrivers/cpufreq/amd-pstate-ut.c-543-\t\t\t\t       __func__,\ndrivers/cpufreq/amd-pstate-ut.c:544:\t\t\t\t       amd_pstate_get_mode_string(modes[m]),\ndrivers/cpufreq/amd-pstate-ut.c-545-\t\t\t\t       expected_freq_attrs[i].name,\n--\ndrivers/cpufreq/amd-pstate-ut.c-555-out:\ndrivers/cpufreq/amd-pstate-ut.c:556:\tamd_pstate_set_mode(orig_mode);\ndrivers/cpufreq/amd-pstate-ut.c-557-\treturn ret;\n--\ndrivers/cpufreq/amd-pstate-ut.c-559-\ndrivers/cpufreq/amd-pstate-ut.c:560:static int __init amd_pstate_ut_init(void)\ndrivers/cpufreq/amd-pstate-ut.c-561-{\ndrivers/cpufreq/amd-pstate-ut.c:562:\tu32 i = 0, arr_size = ARRAY_SIZE(amd_pstate_ut_cases);\ndrivers/cpufreq/amd-pstate-ut.c-563-\n--\ndrivers/cpufreq/amd-pstate-ut.c-567-\t\tif (test_list \u0026\u0026 *test_list \u0026\u0026\ndrivers/cpufreq/amd-pstate-ut.c:568:\t\t    !test_in_list(test_list, amd_pstate_ut_cases[i].name))\ndrivers/cpufreq/amd-pstate-ut.c-569-\t\t\tcontinue;\ndrivers/cpufreq/amd-pstate-ut.c-570-\ndrivers/cpufreq/amd-pstate-ut.c:571:\t\tret = amd_pstate_ut_cases[i].func(i);\ndrivers/cpufreq/amd-pstate-ut.c-572-\ndrivers/cpufreq/amd-pstate-ut.c-573-\t\tif (ret)\ndrivers/cpufreq/amd-pstate-ut.c:574:\t\t\tpr_err(\"%-4d %-20s\\t fail: %d!\\n\", i+1, amd_pstate_ut_cases[i].name, ret);\ndrivers/cpufreq/amd-pstate-ut.c-575-\t\telse\ndrivers/cpufreq/amd-pstate-ut.c:576:\t\t\tpr_info(\"%-4d %-20s\\t success!\\n\", i+1, amd_pstate_ut_cases[i].name);\ndrivers/cpufreq/amd-pstate-ut.c-577-\t}\n--\ndrivers/cpufreq/amd-pstate-ut.c-581-\ndrivers/cpufreq/amd-pstate-ut.c:582:static void __exit amd_pstate_ut_exit(void)\ndrivers/cpufreq/amd-pstate-ut.c-583-{\n--\ndrivers/cpufreq/amd-pstate-ut.c-585-\ndrivers/cpufreq/amd-pstate-ut.c:586:module_init(amd_pstate_ut_init);\ndrivers/cpufreq/amd-pstate-ut.c:587:module_exit(amd_pstate_ut_exit);\ndrivers/cpufreq/amd-pstate-ut.c-588-\n--\ndrivers/cpufreq/amd-pstate.c-62-\ndrivers/cpufreq/amd-pstate.c:63:static const char * const amd_pstate_mode_string[] = {\ndrivers/cpufreq/amd-pstate.c-64-\t[AMD_PSTATE_UNDEFINED]   = \"undefined\",\n--\ndrivers/cpufreq/amd-pstate.c-69-};\ndrivers/cpufreq/amd-pstate.c:70:static_assert(ARRAY_SIZE(amd_pstate_mode_string) == AMD_PSTATE_MAX);\ndrivers/cpufreq/amd-pstate.c-71-\ndrivers/cpufreq/amd-pstate.c:72:const char *amd_pstate_get_mode_string(enum amd_pstate_mode mode)\ndrivers/cpufreq/amd-pstate.c-73-{\n--\ndrivers/cpufreq/amd-pstate.c-75-\t\tmode = AMD_PSTATE_UNDEFINED;\ndrivers/cpufreq/amd-pstate.c:76:\treturn amd_pstate_mode_string[mode];\ndrivers/cpufreq/amd-pstate.c-77-}\ndrivers/cpufreq/amd-pstate.c:78:EXPORT_SYMBOL_GPL(amd_pstate_get_mode_string);\ndrivers/cpufreq/amd-pstate.c-79-\n--\ndrivers/cpufreq/amd-pstate.c=85=static struct cpufreq_driver *current_pstate_driver;\ndrivers/cpufreq/amd-pstate.c:86:static struct cpufreq_driver amd_pstate_driver;\ndrivers/cpufreq/amd-pstate.c:87:static struct cpufreq_driver amd_pstate_epp_driver;\ndrivers/cpufreq/amd-pstate.c-88-static int cppc_state = AMD_PSTATE_UNDEFINED;\ndrivers/cpufreq/amd-pstate.c:89:static bool amd_pstate_prefcore = true;\ndrivers/cpufreq/amd-pstate.c-90-static bool dynamic_epp;\n--\ndrivers/cpufreq/amd-pstate.c=159=static int __init dmi_matched_7k62_bios_bug(const struct dmi_system_id *dmi)\n--\ndrivers/cpufreq/amd-pstate.c-174-\ndrivers/cpufreq/amd-pstate.c:175:static const struct dmi_system_id amd_pstate_quirks_table[] __initconst = {\ndrivers/cpufreq/amd-pstate.c-176-\t{\n--\ndrivers/cpufreq/amd-pstate.c-186-};\ndrivers/cpufreq/amd-pstate.c:187:MODULE_DEVICE_TABLE(dmi, amd_pstate_quirks_table);\ndrivers/cpufreq/amd-pstate.c-188-\ndrivers/cpufreq/amd-pstate.c=189=static inline int get_mode_idx_from_str(const char *str, size_t size)\n--\ndrivers/cpufreq/amd-pstate.c-193-\tfor (i = 0; i \u003c AMD_PSTATE_MAX; i++) {\ndrivers/cpufreq/amd-pstate.c:194:\t\tif (!strncmp(str, amd_pstate_mode_string[i], size))\ndrivers/cpufreq/amd-pstate.c-195-\t\t\treturn i;\n--\ndrivers/cpufreq/amd-pstate.c-199-\ndrivers/cpufreq/amd-pstate.c:200:static DEFINE_MUTEX(amd_pstate_driver_lock);\ndrivers/cpufreq/amd-pstate.c-201-\ndrivers/cpufreq/amd-pstate.c=202=static u8 msr_get_epp(struct amd_cpudata *cpudata)\n--\ndrivers/cpufreq/amd-pstate.c-215-\ndrivers/cpufreq/amd-pstate.c:216:DEFINE_STATIC_CALL(amd_pstate_get_epp, msr_get_epp);\ndrivers/cpufreq/amd-pstate.c-217-\ndrivers/cpufreq/amd-pstate.c:218:static inline s16 amd_pstate_get_epp(struct amd_cpudata *cpudata)\ndrivers/cpufreq/amd-pstate.c-219-{\ndrivers/cpufreq/amd-pstate.c:220:\treturn static_call(amd_pstate_get_epp)(cpudata);\ndrivers/cpufreq/amd-pstate.c-221-}\n--\ndrivers/cpufreq/amd-pstate.c=237=static int msr_update_perf(struct cpufreq_policy *policy, u8 min_perf,\n--\ndrivers/cpufreq/amd-pstate.c-249-\ndrivers/cpufreq/amd-pstate.c:250:\tif (trace_amd_pstate_epp_perf_enabled()) {\ndrivers/cpufreq/amd-pstate.c-251-\t\tunion perf_cached perf = READ_ONCE(cpudata-\u003eperf);\ndrivers/cpufreq/amd-pstate.c-252-\ndrivers/cpufreq/amd-pstate.c:253:\t\ttrace_call__amd_pstate_epp_perf(cpudata-\u003ecpu,\ndrivers/cpufreq/amd-pstate.c-254-\t\t\t\t\t  perf.highest_perf,\n--\ndrivers/cpufreq/amd-pstate.c-278-\ndrivers/cpufreq/amd-pstate.c:279:DEFINE_STATIC_CALL(amd_pstate_update_perf, msr_update_perf);\ndrivers/cpufreq/amd-pstate.c-280-\ndrivers/cpufreq/amd-pstate.c:281:static inline int amd_pstate_update_perf(struct cpufreq_policy *policy,\ndrivers/cpufreq/amd-pstate.c-282-\t\t\t\t\t  u8 min_perf, u8 des_perf,\n--\ndrivers/cpufreq/amd-pstate.c-285-{\ndrivers/cpufreq/amd-pstate.c:286:\treturn static_call(amd_pstate_update_perf)(policy, min_perf, des_perf,\ndrivers/cpufreq/amd-pstate.c-287-\t\t\t\t\t\t   max_perf, epp, fast_switch);\n--\ndrivers/cpufreq/amd-pstate.c=290=static int msr_set_epp(struct cpufreq_policy *policy, u8 epp)\n--\ndrivers/cpufreq/amd-pstate.c-298-\ndrivers/cpufreq/amd-pstate.c:299:\tif (trace_amd_pstate_epp_perf_enabled()) {\ndrivers/cpufreq/amd-pstate.c-300-\t\tunion perf_cached perf = cpudata-\u003eperf;\ndrivers/cpufreq/amd-pstate.c-301-\ndrivers/cpufreq/amd-pstate.c:302:\t\ttrace_call__amd_pstate_epp_perf(cpudata-\u003ecpu, perf.highest_perf,\ndrivers/cpufreq/amd-pstate.c-303-\t\t\t\t\t  epp,\n--\ndrivers/cpufreq/amd-pstate.c-326-\ndrivers/cpufreq/amd-pstate.c:327:DEFINE_STATIC_CALL(amd_pstate_set_epp, msr_set_epp);\ndrivers/cpufreq/amd-pstate.c-328-\ndrivers/cpufreq/amd-pstate.c:329:static inline int amd_pstate_set_epp(struct cpufreq_policy *policy, u8 epp)\ndrivers/cpufreq/amd-pstate.c-330-{\ndrivers/cpufreq/amd-pstate.c:331:\treturn static_call(amd_pstate_set_epp)(policy, epp);\ndrivers/cpufreq/amd-pstate.c-332-}\ndrivers/cpufreq/amd-pstate.c-333-\ndrivers/cpufreq/amd-pstate.c:334:static int amd_pstate_set_floor_perf(struct cpufreq_policy *policy, u8 perf)\ndrivers/cpufreq/amd-pstate.c-335-{\n--\ndrivers/cpufreq/amd-pstate.c-362-out_trace:\ndrivers/cpufreq/amd-pstate.c:363:\tif (trace_amd_pstate_cppc_req2_enabled())\ndrivers/cpufreq/amd-pstate.c:364:\t\ttrace_call__amd_pstate_cppc_req2(cpudata-\u003ecpu, perf, changed,\ndrivers/cpufreq/amd-pstate.c-365-\t\t\t\t\t\t ret);\n--\ndrivers/cpufreq/amd-pstate.c-368-\ndrivers/cpufreq/amd-pstate.c:369:static int amd_pstate_init_floor_perf(struct cpufreq_policy *policy)\ndrivers/cpufreq/amd-pstate.c-370-{\n--\ndrivers/cpufreq/amd-pstate.c-391-\t\tfloor_perf = cpudata-\u003eperf.nominal_perf;\ndrivers/cpufreq/amd-pstate.c:392:\t\tret = amd_pstate_set_floor_perf(policy, floor_perf);\ndrivers/cpufreq/amd-pstate.c-393-\t\tif (ret)\n--\ndrivers/cpufreq/amd-pstate.c=404=static int shmem_set_epp(struct cpufreq_policy *policy, u8 epp)\n--\ndrivers/cpufreq/amd-pstate.c-413-\tepp_cached = FIELD_GET(AMD_CPPC_EPP_PERF_MASK, cpudata-\u003ecppc_req_cached);\ndrivers/cpufreq/amd-pstate.c:414:\tif (trace_amd_pstate_epp_perf_enabled()) {\ndrivers/cpufreq/amd-pstate.c-415-\t\tunion perf_cached perf = cpudata-\u003eperf;\ndrivers/cpufreq/amd-pstate.c-416-\ndrivers/cpufreq/amd-pstate.c:417:\t\ttrace_call__amd_pstate_epp_perf(cpudata-\u003ecpu, perf.highest_perf,\ndrivers/cpufreq/amd-pstate.c-418-\t\t\t\t\t  epp,\n--\ndrivers/cpufreq/amd-pstate.c=449=static int shmem_cppc_enable(struct cpufreq_policy *policy)\n--\ndrivers/cpufreq/amd-pstate.c-453-\ndrivers/cpufreq/amd-pstate.c:454:DEFINE_STATIC_CALL(amd_pstate_cppc_enable, msr_cppc_enable);\ndrivers/cpufreq/amd-pstate.c-455-\ndrivers/cpufreq/amd-pstate.c:456:static inline int amd_pstate_cppc_enable(struct cpufreq_policy *policy)\ndrivers/cpufreq/amd-pstate.c-457-{\ndrivers/cpufreq/amd-pstate.c:458:\treturn static_call(amd_pstate_cppc_enable)(policy);\ndrivers/cpufreq/amd-pstate.c-459-}\n--\ndrivers/cpufreq/amd-pstate.c=505=static int shmem_init_perf(struct amd_cpudata *cpudata)\n--\ndrivers/cpufreq/amd-pstate.c-549-\ndrivers/cpufreq/amd-pstate.c:550:DEFINE_STATIC_CALL(amd_pstate_init_perf, msr_init_perf);\ndrivers/cpufreq/amd-pstate.c-551-\ndrivers/cpufreq/amd-pstate.c:552:static inline int amd_pstate_init_perf(struct amd_cpudata *cpudata)\ndrivers/cpufreq/amd-pstate.c-553-{\ndrivers/cpufreq/amd-pstate.c:554:\treturn static_call(amd_pstate_init_perf)(cpudata);\ndrivers/cpufreq/amd-pstate.c-555-}\n--\ndrivers/cpufreq/amd-pstate.c=557=static int shmem_update_perf(struct cpufreq_policy *policy, u8 min_perf,\n--\ndrivers/cpufreq/amd-pstate.c-578-\ndrivers/cpufreq/amd-pstate.c:579:\tif (trace_amd_pstate_epp_perf_enabled()) {\ndrivers/cpufreq/amd-pstate.c-580-\t\tunion perf_cached perf = READ_ONCE(cpudata-\u003eperf);\ndrivers/cpufreq/amd-pstate.c-581-\ndrivers/cpufreq/amd-pstate.c:582:\t\ttrace_call__amd_pstate_epp_perf(cpudata-\u003ecpu,\ndrivers/cpufreq/amd-pstate.c-583-\t\t\t\t\t  perf.highest_perf,\n--\ndrivers/cpufreq/amd-pstate.c-606-\ndrivers/cpufreq/amd-pstate.c:607:static inline bool amd_pstate_sample(struct amd_cpudata *cpudata)\ndrivers/cpufreq/amd-pstate.c-608-{\n--\ndrivers/cpufreq/amd-pstate.c-639-\ndrivers/cpufreq/amd-pstate.c:640:static void amd_pstate_update(struct cpufreq_policy *policy, u8 min_perf,\ndrivers/cpufreq/amd-pstate.c-641-\t\t\t      u8 des_perf, u8 max_perf, bool fast_switch, int gov_flags)\n--\ndrivers/cpufreq/amd-pstate.c-658-\ndrivers/cpufreq/amd-pstate.c:659:\tif (trace_amd_pstate_perf_enabled() \u0026\u0026 amd_pstate_sample(cpudata)) {\ndrivers/cpufreq/amd-pstate.c:660:\t\ttrace_call__amd_pstate_perf(min_perf, des_perf, max_perf, cpudata-\u003efreq,\ndrivers/cpufreq/amd-pstate.c-661-\t\t\tcpudata-\u003ecur.mperf, cpudata-\u003ecur.aperf, cpudata-\u003ecur.tsc,\n--\ndrivers/cpufreq/amd-pstate.c-664-\ndrivers/cpufreq/amd-pstate.c:665:\tamd_pstate_update_perf(policy, min_perf, des_perf, max_perf, 0, fast_switch);\ndrivers/cpufreq/amd-pstate.c-666-}\ndrivers/cpufreq/amd-pstate.c-667-\ndrivers/cpufreq/amd-pstate.c:668:static int amd_pstate_verify(struct cpufreq_policy_data *policy_data)\ndrivers/cpufreq/amd-pstate.c-669-{\n--\ndrivers/cpufreq/amd-pstate.c-698-\ndrivers/cpufreq/amd-pstate.c:699:static void amd_pstate_update_min_max_limit(struct cpufreq_policy *policy)\ndrivers/cpufreq/amd-pstate.c-700-{\n--\ndrivers/cpufreq/amd-pstate.c-730-\ndrivers/cpufreq/amd-pstate.c:731:static int amd_pstate_update_freq(struct cpufreq_policy *policy,\ndrivers/cpufreq/amd-pstate.c-732-\t\t\t\t  unsigned int target_freq, bool fast_switch)\n--\ndrivers/cpufreq/amd-pstate.c-741-\tif (policy-\u003emin != cpudata-\u003emin_limit_freq || policy-\u003emax != cpudata-\u003emax_limit_freq)\ndrivers/cpufreq/amd-pstate.c:742:\t\tamd_pstate_update_min_max_limit(policy);\ndrivers/cpufreq/amd-pstate.c-743-\n--\ndrivers/cpufreq/amd-pstate.c-759-\ndrivers/cpufreq/amd-pstate.c:760:\tamd_pstate_update(policy, perf.min_limit_perf, des_perf,\ndrivers/cpufreq/amd-pstate.c-761-\t\t\t  perf.max_limit_perf, fast_switch,\n--\ndrivers/cpufreq/amd-pstate.c-769-\ndrivers/cpufreq/amd-pstate.c:770:static int amd_pstate_target(struct cpufreq_policy *policy,\ndrivers/cpufreq/amd-pstate.c-771-\t\t\t     unsigned int target_freq,\n--\ndrivers/cpufreq/amd-pstate.c-773-{\ndrivers/cpufreq/amd-pstate.c:774:\treturn amd_pstate_update_freq(policy, target_freq, false);\ndrivers/cpufreq/amd-pstate.c-775-}\ndrivers/cpufreq/amd-pstate.c-776-\ndrivers/cpufreq/amd-pstate.c:777:static unsigned int amd_pstate_fast_switch(struct cpufreq_policy *policy,\ndrivers/cpufreq/amd-pstate.c-778-\t\t\t\t  unsigned int target_freq)\ndrivers/cpufreq/amd-pstate.c-779-{\ndrivers/cpufreq/amd-pstate.c:780:\tif (!amd_pstate_update_freq(policy, target_freq, true))\ndrivers/cpufreq/amd-pstate.c-781-\t\treturn target_freq;\n--\ndrivers/cpufreq/amd-pstate.c-784-\ndrivers/cpufreq/amd-pstate.c:785:static void amd_pstate_adjust_perf(struct cpufreq_policy *policy,\ndrivers/cpufreq/amd-pstate.c-786-\t\t\t\t   unsigned long _min_perf,\n--\ndrivers/cpufreq/amd-pstate.c-799-\tif (policy-\u003emin != cpudata-\u003emin_limit_freq || policy-\u003emax != cpudata-\u003emax_limit_freq)\ndrivers/cpufreq/amd-pstate.c:800:\t\tamd_pstate_update_min_max_limit(policy);\ndrivers/cpufreq/amd-pstate.c-801-\n--\ndrivers/cpufreq/amd-pstate.c-820-\ndrivers/cpufreq/amd-pstate.c:821:\tamd_pstate_update(policy, min_perf, des_perf, max_perf, true,\ndrivers/cpufreq/amd-pstate.c-822-\t\t\tpolicy-\u003egovernor-\u003eflags);\n--\ndrivers/cpufreq/amd-pstate.c-824-\ndrivers/cpufreq/amd-pstate.c:825:static int amd_pstate_cpu_boost_update(struct cpufreq_policy *policy, bool on)\ndrivers/cpufreq/amd-pstate.c-826-{\n--\ndrivers/cpufreq/amd-pstate.c-846-\ndrivers/cpufreq/amd-pstate.c:847:static int amd_pstate_set_boost(struct cpufreq_policy *policy, int state)\ndrivers/cpufreq/amd-pstate.c-848-{\n--\ndrivers/cpufreq/amd-pstate.c-856-\ndrivers/cpufreq/amd-pstate.c:857:\tret = amd_pstate_cpu_boost_update(policy, state);\ndrivers/cpufreq/amd-pstate.c-858-\trefresh_frequency_limits(policy);\n--\ndrivers/cpufreq/amd-pstate.c-862-\ndrivers/cpufreq/amd-pstate.c:863:static int amd_pstate_init_boost_support(struct amd_cpudata *cpudata)\ndrivers/cpufreq/amd-pstate.c-864-{\n--\ndrivers/cpufreq/amd-pstate.c=895=static void amd_perf_ctl_reset(unsigned int cpu)\n--\ndrivers/cpufreq/amd-pstate.c-901-\ndrivers/cpufreq/amd-pstate.c:902:static void amd_pstate_init_prefcore(struct amd_cpudata *cpudata)\ndrivers/cpufreq/amd-pstate.c-903-{\ndrivers/cpufreq/amd-pstate.c-904-\t/* user disabled or not detected */\ndrivers/cpufreq/amd-pstate.c:905:\tif (!amd_pstate_prefcore)\ndrivers/cpufreq/amd-pstate.c-906-\t\treturn;\n--\ndrivers/cpufreq/amd-pstate.c-910-\t    IS_ENABLED(CONFIG_AMD_HFI)) {\ndrivers/cpufreq/amd-pstate.c:911:\t\tamd_pstate_prefcore = false;\ndrivers/cpufreq/amd-pstate.c-912-\t\treturn;\n--\ndrivers/cpufreq/amd-pstate.c-920-\ndrivers/cpufreq/amd-pstate.c:921:static void amd_pstate_update_limits(struct cpufreq_policy *policy)\ndrivers/cpufreq/amd-pstate.c-922-{\n--\ndrivers/cpufreq/amd-pstate.c-927-\ndrivers/cpufreq/amd-pstate.c:928:\tif (!amd_pstate_prefcore)\ndrivers/cpufreq/amd-pstate.c-929-\t\treturn;\n--\ndrivers/cpufreq/amd-pstate.c-951- */\ndrivers/cpufreq/amd-pstate.c:952:static u32 amd_pstate_get_transition_delay_us(unsigned int cpu)\ndrivers/cpufreq/amd-pstate.c-953-{\n--\ndrivers/cpufreq/amd-pstate.c-970- */\ndrivers/cpufreq/amd-pstate.c:971:static u32 amd_pstate_get_transition_latency(unsigned int cpu)\ndrivers/cpufreq/amd-pstate.c-972-{\n--\ndrivers/cpufreq/amd-pstate.c-982-/*\ndrivers/cpufreq/amd-pstate.c:983: * amd_pstate_init_freq: Initialize the nominal_freq and lowest_nonlinear_freq\ndrivers/cpufreq/amd-pstate.c-984- *\t\t\t for the @cpudata object.\n--\ndrivers/cpufreq/amd-pstate.c-989- */\ndrivers/cpufreq/amd-pstate.c:990:static int amd_pstate_init_freq(struct amd_cpudata *cpudata)\ndrivers/cpufreq/amd-pstate.c-991-{\n--\ndrivers/cpufreq/amd-pstate.c-1045-\ndrivers/cpufreq/amd-pstate.c:1046:static int amd_pstate_cpu_init(struct cpufreq_policy *policy)\ndrivers/cpufreq/amd-pstate.c-1047-{\n--\ndrivers/cpufreq/amd-pstate.c-1067-\ndrivers/cpufreq/amd-pstate.c:1068:\tret = amd_pstate_init_perf(cpudata);\ndrivers/cpufreq/amd-pstate.c-1069-\tif (ret)\n--\ndrivers/cpufreq/amd-pstate.c-1071-\ndrivers/cpufreq/amd-pstate.c:1072:\tamd_pstate_init_prefcore(cpudata);\ndrivers/cpufreq/amd-pstate.c-1073-\ndrivers/cpufreq/amd-pstate.c:1074:\tret = amd_pstate_init_freq(cpudata);\ndrivers/cpufreq/amd-pstate.c-1075-\tif (ret)\n--\ndrivers/cpufreq/amd-pstate.c-1077-\ndrivers/cpufreq/amd-pstate.c:1078:\tret = amd_pstate_init_boost_support(cpudata);\ndrivers/cpufreq/amd-pstate.c-1079-\tif (ret)\n--\ndrivers/cpufreq/amd-pstate.c-1081-\ndrivers/cpufreq/amd-pstate.c:1082:\tpolicy-\u003ecpuinfo.transition_latency = amd_pstate_get_transition_latency(policy-\u003ecpu);\ndrivers/cpufreq/amd-pstate.c:1083:\tpolicy-\u003etransition_delay_us = amd_pstate_get_transition_delay_us(policy-\u003ecpu);\ndrivers/cpufreq/amd-pstate.c-1084-\n--\ndrivers/cpufreq/amd-pstate.c-1091-\tpolicy-\u003edriver_data = cpudata;\ndrivers/cpufreq/amd-pstate.c:1092:\tret = amd_pstate_cppc_enable(policy);\ndrivers/cpufreq/amd-pstate.c-1093-\tif (ret)\n--\ndrivers/cpufreq/amd-pstate.c-1103-\ndrivers/cpufreq/amd-pstate.c:1104:\tret = amd_pstate_init_floor_perf(policy);\ndrivers/cpufreq/amd-pstate.c-1105-\tif (ret) {\n--\ndrivers/cpufreq/amd-pstate.c-1125-\tif (!current_pstate_driver-\u003eadjust_perf)\ndrivers/cpufreq/amd-pstate.c:1126:\t\tcurrent_pstate_driver-\u003eadjust_perf = amd_pstate_adjust_perf;\ndrivers/cpufreq/amd-pstate.c-1127-\n--\ndrivers/cpufreq/amd-pstate.c-1138-\ndrivers/cpufreq/amd-pstate.c:1139:static void amd_pstate_cpu_exit(struct cpufreq_policy *policy)\ndrivers/cpufreq/amd-pstate.c-1140-{\n--\ndrivers/cpufreq/amd-pstate.c-1144-\t/* Reset CPPC_REQ MSR to the BIOS value */\ndrivers/cpufreq/amd-pstate.c:1145:\tamd_pstate_update_perf(policy, perf.bios_min_perf, 0U, 0U, 0U, false);\ndrivers/cpufreq/amd-pstate.c:1146:\tamd_pstate_set_floor_perf(policy, cpudata-\u003ebios_floor_perf);\ndrivers/cpufreq/amd-pstate.c-1147-\n--\ndrivers/cpufreq/amd-pstate.c-1153-\ndrivers/cpufreq/amd-pstate.c:1154:static int amd_pstate_get_balanced_epp(struct cpufreq_policy *policy)\ndrivers/cpufreq/amd-pstate.c-1155-{\n--\ndrivers/cpufreq/amd-pstate.c-1163-\ndrivers/cpufreq/amd-pstate.c:1164:static int amd_pstate_power_supply_notifier(struct notifier_block *nb,\ndrivers/cpufreq/amd-pstate.c-1165-\t\t\t\t\t    unsigned long event, void *data)\n\n"
}

7/2 2026/09/20 09:51 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 16417
							output: 42
							thoughts: 48
						

Thoughts:
Okay, let's break this down.

**Investigating the `amd_pstate` Driver's Initialization**

Alright, I need to refresh my memory on the probing and loading process of `amd_pstate`. It's been a while since I dug into this specific driver. Where do I even start? Let's go straight to the source. The best place is usually the `amd_pstate_init` function. I'll take a look at the bottom of the `drivers/cpufreq/amd-pstate.c` file to check this out and see how it is called and how things are initialized. Hopefully, this will paint a clear picture.



8/2 2026/09/20 09:51 tool read-file
0m Args:
{
  "File": "drivers/cpufreq/amd-pstate.c",
  "FirstLine": 1800,
  "LineCount": 100
}

Results:
{
  "Contents": "1800:\t\t\t\t     struct device_attribute *attr, char *buf)\n1801:\t{\n1802:\t\treturn sysfs_emit(buf, \"%s\\n\", str_enabled_disabled(amd_pstate_prefcore));\n1803:\t}\n1804:\t\n1805:\tstatic ssize_t dynamic_epp_show(struct device *dev,\n1806:\t\t\t\t\tstruct device_attribute *attr, char *buf)\n1807:\t{\n1808:\t\treturn sysfs_emit(buf, \"%s\\n\", str_enabled_disabled(dynamic_epp));\n1809:\t}\n1810:\t\n1811:\tstatic ssize_t dynamic_epp_store(struct device *a, struct device_attribute *b,\n1812:\t\t\t\t\t const char *buf, size_t count)\n1813:\t{\n1814:\t\tbool enabled;\n1815:\t\tint ret;\n1816:\t\n1817:\t\tret = kstrtobool(buf, \u0026enabled);\n1818:\t\tif (ret)\n1819:\t\t\treturn ret;\n1820:\t\n1821:\t\tguard(mutex)(\u0026amd_pstate_driver_lock);\n1822:\t\n1823:\t\tif (cppc_state != AMD_PSTATE_ACTIVE) {\n1824:\t\t\tpr_debug(\"dynamic_epp can only be toggled in active mode\\n\");\n1825:\t\t\treturn -EINVAL;\n1826:\t\t}\n1827:\t\n1828:\t\t/* Nothing to do */\n1829:\t\tif (dynamic_epp == enabled)\n1830:\t\t\treturn count;\n1831:\t\n1832:\t\t/* reinitialize with desired dynamic EPP value */\n1833:\t\tdynamic_epp = enabled;\n1834:\t\tret = amd_pstate_change_driver_mode(cppc_state);\n1835:\t\tif (ret)\n1836:\t\t\tdynamic_epp = false;\n1837:\t\n1838:\t\treturn ret ? ret : count;\n1839:\t}\n1840:\t\n1841:\tstatic DEVICE_ATTR_RW(status);\n1842:\tstatic DEVICE_ATTR_RO(prefcore);\n1843:\tstatic DEVICE_ATTR_RW(dynamic_epp);\n1844:\t\n1845:\tstatic struct attribute *pstate_global_attributes[] = {\n1846:\t\t\u0026dev_attr_status.attr,\n1847:\t\t\u0026dev_attr_prefcore.attr,\n1848:\t\t\u0026dev_attr_dynamic_epp.attr,\n1849:\t\tNULL\n1850:\t};\n1851:\t\n1852:\tstatic const struct attribute_group amd_pstate_global_attr_group = {\n1853:\t\t.name = \"amd_pstate\",\n1854:\t\t.attrs = pstate_global_attributes,\n1855:\t};\n1856:\t\n1857:\tstatic bool amd_pstate_acpi_pm_profile_server(void)\n1858:\t{\n1859:\t\tswitch (acpi_gbl_FADT.preferred_profile) {\n1860:\t\tcase PM_ENTERPRISE_SERVER:\n1861:\t\tcase PM_SOHO_SERVER:\n1862:\t\tcase PM_PERFORMANCE_SERVER:\n1863:\t\t\treturn true;\n1864:\t\t}\n1865:\t\treturn false;\n1866:\t}\n1867:\t\n1868:\tstatic bool amd_pstate_acpi_pm_profile_undefined(void)\n1869:\t{\n1870:\t\tif (acpi_gbl_FADT.preferred_profile == PM_UNSPECIFIED)\n1871:\t\t\treturn true;\n1872:\t\tif (acpi_gbl_FADT.preferred_profile \u003e= NR_PM_PROFILES)\n1873:\t\t\treturn true;\n1874:\t\treturn false;\n1875:\t}\n1876:\t\n1877:\tstatic int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy)\n1878:\t{\n1879:\t\tstruct amd_cpudata *cpudata;\n1880:\t\tunion perf_cached perf;\n1881:\t\tstruct device *dev;\n1882:\t\tint ret;\n1883:\t\n1884:\t\t/*\n1885:\t\t * Resetting PERF_CTL_MSR will put the CPU in P0 frequency,\n1886:\t\t * which is ideal for initialization process.\n1887:\t\t */\n1888:\t\tamd_perf_ctl_reset(policy-\u003ecpu);\n1889:\t\tdev = get_cpu_device(policy-\u003ecpu);\n1890:\t\tif (!dev)\n1891:\t\t\treturn -ENODEV;\n1892:\t\n1893:\t\tcpudata = kzalloc_obj(*cpudata);\n1894:\t\tif (!cpudata)\n1895:\t\t\treturn -ENOMEM;\n1896:\t\n1897:\t\tcpudata-\u003ecpu = policy-\u003ecpu;\n1898:\t\n1899:\t\tret = amd_pstate_init_perf(cpudata);\n"
}

9/2 2026/09/20 09:51 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 18059
							output: 42
							thoughts: 21
						

Thoughts:
Here's my attempt at summarizing the thought process, tailored for an expert audience and written in the first person:

**Diving into the AMD P-State Driver**

Alright, let's get into the nitty-gritty. I need to understand what's happening with the AMD P-State driver. My focus is on the `drivers/cpufreq/amd-pstate.c` file. I'm going to dig down and examine the core logic to get a clear picture of its implementation. I'm looking for the details. Let's see what interesting tidbits and implementation details I can find buried within this file. Hopefully, it's well-structured and documented!



10/2 2026/09/20 09:51 tool read-file
0m Args:
{
  "File": "drivers/cpufreq/amd-pstate.c",
  "FirstLine": 1950,
  "LineCount": 100
}

Results:
{
  "Contents": "1950:\t\tif (ret)\n1951:\t\t\tgoto free_cpudata1;\n1952:\t\n1953:\t\tret = amd_pstate_init_floor_perf(policy);\n1954:\t\tif (ret) {\n1955:\t\t\tdev_err(dev, \"Failed to initialize Floor Perf (%d)\\n\", ret);\n1956:\t\t\tgoto free_cpudata1;\n1957:\t\t}\n1958:\t\n1959:\t\tcurrent_pstate_driver-\u003eadjust_perf = NULL;\n1960:\t\n1961:\t\treturn 0;\n1962:\t\n1963:\tfree_cpudata1:\n1964:\t\tpr_warn(\"Failed to initialize CPU %d: %d\\n\", policy-\u003ecpu, ret);\n1965:\t\tkfree(cpudata);\n1966:\t\tpolicy-\u003edriver_data = NULL;\n1967:\t\treturn ret;\n1968:\t}\n1969:\t\n1970:\tstatic void amd_pstate_epp_cpu_exit(struct cpufreq_policy *policy)\n1971:\t{\n1972:\t\tstruct amd_cpudata *cpudata = policy-\u003edriver_data;\n1973:\t\n1974:\t\tif (cpudata) {\n1975:\t\t\tunion perf_cached perf = READ_ONCE(cpudata-\u003eperf);\n1976:\t\n1977:\t\t\tif (cpudata-\u003edynamic_epp)\n1978:\t\t\t\tamd_pstate_clear_dynamic_epp(policy);\n1979:\t\n1980:\t\t\t/* Reset CPPC_REQ MSR to the BIOS value */\n1981:\t\t\tamd_pstate_update_perf(policy, perf.bios_min_perf, 0U, 0U, 0U, false);\n1982:\t\t\tamd_pstate_set_floor_perf(policy, cpudata-\u003ebios_floor_perf);\n1983:\t\n1984:\t\t\tkfree(cpudata);\n1985:\t\t\tpolicy-\u003edriver_data = NULL;\n1986:\t\t}\n1987:\t\n1988:\t\tpr_debug(\"CPU %d exiting\\n\", policy-\u003ecpu);\n1989:\t}\n1990:\t\n1991:\tstatic int amd_pstate_epp_update_limit(struct cpufreq_policy *policy, bool policy_change)\n1992:\t{\n1993:\t\tstruct amd_cpudata *cpudata = policy-\u003edriver_data;\n1994:\t\tunion perf_cached perf;\n1995:\t\tu8 epp;\n1996:\t\n1997:\t\tif (policy_change ||\n1998:\t\t    policy-\u003emin != cpudata-\u003emin_limit_freq ||\n1999:\t\t    policy-\u003emax != cpudata-\u003emax_limit_freq)\n2000:\t\t\tamd_pstate_update_min_max_limit(policy);\n2001:\t\n2002:\t\tif (cpudata-\u003epolicy == CPUFREQ_POLICY_PERFORMANCE)\n2003:\t\t\tepp = 0;\n2004:\t\telse\n2005:\t\t\tepp = FIELD_GET(AMD_CPPC_EPP_PERF_MASK, cpudata-\u003ecppc_req_cached);\n2006:\t\n2007:\t\tperf = READ_ONCE(cpudata-\u003eperf);\n2008:\t\n2009:\t\treturn amd_pstate_update_perf(policy, perf.min_limit_perf, 0U,\n2010:\t\t\t\t\t      perf.max_limit_perf, epp, false);\n2011:\t}\n2012:\t\n2013:\tstatic int amd_pstate_epp_set_policy(struct cpufreq_policy *policy)\n2014:\t{\n2015:\t\tstruct amd_cpudata *cpudata = policy-\u003edriver_data;\n2016:\t\tint ret;\n2017:\t\n2018:\t\tif (!policy-\u003ecpuinfo.max_freq)\n2019:\t\t\treturn -ENODEV;\n2020:\t\n2021:\t\tcpudata-\u003epolicy = policy-\u003epolicy;\n2022:\t\n2023:\t\tret = amd_pstate_epp_update_limit(policy, true);\n2024:\t\tif (ret)\n2025:\t\t\treturn ret;\n2026:\t\n2027:\t\t/*\n2028:\t\t * policy-\u003ecur is never updated with the amd_pstate_epp driver, but it\n2029:\t\t * is used as a stale frequency value. So, keep it within limits.\n2030:\t\t */\n2031:\t\tpolicy-\u003ecur = policy-\u003emin;\n2032:\t\n2033:\t\treturn 0;\n2034:\t}\n2035:\t\n2036:\tstatic int amd_pstate_cpu_online(struct cpufreq_policy *policy)\n2037:\t{\n2038:\t\tstruct amd_cpudata *cpudata = policy-\u003edriver_data;\n2039:\t\tunion perf_cached perf = READ_ONCE(cpudata-\u003eperf);\n2040:\t\tu8 cached_floor_perf;\n2041:\t\tint ret;\n2042:\t\n2043:\t\tret = amd_pstate_cppc_enable(policy);\n2044:\t\tif (ret)\n2045:\t\t\treturn ret;\n2046:\t\n2047:\t\tcached_floor_perf = freq_to_perf(perf, cpudata-\u003enominal_freq, cpudata-\u003efloor_freq);\n2048:\t\treturn amd_pstate_set_floor_perf(policy, cached_floor_perf);\n2049:\t}\n"
}

11/2 2026/09/20 09:51 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 19797
							output: 42
							thoughts: 20
						

Thoughts:
Here's a summary of my thinking, expressed in the first person:

**Focusing In on the Critical Section**

Okay, so I need to zero in on something specific. Line 2050 to the end of the file... that's the region I need to examine closely. I'm making a conscious choice to ignore the preceding content for now; there's a reason I'm targeting this particular section. This suggests I either have a hypothesis about what's going on there, or that the relevant information is likely concentrated within those lines. Perhaps it's a critical error message, the result of a calculation or processing phase, the beginning of new operations, or the aftermath of some event. Whatever it is, I have a hunch that the answer to my question lies there. It's a targeted investigation, not a casual browse.



12/2 2026/09/20 09:51 tool read-file
0m Args:
{
  "File": "drivers/cpufreq/amd-pstate.c",
  "FirstLine": 2050,
  "LineCount": 100
}

Results:
{
  "Contents": "2050:\t\n2051:\tstatic int amd_pstate_cpu_offline(struct cpufreq_policy *policy)\n2052:\t{\n2053:\t\tstruct amd_cpudata *cpudata = policy-\u003edriver_data;\n2054:\t\tunion perf_cached perf = READ_ONCE(cpudata-\u003eperf);\n2055:\t\tint ret;\n2056:\t\n2057:\t\t/*\n2058:\t\t * Reset CPPC_REQ MSR to the BIOS value, this will allow us to retain the BIOS specified\n2059:\t\t * min_perf value across kexec reboots. If this CPU is just onlined normally after this, the\n2060:\t\t * limits, epp and desired perf will get reset to the cached values in cpudata struct\n2061:\t\t */\n2062:\t\tret = amd_pstate_update_perf(policy, perf.bios_min_perf,\n2063:\t\t\t\t\t     FIELD_GET(AMD_CPPC_DES_PERF_MASK, cpudata-\u003ecppc_req_cached),\n2064:\t\t\t\t\t     FIELD_GET(AMD_CPPC_MAX_PERF_MASK, cpudata-\u003ecppc_req_cached),\n2065:\t\t\t\t\t     FIELD_GET(AMD_CPPC_EPP_PERF_MASK, cpudata-\u003ecppc_req_cached),\n2066:\t\t\t\t\t     false);\n2067:\t\tif (ret)\n2068:\t\t\treturn ret;\n2069:\t\n2070:\t\treturn amd_pstate_set_floor_perf(policy, cpudata-\u003ebios_floor_perf);\n2071:\t}\n2072:\t\n2073:\tstatic int amd_pstate_suspend(struct cpufreq_policy *policy)\n2074:\t{\n2075:\t\tstruct amd_cpudata *cpudata = policy-\u003edriver_data;\n2076:\t\tunion perf_cached perf = READ_ONCE(cpudata-\u003eperf);\n2077:\t\tint ret;\n2078:\t\n2079:\t\t/*\n2080:\t\t * Reset CPPC_REQ MSR to the BIOS value, this will allow us to retain the BIOS specified\n2081:\t\t * min_perf value across kexec reboots. If this CPU is just resumed back without kexec,\n2082:\t\t * the limits, epp and desired perf will get reset to the cached values in cpudata struct\n2083:\t\t */\n2084:\t\tret = amd_pstate_update_perf(policy, perf.bios_min_perf,\n2085:\t\t\t\t\t     FIELD_GET(AMD_CPPC_DES_PERF_MASK, cpudata-\u003ecppc_req_cached),\n2086:\t\t\t\t\t     FIELD_GET(AMD_CPPC_MAX_PERF_MASK, cpudata-\u003ecppc_req_cached),\n2087:\t\t\t\t\t     FIELD_GET(AMD_CPPC_EPP_PERF_MASK, cpudata-\u003ecppc_req_cached),\n2088:\t\t\t\t\t     false);\n2089:\t\tif (ret)\n2090:\t\t\treturn ret;\n2091:\t\n2092:\t\tret = amd_pstate_set_floor_perf(policy, cpudata-\u003ebios_floor_perf);\n2093:\t\tif (ret)\n2094:\t\t\treturn ret;\n2095:\t\n2096:\t\t/* set this flag to avoid setting core offline*/\n2097:\t\tcpudata-\u003esuspended = true;\n2098:\t\n2099:\t\treturn 0;\n2100:\t}\n2101:\t\n2102:\tstatic int amd_pstate_resume(struct cpufreq_policy *policy)\n2103:\t{\n2104:\t\tstruct amd_cpudata *cpudata = policy-\u003edriver_data;\n2105:\t\tunion perf_cached perf = READ_ONCE(cpudata-\u003eperf);\n2106:\t\tint cur_perf = freq_to_perf(perf, cpudata-\u003enominal_freq, policy-\u003ecur);\n2107:\t\tu8 cached_floor_perf;\n2108:\t\tint ret;\n2109:\t\n2110:\t\t/* Set CPPC_REQ to last sane value until the governor updates it */\n2111:\t\tret = amd_pstate_update_perf(policy, perf.min_limit_perf, cur_perf, perf.max_limit_perf,\n2112:\t\t\t\t\t     0U, false);\n2113:\t\tif (ret)\n2114:\t\t\treturn ret;\n2115:\t\n2116:\t\tcached_floor_perf = freq_to_perf(perf, cpudata-\u003enominal_freq, cpudata-\u003efloor_freq);\n2117:\t\treturn amd_pstate_set_floor_perf(policy, cached_floor_perf);\n2118:\t}\n2119:\t\n2120:\tstatic int amd_pstate_epp_resume(struct cpufreq_policy *policy)\n2121:\t{\n2122:\t\tstruct amd_cpudata *cpudata = policy-\u003edriver_data;\n2123:\t\tunion perf_cached perf = READ_ONCE(cpudata-\u003eperf);\n2124:\t\tu8 cached_floor_perf;\n2125:\t\n2126:\t\tif (cpudata-\u003esuspended) {\n2127:\t\t\tint ret;\n2128:\t\n2129:\t\t\t/* enable amd pstate from suspend state*/\n2130:\t\t\tret = amd_pstate_epp_update_limit(policy, false);\n2131:\t\t\tif (ret)\n2132:\t\t\t\treturn ret;\n2133:\t\n2134:\t\t\tcpudata-\u003esuspended = false;\n2135:\t\t}\n2136:\t\n2137:\t\tcached_floor_perf = freq_to_perf(perf, cpudata-\u003enominal_freq, cpudata-\u003efloor_freq);\n2138:\t\treturn amd_pstate_set_floor_perf(policy, cached_floor_perf);\n2139:\t}\n2140:\t\n2141:\tstatic struct cpufreq_driver amd_pstate_driver = {\n2142:\t\t.flags\t\t= CPUFREQ_CONST_LOOPS | CPUFREQ_NEED_UPDATE_LIMITS,\n2143:\t\t.verify\t\t= amd_pstate_verify,\n2144:\t\t.target\t\t= amd_pstate_target,\n2145:\t\t.fast_switch    = amd_pstate_fast_switch,\n2146:\t\t.init\t\t= amd_pstate_cpu_init,\n2147:\t\t.exit\t\t= amd_pstate_cpu_exit,\n2148:\t\t.online\t\t= amd_pstate_cpu_online,\n2149:\t\t.offline\t= amd_pstate_cpu_offline,\n"
}

13/2 2026/09/20 09:51 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 21809
							output: 42
							thoughts: 28
						

Thoughts:
Okay, here's my summary, presented as a stream of thought:

**Diving into the AMD-PSTATE Driver Source**

Alright, time to dig deeper into `drivers/cpufreq/amd-pstate.c`. I've been through a lot of this already, but let's focus on the code *after* line 2150. That's usually where the really interesting, and potentially more complex, parts of a driver like this begin. I want to see how the core frequency scaling mechanism is actually implemented. I'm assuming that line 2150 is the boundary where the more general parts of this driver end. I want to look into how the driver deals with the specifics.

I'm particularly interested in seeing the interaction with the hardware and the deeper algorithms used to optimize performance and power. Is it using the Collaborative Power Control (CPC) or something else? Are there any clever tricks to handle thermal constraints or specific AMD hardware quirks that weren’t immediately obvious from the earlier parts of the code? I'm anticipating that after line 2150 is where the main logic for specific models of AMD CPUs will start to appear. I want to identify any optimizations based on the specific architecture or platform.

Let's see if the code comment quality is good. It's often where the real magic happens, but it also determines how quickly I can truly understand a large code base. And I'm looking for anything unusual or particularly elegant in the implementation. Anything that would give me an edge as I work to optimize this driver.



14/2 2026/09/20 09:51 tool read-file
0m Args:
{
  "File": "drivers/cpufreq/amd-pstate.c",
  "FirstLine": 2150,
  "LineCount": 100
}

Results:
{
  "Contents": "2150:\t\t.suspend\t= amd_pstate_suspend,\n2151:\t\t.resume\t\t= amd_pstate_resume,\n2152:\t\t.set_boost\t= amd_pstate_set_boost,\n2153:\t\t.update_limits\t= amd_pstate_update_limits,\n2154:\t\t.name\t\t= \"amd-pstate\",\n2155:\t};\n2156:\t\n2157:\tstatic struct cpufreq_driver amd_pstate_epp_driver = {\n2158:\t\t.flags\t\t= CPUFREQ_CONST_LOOPS,\n2159:\t\t.verify\t\t= amd_pstate_verify,\n2160:\t\t.setpolicy\t= amd_pstate_epp_set_policy,\n2161:\t\t.init\t\t= amd_pstate_epp_cpu_init,\n2162:\t\t.exit\t\t= amd_pstate_epp_cpu_exit,\n2163:\t\t.offline\t= amd_pstate_cpu_offline,\n2164:\t\t.online\t\t= amd_pstate_cpu_online,\n2165:\t\t.suspend\t= amd_pstate_suspend,\n2166:\t\t.resume\t\t= amd_pstate_epp_resume,\n2167:\t\t.update_limits\t= amd_pstate_update_limits,\n2168:\t\t.set_boost\t= amd_pstate_set_boost,\n2169:\t\t.name\t\t= \"amd-pstate-epp\",\n2170:\t};\n2171:\t\n2172:\t/*\n2173:\t * Processors without frequency scaling support can't do CPPC.\n2174:\t * CPPC function is not supported for family ID 17H with model_ID ranging from 0x10 to 0x2F.\n2175:\t * show the debug message that helps to check if the CPU has CPPC support for loading issue.\n2176:\t */\n2177:\tstatic bool amd_cppc_supported(void)\n2178:\t{\n2179:\t\tstruct cpuinfo_x86 *c = \u0026cpu_data(0);\n2180:\t\tbool warn = false;\n2181:\t\n2182:\t\tif (!cpu_feature_enabled(X86_FEATURE_HW_PSTATE)) {\n2183:\t\t\tpr_debug_once(\"frequency scaling is not supported by the processor\\n\");\n2184:\t\t\treturn false;\n2185:\t\t}\n2186:\t\n2187:\t\tif ((boot_cpu_data.x86 == 0x17) \u0026\u0026 (boot_cpu_data.x86_model \u003c 0x30)) {\n2188:\t\t\tpr_debug_once(\"CPPC feature is not supported by the processor\\n\");\n2189:\t\t\treturn false;\n2190:\t\t}\n2191:\t\n2192:\t\t/*\n2193:\t\t * If the CPPC feature is disabled in the BIOS for processors\n2194:\t\t * that support MSR-based CPPC, the AMD Pstate driver may not\n2195:\t\t * function correctly.\n2196:\t\t *\n2197:\t\t * For such processors, check the CPPC flag and display a\n2198:\t\t * warning message if the platform supports CPPC.\n2199:\t\t *\n2200:\t\t * Note: The code check below will not abort the driver\n2201:\t\t * registration process because of the code is added for\n2202:\t\t * debugging purposes. Besides, it may still be possible for\n2203:\t\t * the driver to work using the shared-memory mechanism.\n2204:\t\t */\n2205:\t\tif (!cpu_feature_enabled(X86_FEATURE_CPPC)) {\n2206:\t\t\tif (cpu_feature_enabled(X86_FEATURE_ZEN2)) {\n2207:\t\t\t\tswitch (c-\u003ex86_model) {\n2208:\t\t\t\tcase 0x60 ... 0x6F:\n2209:\t\t\t\tcase 0x80 ... 0xAF:\n2210:\t\t\t\t\twarn = true;\n2211:\t\t\t\t\tbreak;\n2212:\t\t\t\t}\n2213:\t\t\t} else if (cpu_feature_enabled(X86_FEATURE_ZEN3) ||\n2214:\t\t\t\t   cpu_feature_enabled(X86_FEATURE_ZEN4)) {\n2215:\t\t\t\tswitch (c-\u003ex86_model) {\n2216:\t\t\t\tcase 0x10 ... 0x1F:\n2217:\t\t\t\tcase 0x40 ... 0xAF:\n2218:\t\t\t\t\twarn = true;\n2219:\t\t\t\t\tbreak;\n2220:\t\t\t\t}\n2221:\t\t\t} else if (cpu_feature_enabled(X86_FEATURE_ZEN5)) {\n2222:\t\t\t\twarn = true;\n2223:\t\t\t}\n2224:\t\t}\n2225:\t\n2226:\t\tif (warn)\n2227:\t\t\tpr_warn_once(\"The CPPC feature is supported but currently disabled by the BIOS.\\n\"\n2228:\t\t\t\t\t\t\"Please enable it if your BIOS has the CPPC option.\\n\");\n2229:\t\treturn true;\n2230:\t}\n2231:\t\n2232:\tstatic int __init amd_pstate_init(void)\n2233:\t{\n2234:\t\tstruct device *dev_root;\n2235:\t\tint ret;\n2236:\t\n2237:\t\tif (boot_cpu_data.x86_vendor != X86_VENDOR_AMD)\n2238:\t\t\treturn -ENODEV;\n2239:\t\n2240:\t\t/* show debug message only if CPPC is not supported */\n2241:\t\tif (!amd_cppc_supported())\n2242:\t\t\treturn -EOPNOTSUPP;\n2243:\t\n2244:\t\t/* show warning message when BIOS broken or ACPI disabled */\n2245:\t\tif (!acpi_cpc_valid()) {\n2246:\t\t\tpr_warn_once(\"the _CPC object is not present in SBIOS or ACPI disabled\\n\");\n2247:\t\t\treturn -ENODEV;\n2248:\t\t}\n2249:\t\n"
}

15/2 2026/09/20 09:51 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 23847
							output: 41
							thoughts: 15
						

Thoughts:
Okay, let's dive into this `amd_pstate_init` function and see what it's all about. I need to understand its role within the broader AMD P-State driver. It's the initialization, so I expect it to set up the foundation. I'm looking for the core components being initialized, the data structures being populated, and any initial hardware configuration being performed. What are the key steps? Are there any specific checks or conditions it's addressing early on? Are there any potential failure points I should be aware of, like register reads that might fail, or checks on CPU capabilities? I'm anticipating finding the interaction with the platform's ACPI tables or MSRs that define the power management capabilities. This is where the magic should begin – the driver needs to understand the hardware. I want to see if any heuristics are used, or if the initialization is simply pulling known information from fixed locations. What's the general flow, and does it seem well-structured for error handling? I'm hoping it's robust and anticipates different AMD platforms. Let's see...



16/2 2026/09/20 09:51 tool read-file
0m Args:
{
  "File": "drivers/cpufreq/amd-pstate.c",
  "FirstLine": 2250,
  "LineCount": 60
}

Results:
{
  "Contents": "2250:\t\t/* don't keep reloading if cpufreq_driver exists */\n2251:\t\tif (cpufreq_get_current_driver())\n2252:\t\t\treturn -EEXIST;\n2253:\t\n2254:\t\tquirks = NULL;\n2255:\t\n2256:\t\t/* check if this machine need CPPC quirks */\n2257:\t\tdmi_check_system(amd_pstate_quirks_table);\n2258:\t\n2259:\t\t/*\n2260:\t\t* determine the driver mode from the command line or kernel config.\n2261:\t\t* If no command line input is provided, cppc_state will be AMD_PSTATE_UNDEFINED.\n2262:\t\t* command line options will override the kernel config settings.\n2263:\t\t*/\n2264:\t\n2265:\t\tif (cppc_state == AMD_PSTATE_UNDEFINED) {\n2266:\t\t\t/* Disable on the following configs by default:\n2267:\t\t\t * 1. Undefined platforms\n2268:\t\t\t * 2. Server platforms with CPUs older than Family 0x1A.\n2269:\t\t\t */\n2270:\t\t\tif (amd_pstate_acpi_pm_profile_undefined() ||\n2271:\t\t\t    (amd_pstate_acpi_pm_profile_server() \u0026\u0026 boot_cpu_data.x86 \u003c 0x1A)) {\n2272:\t\t\t\tpr_info(\"driver load is disabled, boot with specific mode to enable this\\n\");\n2273:\t\t\t\treturn -ENODEV;\n2274:\t\t\t}\n2275:\t\t\t/* get driver mode from kernel config option [1:4] */\n2276:\t\t\tcppc_state = CONFIG_X86_AMD_PSTATE_DEFAULT_MODE;\n2277:\t\t}\n2278:\t\n2279:\t\tif (cppc_state == AMD_PSTATE_DISABLE) {\n2280:\t\t\tpr_info(\"driver load is disabled, boot with specific mode to enable this\\n\");\n2281:\t\t\treturn -ENODEV;\n2282:\t\t}\n2283:\t\n2284:\t\t/* capability check */\n2285:\t\tif (cpu_feature_enabled(X86_FEATURE_CPPC)) {\n2286:\t\t\tpr_debug(\"AMD CPPC MSR based functionality is supported\\n\");\n2287:\t\t} else {\n2288:\t\t\tpr_debug(\"AMD CPPC shared memory based functionality is supported\\n\");\n2289:\t\t\tstatic_call_update(amd_pstate_cppc_enable, shmem_cppc_enable);\n2290:\t\t\tstatic_call_update(amd_pstate_init_perf, shmem_init_perf);\n2291:\t\t\tstatic_call_update(amd_pstate_update_perf, shmem_update_perf);\n2292:\t\t\tstatic_call_update(amd_pstate_get_epp, shmem_get_epp);\n2293:\t\t\tstatic_call_update(amd_pstate_set_epp, shmem_set_epp);\n2294:\t\t}\n2295:\t\n2296:\t\tif (amd_pstate_prefcore) {\n2297:\t\t\tret = amd_detect_prefcore(\u0026amd_pstate_prefcore);\n2298:\t\t\tif (ret)\n2299:\t\t\t\treturn ret;\n2300:\t\t}\n2301:\t\n2302:\t\tret = amd_pstate_register_driver(cppc_state);\n2303:\t\tif (ret) {\n2304:\t\t\tpr_err(\"failed to register with return %d\\n\", ret);\n2305:\t\t\treturn ret;\n2306:\t\t}\n2307:\t\n2308:\t\tdev_root = bus_get_dev_root(\u0026cpu_subsys);\n2309:\t\tif (dev_root) {\n"
}

17/2 2026/09/20 09:51 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 25156
							output: 24
							thoughts: 463
						

Thoughts:
**Analyzing the AMD P-State Initialization**

Okay, let's break this down. I'm looking at the `amd_pstate_init()` function, and the first thing I see is a vendor check: `boot_cpu_data.x86_vendor != X86_VENDOR_AMD`. My initial thought is about QEMU. I know the default QEMU CPU model can be tricky. It can present different vendors depending on the host or the specific QEMU model used. For instance, a plain `qemu64` might default to "AuthenticAMD", but that can vary. It also depends on the host itself. If the host is Intel, or if the QEMU configuration is using TCG, the CPUID vendor can be anything, depending on the QEMU model. The vendor can be `GenuineIntel` or `AuthenticAMD`, depending on the QEMU model used. The default `qemu64` has vendor `AuthenticAMD` or `GenuineIntel` depending on the host. The question that pops up immediately is: how does this interact with `amd_cppc_supported()`?

Now, let's dive into `amd_cppc_supported()`.  This function checks `cpu_feature_enabled(X86_FEATURE_HW_PSTATE)`. Okay, so it looks like we need to see if the emulated CPU supports the `X86_FEATURE_HW_PSTATE` feature. This is where I have to check what this feature is in the Linux kernel and how QEMU emulates it. It's a key requirement. If that feature is not there, we can't initialize the P-state properly.



18/2 2026/09/20 09:52 tool grepper
0m Args:
{
  "Expression": "X86_FEATURE_HW_PSTATE"
}

Results:
{
  "Output": "arch/x86/include/asm/cpufeatures.h-201-#define X86_FEATURE_TDX_HOST_PLATFORM\t( 7*32+ 7) /* \"tdx_host_platform\" Platform supports being a TDX host */\narch/x86/include/asm/cpufeatures.h:202:#define X86_FEATURE_HW_PSTATE\t\t( 7*32+ 8) /* \"hw_pstate\" AMD HW-PState */\narch/x86/include/asm/cpufeatures.h-203-#define X86_FEATURE_PROC_FEEDBACK\t( 7*32+ 9) /* \"proc_feedback\" AMD ProcFeedbackInterface */\n--\narch/x86/kernel/cpu/scattered.c=27=static const struct cpuid_bit cpuid_bits[] = {\n--\narch/x86/kernel/cpu/scattered.c-51-\t{ X86_FEATURE_SMCA,\t\t\tCPUID_EBX,  3, 0x80000007, 0 },\narch/x86/kernel/cpu/scattered.c:52:\t{ X86_FEATURE_HW_PSTATE,\t\tCPUID_EDX,  7, 0x80000007, 0 },\narch/x86/kernel/cpu/scattered.c-53-\t{ X86_FEATURE_CPB,\t\t\tCPUID_EDX,  9, 0x80000007, 0 },\n--\ndrivers/cpufreq/acpi-cpufreq.c=189=static int check_amd_hwpstate_cpu(unsigned int cpuid)\n--\ndrivers/cpufreq/acpi-cpufreq.c-192-\ndrivers/cpufreq/acpi-cpufreq.c:193:\treturn cpu_has(cpu, X86_FEATURE_HW_PSTATE);\ndrivers/cpufreq/acpi-cpufreq.c-194-}\n--\ndrivers/cpufreq/amd-pstate.c=2177=static bool amd_cppc_supported(void)\n--\ndrivers/cpufreq/amd-pstate.c-2181-\ndrivers/cpufreq/amd-pstate.c:2182:\tif (!cpu_feature_enabled(X86_FEATURE_HW_PSTATE)) {\ndrivers/cpufreq/amd-pstate.c-2183-\t\tpr_debug_once(\"frequency scaling is not supported by the processor\\n\");\n--\ndrivers/cpufreq/powernow-k8.c=1170=static int powernowk8_init(void)\n--\ndrivers/cpufreq/powernow-k8.c-1177-\ndrivers/cpufreq/powernow-k8.c:1178:\tif (boot_cpu_has(X86_FEATURE_HW_PSTATE)) {\ndrivers/cpufreq/powernow-k8.c-1179-\t\t__request_acpi_cpufreq();\n--\ntools/arch/x86/include/asm/cpufeatures.h-191-#define X86_FEATURE_TDX_HOST_PLATFORM\t( 7*32+ 7) /* \"tdx_host_platform\" Platform supports being a TDX host */\ntools/arch/x86/include/asm/cpufeatures.h:192:#define X86_FEATURE_HW_PSTATE\t\t( 7*32+ 8) /* \"hw_pstate\" AMD HW-PState */\ntools/arch/x86/include/asm/cpufeatures.h-193-#define X86_FEATURE_PROC_FEEDBACK\t( 7*32+ 9) /* \"proc_feedback\" AMD ProcFeedbackInterface */\n"
}

19/2 2026/09/20 09:52 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 26948
							output: 21
							thoughts: 32
						

Thoughts:
Okay, here's my take on those thoughts, framed as my own internal analysis:

**Deconstructing `acpi_cpc_valid()`**

Alright, let's dive into this `acpi_cpc_valid()` function. My immediate instinct is to dissect its definition and purpose. I need to understand where this function lives within the ACPI (Advanced Configuration and Power Interface) framework. My focus will be on the source code, likely the ACPI subsystem within the kernel. I'll need to pinpoint the exact file and line where it's declared and defined.

Once I've located the definition, the real work begins. I'll meticulously examine the code within `acpi_cpc_valid()`. My primary goals are to determine:

*   **Its role in the power management lifecycle.** What specifically is it validating? Is it checking for valid control parameters, hardware resources, or power states?
*   **The inputs it accepts.** What arguments does it take? Are they pointers to ACPI data structures, numeric values representing power states, or something else entirely? Understanding the input types is crucial to understanding the function's context.
*   **Its return value.** What does this function return? A boolean indicating validity, an error code, or perhaps even a pointer to a modified data structure? The return value is key to understanding how other code uses the validation check.
*   **Any side effects.** Does it modify any global variables or other data structures? Does it perform any logging or debugging output? Knowing about these things will help me track down where this function is needed, what depends on it, and what happens because of it.

This whole process is aimed at grasping how this function fits into the bigger picture of ACPI power management within the operating system. I'll be particularly interested in how it prevents power management problems and how it ensures proper hardware configuration for power saving.



20/2 2026/09/20 09:52 tool grepper
0m Args:
{
  "Expression": "acpi_cpc_valid"
}

Results:
{
  "Output": "Documentation/admin-guide/pm/amd-pstate.rst=190=The ``amd-pstate`` initialization will fail if the ``_CPC`` entry in the ACPI\nDocumentation/admin-guide/pm/amd-pstate.rst:191:SBIOS does not exist in the detected processor. It uses ``acpi_cpc_valid``\nDocumentation/admin-guide/pm/amd-pstate.rst-192-to check the existence of ``_CPC``. All Zen based processors support the legacy\n--\nDocumentation/admin-guide/pm/amd-pstate.rst=630=Unit Tests for amd-pstate\n--\nDocumentation/admin-guide/pm/amd-pstate.rst-649-        +=========+================================+====================================================================================+\nDocumentation/admin-guide/pm/amd-pstate.rst:650:        | 1       | amd_pstate_ut_acpi_cpc_valid   || Check whether the _CPC object is present in SBIOS.                                |\nDocumentation/admin-guide/pm/amd-pstate.rst-651-        |         |                                ||                                                                                   |\n--\nDocumentation/admin-guide/pm/amd-pstate.rst-743-          $ dmesg | grep \"amd_pstate_ut\" | tee log.txt\nDocumentation/admin-guide/pm/amd-pstate.rst:744:          [12977.570663] amd_pstate_ut: 1    amd_pstate_ut_acpi_cpc_valid  success!\nDocumentation/admin-guide/pm/amd-pstate.rst-745-          [12977.570673] amd_pstate_ut: 2    amd_pstate_ut_check_enabled   success!\n--\ndrivers/acpi/cppc_acpi.c=402=static int acpi_get_psd(struct cpc_desc *cpc_ptr, acpi_handle handle)\n--\ndrivers/acpi/cppc_acpi.c-459-\ndrivers/acpi/cppc_acpi.c:460:bool acpi_cpc_valid(void)\ndrivers/acpi/cppc_acpi.c-461-{\n--\ndrivers/acpi/cppc_acpi.c-475-}\ndrivers/acpi/cppc_acpi.c:476:EXPORT_SYMBOL_GPL(acpi_cpc_valid);\ndrivers/acpi/cppc_acpi.c-477-\n--\ndrivers/base/arch_topology.c=327=static inline void topology_init_cpu_capacity_cppc(void)\n--\ndrivers/base/arch_topology.c-332-\ndrivers/base/arch_topology.c:333:\tif (likely(!acpi_cpc_valid()))\ndrivers/base/arch_topology.c-334-\t\treturn;\n--\ndrivers/cpufreq/amd-pstate-ut.c=47=struct amd_pstate_ut_struct {\n--\ndrivers/cpufreq/amd-pstate-ut.c-54- */\ndrivers/cpufreq/amd-pstate-ut.c:55:static int amd_pstate_ut_acpi_cpc_valid(u32 index);\ndrivers/cpufreq/amd-pstate-ut.c-56-static int amd_pstate_ut_check_enabled(u32 index);\n--\ndrivers/cpufreq/amd-pstate-ut.c=63=static struct amd_pstate_ut_struct amd_pstate_ut_cases[] = {\ndrivers/cpufreq/amd-pstate-ut.c:64:\t{\"amd_pstate_ut_acpi_cpc_valid\",    amd_pstate_ut_acpi_cpc_valid   },\ndrivers/cpufreq/amd-pstate-ut.c-65-\t{\"amd_pstate_ut_check_enabled\",     amd_pstate_ut_check_enabled    },\n--\ndrivers/cpufreq/amd-pstate-ut.c=92=static bool get_shared_mem(void)\n--\ndrivers/cpufreq/amd-pstate-ut.c-104- */\ndrivers/cpufreq/amd-pstate-ut.c:105:static int amd_pstate_ut_acpi_cpc_valid(u32 index)\ndrivers/cpufreq/amd-pstate-ut.c-106-{\ndrivers/cpufreq/amd-pstate-ut.c:107:\tif (!acpi_cpc_valid()) {\ndrivers/cpufreq/amd-pstate-ut.c-108-\t\tpr_err(\"%s the _CPC object is not present in SBIOS!\\n\", __func__);\n--\ndrivers/cpufreq/amd-pstate.c=2232=static int __init amd_pstate_init(void)\n--\ndrivers/cpufreq/amd-pstate.c-2244-\t/* show warning message when BIOS broken or ACPI disabled */\ndrivers/cpufreq/amd-pstate.c:2245:\tif (!acpi_cpc_valid()) {\ndrivers/cpufreq/amd-pstate.c-2246-\t\tpr_warn_once(\"the _CPC object is not present in SBIOS or ACPI disabled\\n\");\n--\ndrivers/cpufreq/cppc_cpufreq.c=1055=static int __init cppc_cpufreq_init(void)\n--\ndrivers/cpufreq/cppc_cpufreq.c-1058-\ndrivers/cpufreq/cppc_cpufreq.c:1059:\tif (!acpi_cpc_valid())\ndrivers/cpufreq/cppc_cpufreq.c-1060-\t\treturn -ENODEV;\n--\ninclude/acpi/cppc_acpi.h=171=extern unsigned int cppc_khz_to_perf(struct cppc_perf_caps *caps, unsigned int freq);\ninclude/acpi/cppc_acpi.h:172:extern bool acpi_cpc_valid(void);\ninclude/acpi/cppc_acpi.h-173-bool cppc_allow_fast_switch(const struct cpumask *cpus);\n--\ninclude/acpi/cppc_acpi.h=229=static inline bool cppc_perf_ctrs_in_pcc(void)\n--\ninclude/acpi/cppc_acpi.h-232-}\ninclude/acpi/cppc_acpi.h:233:static inline bool acpi_cpc_valid(void)\ninclude/acpi/cppc_acpi.h-234-{\n"
}

21/2 2026/09/20 09:52 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 29067
							output: 40
							thoughts: 30
						

Thoughts:
Here's my summary, as though I'm thinking through this process:

**Diving into `acpi_cpc_valid()` in `drivers/acpi/cppc_acpi.c`**

Okay, let's get down to brass tacks. I need to understand exactly what `acpi_cpc_valid()` is doing. I already know this function is critical for validating CPPC (Collaborative Processor Performance Control) capabilities, but I want to refresh my memory and pinpoint any areas that might warrant further investigation or perhaps have changed since I last looked at it. I need to understand what this function is *really* checking and what conditions would cause it to return false – and why. Are there subtle edge cases? Anything specific to certain ACPI implementations or hardware configurations that this function is sensitive to? I'm going to look at the code line by line to refresh what is going on. I know that this is a critical component for power management and performance scaling. So, let's see what gems are hidden in this function.



22/2 2026/09/20 09:52 tool read-file
0m Args:
{
  "File": "drivers/acpi/cppc_acpi.c",
  "FirstLine": 460,
  "LineCount": 20
}

Results:
{
  "Contents": " 460:\tbool acpi_cpc_valid(void)\n 461:\t{\n 462:\t\tstruct cpc_desc *cpc_ptr;\n 463:\t\tint cpu;\n 464:\t\n 465:\t\tif (acpi_disabled)\n 466:\t\t\treturn false;\n 467:\t\n 468:\t\tfor_each_online_cpu(cpu) {\n 469:\t\t\tcpc_ptr = per_cpu(cpc_desc_ptr, cpu);\n 470:\t\t\tif (!cpc_ptr)\n 471:\t\t\t\treturn false;\n 472:\t\t}\n 473:\t\n 474:\t\treturn true;\n 475:\t}\n 476:\tEXPORT_SYMBOL_GPL(acpi_cpc_valid);\n 477:\t\n 478:\tbool cppc_allow_fast_switch(const struct cpumask *cpus)\n 479:\t{\n"
}

23/2 2026/09/20 09:52 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 29626
							output: 33
							thoughts: 1624
						

Thoughts:
**Analyzing the Reachability of `amd-pstate` Code for Fuzzing**

Okay, let's break this down. My primary concern here is reachability.  Can the code I'm looking at, specifically within the `amd-pstate` driver, actually *run* in a standard fuzzing environment, like QEMU or GCE? The initial check (`acpi_cpc_valid()`) is crucial here because it's the gatekeeper. It verifies the presence of `_CPC` objects, which come from ACPI tables provided by the SBIOS/firmware on bare-metal systems with CPPC support (like AMD Zen2+ processors).  I know that standard QEMU doesn't, by default, expose these ACPI objects.  Neither does GCE, from my experience. That's a red flag.

Then I checked the code directly (`drivers/cpufreq/amd-pstate.c`), and it explicitly checks for `!amd_cppc_supported()` and `!acpi_cpc_valid()`.  If either is false, the driver won't initialize.  I am already getting the sense of "this is going to be a problem" because this requires AMD-specific hardware features.

So, I circled back to the question about syzkaller on AMD hardware or GCE? The prompt emphasized reachability, but I have to assume the answer is *no*.

Now, the unit tests (`amd-pstate-ut.c`) also check for `acpi_cpc_valid()`, which also fails if `!acpi_cpc_valid()`.  This confirms my initial hypothesis that the unit tests are also likely unreachable in standard QEMU or GCE.

Next, I looked at the call to `shmem_init_perf()`. Where is that called, and under what conditions? I found it's assigned to `amd_pstate_init_perf` within a static call, but only when `!cpu_feature_enabled(X86_FEATURE_CPPC)`. The static call itself is called from `amd_pstate_cpu_init` and `amd_pstate_epp_cpu_init`.  These are `.init` callbacks within the cpufreq driver. I confirmed it further down; `amd_pstate_register_driver()` is called, and this requires the preconditions to pass, which I understand to be:

1.  `boot_cpu_data.x86_vendor == X86_VENDOR_AMD`
2.  `amd_cppc_supported()` (which requires `X86_FEATURE_HW_PSTATE`)
3.  `acpi_cpc_valid()` (which requires ACPI _CPC objects present for each online CPU in SBIOS)
4.  NOT `X86_FEATURE_CPPC` (for shared memory mode)
5.  cpufreq driver registration succeeds.

So, `amd-pstate` is definitely an AMD-specific processor P-state driver. It *needs* specific hardware capabilities or ACPI table entries. It's a cpufreq hardware driver. I've seen similar issues with `intel_pstate` and `acpi-cpufreq`.

Ultimately, the conclusion is clear.  Standard QEMU doesn't emulate the necessary HW_PSTATE MSRs or expose the required ACPI `_CPC` tables. Even with KVM on an AMD bare-metal host, I *doubt* KVM would expose these features directly to the guest. So, the modified code is structurally unreachable under those conditions, and therefore should be marked as unworth fuzzing.



24/2 2026/09/20 09:52 tool grepper
0m Error:
no matches

Args:
{
  "Expression": "HW_PSTATE",
  "PathPrefix": "arch/x86/kvm/"
}

Results:
{
  "error": "no matches"
}

25/2 2026/09/20 09:52 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 32085
							output: 39
							thoughts: 35
						

Thoughts:
Here's my take:

**Investigating the Absence of HW_PSTATE in KVM**

Alright, this is strange. I was expecting to find `HW_PSTATE` support within KVM, but it seems to be missing. Okay, first things first, let's confirm the code's configuration. It's time to dig into the source. My initial instinct is to go right to the heart of the matter – the CPUID handling within the kernel's KVM implementation. I'll need to double-check `arch/x86/kvm/cpuid.c`. Hopefully, the answer, or at least a clue, lies within that file. I expect to be able to understand the architectural decision not to include this feature and understand what, if any, alternative implementation is provided, or if the missing implementation is due to a simple oversight.



26/2 2026/09/20 09:52 tool grepper
0m Args:
{
  "Expression": "0x80000007",
  "PathPrefix": "arch/x86/kvm/"
}

Results:
{
  "Output": "arch/x86/kvm/cpuid.c=1432=static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function)\n--\narch/x86/kvm/cpuid.c-1781-\t\tbreak;\narch/x86/kvm/cpuid.c:1782:\tcase 0x80000007: /* Advanced power management */\narch/x86/kvm/cpuid.c-1783-\t\tcpuid_entry_override(entry, CPUID_8000_0007_EDX);\n--\narch/x86/kvm/cpuid.c=2103=bool kvm_cpuid(struct kvm_vcpu *vcpu, u32 *eax, u32 *ebx,\n--\narch/x86/kvm/cpuid.c-2131-\t\t\t\t*ebx \u0026= ~(feature_bit(RTM) | feature_bit(HLE));\narch/x86/kvm/cpuid.c:2132:\t\t} else if (function == 0x80000007) {\narch/x86/kvm/cpuid.c-2133-\t\t\tif (kvm_hv_invtsc_suppressed(vcpu))\n--\narch/x86/kvm/reverse_cpuid.h-70-\narch/x86/kvm/reverse_cpuid.h:71:/* CPUID level 0x80000007 (EDX). */\narch/x86/kvm/reverse_cpuid.h-72-#define KVM_X86_FEATURE_CONSTANT_TSC\tKVM_X86_FEATURE(CPUID_8000_0007_EDX, 8)\n--\narch/x86/kvm/reverse_cpuid.h=87=static const struct cpuid_reg reverse_cpuid[] = {\n--\narch/x86/kvm/reverse_cpuid.h-104-\t[CPUID_7_1_EDX]       = {         7, 1, CPUID_EDX},\narch/x86/kvm/reverse_cpuid.h:105:\t[CPUID_8000_0007_EDX] = {0x80000007, 0, CPUID_EDX},\narch/x86/kvm/reverse_cpuid.h-106-\t[CPUID_8000_0021_EAX] = {0x80000021, 0, CPUID_EAX},\n"
}

27/2 2026/09/20 09:52 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 33016
							output: 44
							thoughts: 27
						

Thoughts:
Here's my take on those thoughts:

**Analyzing CPUID_8000_0007_EDX in KVM**

Alright, let's dive in. I need to understand what the `CPUID_8000_0007_EDX` leaf reveals within the KVM virtualization environment. This is crucial for performance optimization and debugging, and I need to assess how KVM is handling CPUID information. My immediate concern is, are all the relevant architectural features being correctly exposed to the guest? Are there any discrepancies between what's reported by the underlying physical hardware and what KVM presents? I need to know if any virtualization-specific flags are being set or cleared, and whether any modifications are made to the reported feature set. This will help determine if KVM is transparent, or possibly introducing some intentional or unintentional modifications which may influence performance or functionality in the guest. Time to get into the nitty-gritty and analyze the data.



28/2 2026/09/20 09:52 tool grepper
0m Args:
{
  "Expression": "CPUID_8000_0007_EDX",
  "PathPrefix": "arch/x86/kvm/"
}

Results:
{
  "Output": "arch/x86/kvm/cpuid.c=836=void kvm_initialize_cpu_caps(void)\n--\narch/x86/kvm/cpuid.c-1157-\narch/x86/kvm/cpuid.c:1158:\tkvm_cpu_cap_init(CPUID_8000_0007_EDX,\narch/x86/kvm/cpuid.c-1159-\t\tSCATTERED_F(CONSTANT_TSC),\n--\narch/x86/kvm/cpuid.c=1432=static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function)\n--\narch/x86/kvm/cpuid.c-1782-\tcase 0x80000007: /* Advanced power management */\narch/x86/kvm/cpuid.c:1783:\t\tcpuid_entry_override(entry, CPUID_8000_0007_EDX);\narch/x86/kvm/cpuid.c-1784-\n--\narch/x86/kvm/reverse_cpuid.h-71-/* CPUID level 0x80000007 (EDX). */\narch/x86/kvm/reverse_cpuid.h:72:#define KVM_X86_FEATURE_CONSTANT_TSC\tKVM_X86_FEATURE(CPUID_8000_0007_EDX, 8)\narch/x86/kvm/reverse_cpuid.h-73-\n--\narch/x86/kvm/reverse_cpuid.h=87=static const struct cpuid_reg reverse_cpuid[] = {\n--\narch/x86/kvm/reverse_cpuid.h-104-\t[CPUID_7_1_EDX]       = {         7, 1, CPUID_EDX},\narch/x86/kvm/reverse_cpuid.h:105:\t[CPUID_8000_0007_EDX] = {0x80000007, 0, CPUID_EDX},\narch/x86/kvm/reverse_cpuid.h-106-\t[CPUID_8000_0021_EAX] = {0x80000021, 0, CPUID_EAX},\n"
}

29/2 2026/09/20 09:52 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 33922
							output: 41
							thoughts: 544
						

Thoughts:
**My Analysis of `amd-pstate` Reachability in Virtualized Environments**

Okay, so here's the deal. KVM doesn't present `HW_PSTATE` in the `CPUID_8000_0007_EDX` register, only `CONSTANT_TSC`. This means that even running within a KVM guest on AMD hardware, `X86_FEATURE_HW_PSTATE` is masked. And, to top it off, `acpi_cpc_valid()` depends on the existence of ACPI `_CPC` objects, which QEMU doesn't emulate for x86 CPUs. Given these facts, I'm pretty confident that `amd-pstate` can't initialize or run in standard virtualized setups like GCE or QEMU.

Now, let's circle back to my core triage philosophy, which is all about reachability. If code isn't reachable in these standard environments, it's a non-starter for fuzzing, no matter how complex the logic or whether it adds assertions. So, I need to know if `amd-pstate` is reachable.

The negative criteria are clear, and I'm wondering if `amd-pstate` falls under "Structurally unreachable hardware". It sure sounds like it, requiring physical AMD CPUs with `HW_PSTATE` and those ACPI `_CPC` tables from firmware. That's a classic example of hardware not emulated by standard QEMU.

Now, the obvious question: is there any backdoor way that `shmem_init_perf` can be invoked? It's a static function in `drivers/cpufreq/amd-pstate.c`, which makes it immediately less likely that syzkaller could invoke it directly. Could it be reached through sysfs?

I need to know if it can be reached in sysfs. So I check the sysfs files registered by amd_pstate: `status`, `prefcore`, and `dynamic_epp`. These files are only created after the `amd_pstate_init()` function completes and after `amd_pstate_register_driver()` succeeds! I'll double check lines 2302-2315 to be certain, but it's clear: `shmem_init_perf` is not exposed via syfs, and therefore cannot be invoked by syzkaller.

This is all pretty clear to me now.



30/2 2026/09/20 09:52 tool read-file
0m Args:
{
  "File": "drivers/cpufreq/amd-pstate.c",
  "FirstLine": 2300,
  "LineCount": 25
}

Results:
{
  "Contents": "2300:\t\t}\n2301:\t\n2302:\t\tret = amd_pstate_register_driver(cppc_state);\n2303:\t\tif (ret) {\n2304:\t\t\tpr_err(\"failed to register with return %d\\n\", ret);\n2305:\t\t\treturn ret;\n2306:\t\t}\n2307:\t\n2308:\t\tdev_root = bus_get_dev_root(\u0026cpu_subsys);\n2309:\t\tif (dev_root) {\n2310:\t\t\tret = sysfs_create_group(\u0026dev_root-\u003ekobj, \u0026amd_pstate_global_attr_group);\n2311:\t\t\tput_device(dev_root);\n2312:\t\t\tif (ret) {\n2313:\t\t\t\tpr_err(\"sysfs attribute export failed with error %d.\\n\", ret);\n2314:\t\t\t\tgoto global_attr_free;\n2315:\t\t\t}\n2316:\t\t}\n2317:\t\n2318:\t\treturn ret;\n2319:\t\n2320:\tglobal_attr_free:\n2321:\t\tamd_pstate_unregister_driver(0);\n2322:\t\treturn ret;\n2323:\t}\n2324:\tdevice_initcall(amd_pstate_init);\n"
}

31/2 2026/09/20 09:52 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 35386
							output: 215
							thoughts: 1536
						

Thoughts:
**Analysis of AMD P-State Driver Patch for Fuzzing Eligibility**

Okay, let's break this down. Line 2324 highlights the crucial `device_initcall(amd_pstate_init);` call, which kicks off the AMD P-state driver during boot. I need to understand if the changes in this patch affect code reachable by fuzzing. The driver initialization itself (`amd_pstate_init()`) has several checks: vendor ID, CPPC support, and ACPI CPC validity. If any of those fail, the driver bails out early with `-ENODEV` or `-EOPNOTSUPP`. Essentially, the entire driver, and therefore anything *within* it, is unreachable if the underlying hardware characteristics aren't present.

I'm thinking about the unit tests (`amd-pstate-ut.c`). Can those call `shmem_init_perf`? Looking at the unit tests, they seem to rely on a fully initialized and running `amd_pstate` driver. They test `acpi_cpc_valid()`, and if that fails, the tests don't even run. So, a unit test won't help here. Even if the unit test *could* run, it depends on a working driver.

The patch itself is interesting. It's in `shmem_init_perf()`, which, as the diff clearly shows, just skips calling `cppc_set_auto_sel()` if it's already in the desired state. This is just an optimization. More importantly, I need to understand where this function runs. It's for AMD processors utilizing shared-memory CPPC, which means it depends on physical hardware with ACPI `_CPC` support, which is often Zen 2 with family 17h, model >= 0x30. This specific functionality is strictly hardware-dependent, not just any AMD system.

Looking at the guidelines for fuzzing eligibility, this screams "structurally unreachable hardware". The criteria specifically mentions power management features like AMD CPPC shared-memory mode that require physical hardware and ACPI firmware not emulated in QEMU. QEMU and GCE are the environments used for fuzzing.

My reasoning is straightforward: in these standard environments, the `amd_pstate` driver *never* initializes because the necessary CPUID bits and ACPI objects aren't present. Even if the environment were configured for an AMD CPU, QEMU does not emulate those details. So `shmem_init_perf()` and this patch are unreachable.

I've already thought about Syzkaller. It runs in QEMU/GCE, so the entire `amd_pstate` driver fails to probe, because QEMU is not configured with an AMD CPU or ACPI. Even if it was, the driver initialization would still fail.

So, the conclusion is clear. This patch modifies code that is inherently unreachable in any standard virtualized fuzzing environment. The patch only affects specific AMD CPUs that use shared-memory CPPC, which is something not emulated in these VMs. Therefore, `WorthFuzzing` is definitely `false`.

Now, I need to finalize the `set-results`:

-   `WorthFuzzing`: false
-   `Reasoning`:
    1.  The change is within `shmem_init_perf()` inside `drivers/cpufreq/amd-pstate.c`.
    2.  `amd-pstate` requires specific AMD processor hardware (`X86_VENDOR_AMD`, `X86_FEATURE_HW_PSTATE`) and firmware ACPI `_CPC` objects (`acpi_cpc_valid()`).
    3.  Standard virtualized environments (QEMU/GCE) don't emulate AMD CPPC or HW-PState features, causing driver initialization to fail.
    4.  `shmem_init_perf` is specific to shared-memory CPPC, which is also not emulated, making this code unreachable on virtualized test platforms.
-   `FocusSymbols`: \[ ]
-   `EnableConfigs`: \[ ]

Okay, I'm ready to call `set-results`.



32/2 2026/09/20 09:53 tool set-results
0m Args:
{
  "EnableConfigs": [],
  "FocusSymbols": [],
  "Reasoning": "The patch modifies `shmem_init_perf()` in `drivers/cpufreq/amd-pstate.c`. The `amd-pstate` driver is a cpufreq driver for physical AMD processors that requires AMD CPU features (X86_FEATURE_HW_PSTATE) and firmware ACPI _CPC table objects (acpi_cpc_valid()). Standard virtualized fuzzing environments (such as QEMU or GCE) do not emulate AMD HW-PState or provide CPPC ACPI objects, so `amd_pstate_init()` aborts during boot with -ENODEV or -EOPNOTSUPP. Furthermore, `shmem_init_perf()` specifically runs on systems using ACPI shared-memory CPPC (Zen 2 platforms lacking MSR-based CPPC). The modified code is therefore structurally unreachable in standard virtualized environments.",
  "WorthFuzzing": false
}

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [],
  "Reasoning": "The patch modifies `shmem_init_perf()` in `drivers/cpufreq/amd-pstate.c`. The `amd-pstate` driver is a cpufreq driver for physical AMD processors that requires AMD CPU features (X86_FEATURE_HW_PSTATE) and firmware ACPI _CPC table objects (acpi_cpc_valid()). Standard virtualized fuzzing environments (such as QEMU or GCE) do not emulate AMD HW-PState or provide CPPC ACPI objects, so `amd_pstate_init()` aborts during boot with -ENODEV or -EOPNOTSUPP. Furthermore, `shmem_init_perf()` specifically runs on systems using ACPI shared-memory CPPC (Zen 2 platforms lacking MSR-based CPPC). The modified code is therefore structurally unreachable in standard virtualized environments.",
  "WorthFuzzing": false
}

33/1 2026/09/20 09:53 action If
0m Args:
{
  "WorthFuzzing": false
}

Results:
null

LLM Calls Summary:
Total Calls Total Tokens Avg Tokens Total Duration (Seconds) Avg Duration (Seconds)
Tool Calls Summary:
Total Calls Total Duration (Seconds) Avg Duration (Seconds)