Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cpufreq/amd-pstate: Move registration after static function call update

On shared memory designs the static functions need to work before
registration is done or the system can hang at bootup.

Move the registration later in amd_pstate_init() to solve this.

Fixes: b427ac408475 ("cpufreq/amd-pstate: Remove the redundant amd_pstate_set_driver() call")
Reported-by: Klara Modin <klarasmodin@gmail.com>
Closes: https://lore.kernel.org/linux-pm/cf9c146d-bacf-444e-92e2-15ebf513af96@gmail.com/#t
Tested-by: Klara Modin <klarasmodin@gmail.com>
Tested-by: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>
Link: https://lore.kernel.org/r/20241028145542.1739160-2-superm1@kernel.org
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>

+6 -6
+6 -6
drivers/cpufreq/amd-pstate.c
··· 1859 1859 return -ENODEV; 1860 1860 } 1861 1861 1862 - ret = amd_pstate_register_driver(cppc_state); 1863 - if (ret) { 1864 - pr_err("failed to register with return %d\n", ret); 1865 - return ret; 1866 - } 1867 - 1868 1862 /* capability check */ 1869 1863 if (cpu_feature_enabled(X86_FEATURE_CPPC)) { 1870 1864 pr_debug("AMD CPPC MSR based functionality is supported\n"); ··· 1867 1873 static_call_update(amd_pstate_cppc_enable, shmem_cppc_enable); 1868 1874 static_call_update(amd_pstate_init_perf, shmem_init_perf); 1869 1875 static_call_update(amd_pstate_update_perf, shmem_update_perf); 1876 + } 1877 + 1878 + ret = amd_pstate_register_driver(cppc_state); 1879 + if (ret) { 1880 + pr_err("failed to register with return %d\n", ret); 1881 + return ret; 1870 1882 } 1871 1883 1872 1884 if (amd_pstate_prefcore) {