@@ -3809,26 +3809,60 @@ long AMD_F17h_CPPC(void)
3809
3809
return -ENODEV;
3810
3810
}
3811
3811
3812
+ void Compute_ACPI_CPPC_Bounds(unsigned int cpu)
3813
+ {
3814
+ CORE_RO *Core = (CORE_RO *) PUBLIC(RO(Core, AT(cpu)));
3815
+
3816
+ if (Core->PowerThermal.ACPI_CPPC.Highest > \
3817
+ PUBLIC(RO(Proc))->PowerThermal.ACPI_CPPC.Maximum)
3818
+ {
3819
+ PUBLIC(RO(Proc))->PowerThermal.ACPI_CPPC.Maximum = \
3820
+ Core->PowerThermal.ACPI_CPPC.Highest;
3821
+ }
3822
+ if (Core->PowerThermal.ACPI_CPPC.Highest < \
3823
+ PUBLIC(RO(Proc))->PowerThermal.ACPI_CPPC.Minimum)
3824
+ {
3825
+ PUBLIC(RO(Proc))->PowerThermal.ACPI_CPPC.Minimum = \
3826
+ Core->PowerThermal.ACPI_CPPC.Highest;
3827
+ }
3828
+ }
3829
+
3812
3830
inline signed int Disable_ACPI_CPPC(unsigned int cpu, void *arg)
3813
3831
{
3814
- UNUSED(arg);
3815
3832
#if defined(CONFIG_ACPI_CPPC_LIB) \
3816
3833
&& LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0)
3817
- return cppc_set_enable((signed int) cpu, false);
3834
+ signed int rc = cppc_set_enable((signed int) cpu, false);
3818
3835
#else
3819
- return -ENODEV;
3836
+ signed int rc = -ENODEV;
3820
3837
#endif /* CONFIG_ACPI_CPPC_LIB */
3838
+ UNUSED(arg);
3839
+
3840
+ if (rc != 0) {
3841
+ pr_debug("CoreFreq: cppc_set_enable(cpu=%u, false) error %d\n",
3842
+ cpu, rc);
3843
+ }
3844
+ Compute_ACPI_CPPC_Bounds(cpu);
3845
+
3846
+ return rc;
3821
3847
}
3822
3848
3823
3849
inline signed int Enable_ACPI_CPPC(unsigned int cpu, void *arg)
3824
3850
{
3825
- UNUSED(arg);
3826
3851
#if defined(CONFIG_ACPI_CPPC_LIB) \
3827
3852
&& LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0)
3828
- return cppc_set_enable((signed int) cpu, true);
3853
+ signed int rc = cppc_set_enable((signed int) cpu, true);
3829
3854
#else
3830
- return -ENODEV;
3855
+ signed int rc = -ENODEV;
3831
3856
#endif /* CONFIG_ACPI_CPPC_LIB */
3857
+ UNUSED(arg);
3858
+
3859
+ if (rc != 0) {
3860
+ pr_debug("CoreFreq: cppc_set_enable(cpu=%u, true) error %d\n",
3861
+ cpu, rc);
3862
+ }
3863
+ Compute_ACPI_CPPC_Bounds(cpu);
3864
+
3865
+ return rc;
3832
3866
}
3833
3867
3834
3868
signed int Get_ACPI_CPPC_Registers(unsigned int cpu, void *arg)
@@ -3844,9 +3878,11 @@ signed int Get_ACPI_CPPC_Registers(unsigned int cpu, void *arg)
3844
3878
3845
3879
if ((rc = cppc_get_perf_ctrs(Core->Bind, &CPPC_Perf)) == 0) {
3846
3880
if ((rc = cppc_get_perf_caps(Core->Bind, &CPPC_Caps)) != 0)
3847
- pr_err("CoreFreq: cppc_get_perf_caps() error %d\n", rc);
3881
+ pr_debug("CoreFreq: cppc_get_perf_caps(cpu=%u) error %d\n",
3882
+ Core->Bind, rc);
3848
3883
} else {
3849
- pr_err("CoreFreq: cppc_get_perf_ctrs() error %d\n", rc);
3884
+ pr_debug("CoreFreq: cppc_get_perf_ctrs(cpu=%u) error %d\n",
3885
+ Core->Bind, rc);
3850
3886
}
3851
3887
if (rc == 0) {
3852
3888
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0)
@@ -3884,7 +3920,8 @@ signed int Get_ACPI_CPPC_Registers(unsigned int cpu, void *arg)
3884
3920
if (rc == 0) {
3885
3921
Core->PowerThermal.ACPI_CPPC.Desired = desired_perf;
3886
3922
} else {
3887
- pr_err("CoreFreq: cppc_get_desired_perf() error %d\n", rc);
3923
+ pr_debug("CoreFreq: cppc_get_desired_perf(cpu=%u) error %d\n",
3924
+ Core->Bind, rc);
3888
3925
}
3889
3926
#endif
3890
3927
}
@@ -3894,24 +3931,6 @@ signed int Get_ACPI_CPPC_Registers(unsigned int cpu, void *arg)
3894
3931
#endif /* CONFIG_ACPI_CPPC_LIB */
3895
3932
}
3896
3933
3897
- void Compute_ACPI_CPPC_Bounds(unsigned int cpu)
3898
- {
3899
- CORE_RO *Core = (CORE_RO *) PUBLIC(RO(Core, AT(cpu)));
3900
-
3901
- if (Core->PowerThermal.ACPI_CPPC.Highest > \
3902
- PUBLIC(RO(Proc))->PowerThermal.ACPI_CPPC.Maximum)
3903
- {
3904
- PUBLIC(RO(Proc))->PowerThermal.ACPI_CPPC.Maximum = \
3905
- Core->PowerThermal.ACPI_CPPC.Highest;
3906
- }
3907
- if (Core->PowerThermal.ACPI_CPPC.Highest < \
3908
- PUBLIC(RO(Proc))->PowerThermal.ACPI_CPPC.Minimum)
3909
- {
3910
- PUBLIC(RO(Proc))->PowerThermal.ACPI_CPPC.Minimum = \
3911
- Core->PowerThermal.ACPI_CPPC.Highest;
3912
- }
3913
- }
3914
-
3915
3934
signed int Read_ACPI_CPPC_Registers(unsigned int cpu, void *arg)
3916
3935
{
3917
3936
signed int rc = Get_ACPI_CPPC_Registers(cpu, arg);
@@ -7344,7 +7363,8 @@ signed int Put_ACPI_CPPC_Registers(unsigned int cpu, void *arg)
7344
7363
if (cppc_get_desired_perf(Core->Bind, &desired_perf) == 0) {
7345
7364
perf_ctrls.desired_perf = desired_perf;
7346
7365
} else {
7347
- pr_err("CoreFreq: cppc_get_desired_perf() error\n");
7366
+ pr_debug("CoreFreq: cppc_get_desired_perf(cpu=%u) error\n",
7367
+ Core->Bind);
7348
7368
}
7349
7369
#endif
7350
7370
@@ -7410,21 +7430,21 @@ signed int Put_ACPI_CPPC_Registers(unsigned int cpu, void *arg)
7410
7430
7411
7431
Core->PowerThermal.ACPI_CPPC.Maximum = CPPC_Caps.highest_perf;
7412
7432
} else {
7413
- pr_err ("CoreFreq: cppc_get_perf_caps() error\n");
7433
+ pr_debug ("CoreFreq: cppc_get_perf_caps(cpu=%u ) error\n", cpu );
7414
7434
}
7415
7435
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0)
7416
7436
if (cppc_get_desired_perf(cpu, &desired_perf) == 0) {
7417
7437
perf_ctrls.desired_perf = desired_perf;
7418
7438
7419
7439
Core->PowerThermal.ACPI_CPPC.Desired = desired_perf;
7420
7440
} else {
7421
- pr_err ("CoreFreq: cppc_get_desired_perf() error\n");
7441
+ pr_debug ("CoreFreq: cppc_get_desired_perf(cpu=%u ) error\n",cpu );
7422
7442
}
7423
7443
#endif
7424
7444
pClockZen->rc = RC_OK_COMPUTE;
7425
7445
}
7426
7446
} else {
7427
- pr_err ("CoreFreq: cppc_get_perf_*() error\n");
7447
+ pr_debug ("CoreFreq: cppc_get_perf_*(cpu=%u ) error\n", Core->Bind );
7428
7448
}
7429
7449
return 0;
7430
7450
#else
0 commit comments