@@ -3809,26 +3809,60 @@ long AMD_F17h_CPPC(void)
38093809 return - ENODEV ;
38103810}
38113811
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+
38123830inline signed int Disable_ACPI_CPPC (unsigned int cpu , void * arg )
38133831{
3814- UNUSED(arg);
38153832#if defined(CONFIG_ACPI_CPPC_LIB ) \
38163833 && 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);
38183835#else
3819- return -ENODEV;
3836+ signed int rc = - ENODEV ;
38203837#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 ;
38213847}
38223848
38233849inline signed int Enable_ACPI_CPPC (unsigned int cpu , void * arg )
38243850{
3825- UNUSED(arg);
38263851#if defined(CONFIG_ACPI_CPPC_LIB ) \
38273852 && 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);
38293854#else
3830- return -ENODEV;
3855+ signed int rc = - ENODEV ;
38313856#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 ;
38323866}
38333867
38343868signed 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)
38443878
38453879 if ((rc = cppc_get_perf_ctrs (Core -> Bind , & CPPC_Perf )) == 0 ) {
38463880 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 );
38483883 } 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 );
38503886 }
38513887 if (rc == 0 ) {
38523888 #if LINUX_VERSION_CODE >= KERNEL_VERSION (5 , 1 , 0 )
@@ -3884,7 +3920,8 @@ signed int Get_ACPI_CPPC_Registers(unsigned int cpu, void *arg)
38843920 if (rc == 0 ) {
38853921 Core -> PowerThermal .ACPI_CPPC .Desired = desired_perf ;
38863922 } 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 );
38883925 }
38893926 #endif
38903927 }
@@ -3894,24 +3931,6 @@ signed int Get_ACPI_CPPC_Registers(unsigned int cpu, void *arg)
38943931#endif /* CONFIG_ACPI_CPPC_LIB */
38953932}
38963933
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-
39153934signed int Read_ACPI_CPPC_Registers (unsigned int cpu , void * arg )
39163935{
39173936 signed int rc = Get_ACPI_CPPC_Registers (cpu , arg );
@@ -7344,7 +7363,8 @@ signed int Put_ACPI_CPPC_Registers(unsigned int cpu, void *arg)
73447363 if (cppc_get_desired_perf (Core -> Bind , & desired_perf ) == 0 ) {
73457364 perf_ctrls .desired_perf = desired_perf ;
73467365 } 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 );
73487368 }
73497369 #endif
73507370
@@ -7410,21 +7430,21 @@ signed int Put_ACPI_CPPC_Registers(unsigned int cpu, void *arg)
74107430
74117431 Core -> PowerThermal .ACPI_CPPC .Maximum = CPPC_Caps .highest_perf ;
74127432 } else {
7413- pr_err ("CoreFreq: cppc_get_perf_caps() error\n");
7433+ pr_debug ("CoreFreq: cppc_get_perf_caps(cpu=%u ) error\n" , cpu );
74147434 }
74157435 #if LINUX_VERSION_CODE >= KERNEL_VERSION (5 , 1 , 0 )
74167436 if (cppc_get_desired_perf (cpu , & desired_perf ) == 0 ) {
74177437 perf_ctrls .desired_perf = desired_perf ;
74187438
74197439 Core -> PowerThermal .ACPI_CPPC .Desired = desired_perf ;
74207440 } else {
7421- pr_err ("CoreFreq: cppc_get_desired_perf() error\n");
7441+ pr_debug ("CoreFreq: cppc_get_desired_perf(cpu=%u ) error\n" , cpu );
74227442 }
74237443 #endif
74247444 pClockZen -> rc = RC_OK_COMPUTE ;
74257445 }
74267446 } else {
7427- pr_err ("CoreFreq: cppc_get_perf_*() error\n");
7447+ pr_debug ("CoreFreq: cppc_get_perf_*(cpu=%u ) error\n" , Core -> Bind );
74287448 }
74297449 return 0 ;
74307450#else
0 commit comments