Skip to content

Commit 90d4825

Browse files
committed
[Kernel][6.15] Fix missing cpufreq_get_policy and asm/amd/nb.h
1 parent 2c03cea commit 90d4825

File tree

4 files changed

+90
-6
lines changed

4 files changed

+90
-6
lines changed

aarch64/corefreqk.c

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2298,6 +2298,26 @@ static PROCESSOR_SPECIFIC *LookupProcessor(void)
22982298
return NULL;
22992299
}
23002300

2301+
#ifdef CONFIG_CPU_FREQ
2302+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
2303+
static int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu)
2304+
{
2305+
struct cpufreq_policy *cpu_policy __free(put_cpufreq_policy);
2306+
2307+
if (!policy)
2308+
return -EINVAL;
2309+
2310+
cpu_policy = cpufreq_cpu_get(cpu);
2311+
if (!cpu_policy)
2312+
return -EINVAL;
2313+
2314+
memcpy(policy, cpu_policy, sizeof(*policy));
2315+
2316+
return 0;
2317+
}
2318+
#endif
2319+
#endif /* CONFIG_CPU_FREQ */
2320+
23012321
static void Query_DeviceTree(unsigned int cpu)
23022322
{
23032323
CORE_RO *Core = (CORE_RO *) PUBLIC(RO(Core, AT(cpu)));
@@ -2308,7 +2328,7 @@ static void Query_DeviceTree(unsigned int cpu)
23082328
unsigned int max_freq = 0, min_freq = 0, cur_freq = 0;
23092329
COF_ST COF;
23102330
#ifdef CONFIG_CPU_FREQ
2311-
if (cpufreq_get_policy(pFreqPolicy,cpu) == 0)
2331+
if (cpufreq_get_policy(pFreqPolicy, cpu) == 0)
23122332
{
23132333
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
23142334
struct cpufreq_frequency_table *table;
@@ -3933,7 +3953,7 @@ static long Sys_OS_Driver_Query(void)
39333953
StrCopy(PUBLIC(RO(Proc))->OS.FreqDriver.Name,
39343954
pFreqDriver, CPUFREQ_NAME_LEN);
39353955
}
3936-
if ((rc=cpufreq_get_policy(pFreqPolicy,PUBLIC(RO(Proc))->Service.Core)) == 0)
3956+
if ((rc=cpufreq_get_policy(pFreqPolicy, PUBLIC(RO(Proc))->Service.Core)) == 0)
39373957
{
39383958
struct cpufreq_governor *pGovernor = pFreqPolicy->governor;
39393959
if (pGovernor != NULL) {

ppc64le/corefreqk.c

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -958,6 +958,26 @@ static PROCESSOR_SPECIFIC *LookupProcessor(void)
958958
return NULL;
959959
}
960960

961+
#ifdef CONFIG_CPU_FREQ
962+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
963+
static int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu)
964+
{
965+
struct cpufreq_policy *cpu_policy __free(put_cpufreq_policy);
966+
967+
if (!policy)
968+
return -EINVAL;
969+
970+
cpu_policy = cpufreq_cpu_get(cpu);
971+
if (!cpu_policy)
972+
return -EINVAL;
973+
974+
memcpy(policy, cpu_policy, sizeof(*policy));
975+
976+
return 0;
977+
}
978+
#endif
979+
#endif /* CONFIG_CPU_FREQ */
980+
961981
static void Query_DeviceTree(unsigned int cpu)
962982
{
963983
CORE_RO *Core = (CORE_RO *) PUBLIC(RO(Core, AT(cpu)));
@@ -968,7 +988,7 @@ static void Query_DeviceTree(unsigned int cpu)
968988
unsigned int max_freq = 0, min_freq = 0, cur_freq = 0;
969989
COF_ST COF;
970990
#ifdef CONFIG_CPU_FREQ
971-
if (cpufreq_get_policy(pFreqPolicy,cpu) == 0)
991+
if (cpufreq_get_policy(pFreqPolicy, cpu) == 0)
972992
{
973993
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
974994
struct cpufreq_frequency_table *table;
@@ -2290,7 +2310,7 @@ static long Sys_OS_Driver_Query(void)
22902310
StrCopy(PUBLIC(RO(Proc))->OS.FreqDriver.Name,
22912311
pFreqDriver, CPUFREQ_NAME_LEN);
22922312
}
2293-
if ((rc=cpufreq_get_policy(pFreqPolicy,PUBLIC(RO(Proc))->Service.Core)) == 0)
2313+
if ((rc=cpufreq_get_policy(pFreqPolicy, PUBLIC(RO(Proc))->Service.Core)) == 0)
22942314
{
22952315
struct cpufreq_governor *pGovernor = pFreqPolicy->governor;
22962316
if (pGovernor != NULL) {

riscv64/corefreqk.c

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,26 @@ static PROCESSOR_SPECIFIC *LookupProcessor(void)
942942
return NULL;
943943
}
944944

945+
#ifdef CONFIG_CPU_FREQ
946+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
947+
static int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu)
948+
{
949+
struct cpufreq_policy *cpu_policy __free(put_cpufreq_policy);
950+
951+
if (!policy)
952+
return -EINVAL;
953+
954+
cpu_policy = cpufreq_cpu_get(cpu);
955+
if (!cpu_policy)
956+
return -EINVAL;
957+
958+
memcpy(policy, cpu_policy, sizeof(*policy));
959+
960+
return 0;
961+
}
962+
#endif
963+
#endif /* CONFIG_CPU_FREQ */
964+
945965
static void Query_DeviceTree(unsigned int cpu)
946966
{
947967
CORE_RO *Core = (CORE_RO *) PUBLIC(RO(Core, AT(cpu)));
@@ -952,7 +972,7 @@ static void Query_DeviceTree(unsigned int cpu)
952972
unsigned int max_freq = 0, min_freq = 0, cur_freq = 0;
953973
COF_ST COF;
954974
#ifdef CONFIG_CPU_FREQ
955-
if (cpufreq_get_policy(pFreqPolicy,cpu) == 0)
975+
if (cpufreq_get_policy(pFreqPolicy, cpu) == 0)
956976
{
957977
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
958978
struct cpufreq_frequency_table *table;
@@ -2277,7 +2297,7 @@ static long Sys_OS_Driver_Query(void)
22772297
StrCopy(PUBLIC(RO(Proc))->OS.FreqDriver.Name,
22782298
pFreqDriver, CPUFREQ_NAME_LEN);
22792299
}
2280-
if ((rc=cpufreq_get_policy(pFreqPolicy,PUBLIC(RO(Proc))->Service.Core)) == 0)
2300+
if ((rc=cpufreq_get_policy(pFreqPolicy, PUBLIC(RO(Proc))->Service.Core)) == 0)
22812301
{
22822302
struct cpufreq_governor *pGovernor = pFreqPolicy->governor;
22832303
if (pGovernor != NULL) {

x86_64/corefreqk.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,12 @@
5353
#endif /* CONFIG_XEN */
5454
#include <asm/mwait.h>
5555
#ifdef CONFIG_AMD_NB
56+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
57+
#include <asm/amd/nb.h>
58+
#else
5659
#include <asm/amd_nb.h>
5760
#endif
61+
#endif /* CONFIG_AMD_NB */
5862
#ifdef CONFIG_ACPI
5963
#include <linux/acpi.h>
6064
#include <acpi/processor.h>
@@ -20826,6 +20830,26 @@ static void Stop_Uncore_AMD_Family_17h(void *arg)
2082620830
}
2082720831

2082820832

20833+
#ifdef CONFIG_CPU_FREQ
20834+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
20835+
static int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu)
20836+
{
20837+
struct cpufreq_policy *cpu_policy __free(put_cpufreq_policy);
20838+
20839+
if (!policy)
20840+
return -EINVAL;
20841+
20842+
cpu_policy = cpufreq_cpu_get(cpu);
20843+
if (!cpu_policy)
20844+
return -EINVAL;
20845+
20846+
memcpy(policy, cpu_policy, sizeof(*policy));
20847+
20848+
return 0;
20849+
}
20850+
#endif
20851+
#endif /* CONFIG_CPU_FREQ */
20852+
2082920853
static long Sys_OS_Driver_Query(void)
2083020854
{
2083120855
int rc = RC_SUCCESS;

0 commit comments

Comments
 (0)