[PATCH v2 3/3] platform/x86/amd: hfi: Stand down when amd-pstate CAS is active
From: Vishal Badole
Date: Wed Nov 25 2026 - 12:21:43 EST
From: Krishnamoorthi M <krishnamoorthi.m@xxxxxxx>
When amd-pstate CAS is active, it takes ownership of per-CPU capacity
values that the scheduler uses to distinguish performance and efficiency
cores. amd-hfi manages the same scheduler state through its ranking
mechanism. Running both simultaneously would cause them to overwrite
each other's settings, leading to unpredictable task placement on hybrid
platforms.
Avoid loading amd-hfi if CAS is enabled. Defer HFI driver initialization
to a late initcall so amd-pstate completes initialization before HFI
checks whether CAS is active.
Signed-off-by: Krishnamoorthi M <krishnamoorthi.m@xxxxxxx>
Signed-off-by: Vishal Badole <Vishal.Badole@xxxxxxx>
---
drivers/platform/x86/amd/hfi/hfi.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/hfi/hfi.c
index 86a7f4332c35a..73e53203a838c 100644
--- a/drivers/platform/x86/amd/hfi/hfi.c
+++ b/drivers/platform/x86/amd/hfi/hfi.c
@@ -27,6 +27,7 @@
#include <linux/topology.h>
#include <linux/workqueue.h>
+#include <asm/amd/amd-pstate.h>
#include <asm/cpu_device_id.h>
#include <acpi/pcc.h>
@@ -536,6 +537,12 @@ static int __init amd_hfi_init(void)
!cpu_feature_enabled(X86_FEATURE_AMD_WORKLOAD_CLASS))
return -ENODEV;
+ /* amd-pstate CAS owns heterogeneous core scheduling when enabled. */
+ if (amd_pstate_cas_active()) {
+ pr_debug("amd-pstate CAS is active, not loading amd-hfi\n");
+ return -ENODEV;
+ }
+
ret = platform_driver_register(&amd_hfi_driver);
if (ret)
pr_err("failed to register HFI driver\n");
@@ -547,7 +554,7 @@ static __exit void amd_hfi_exit(void)
{
platform_driver_unregister(&amd_hfi_driver);
}
-module_init(amd_hfi_init);
+late_initcall(amd_hfi_init);
module_exit(amd_hfi_exit);
MODULE_LICENSE("GPL");
--
2.34.1