@@ -2461,6 +2461,9 @@ static COF_ST Factory2COF(CORE_RO *Core) {
24612461static void Query_Linux_CPUFREQ (CLOCK clock , unsigned int cpu )
24622462{
24632463 CORE_RO * Core = (CORE_RO * ) PUBLIC (RO (Core , AT (cpu )));
2464+ bool per_tblflag_cpufreq_boost = false,
2465+ per_cpufreq_boost_enabled = false,
2466+ per_policy_has_boost_freq = false;
24642467#ifdef CONFIG_CPU_FREQ
24652468 struct cpufreq_policy * pFreqPolicy = \
24662469 & PRIVATE (OF (Core , AT (cpu )))-> FreqPolicy ;
@@ -2470,6 +2473,13 @@ static void Query_Linux_CPUFREQ(CLOCK clock, unsigned int cpu)
24702473#ifdef CONFIG_CPU_FREQ
24712474 if (cpufreq_get_policy (pFreqPolicy , cpu ) == 0 )
24722475 {
2476+ #if LINUX_VERSION_CODE >= KERNEL_VERSION (3 , 14 , 0 )
2477+ per_cpufreq_boost_enabled = cpufreq_boost_enabled ();
2478+ #endif
2479+ #if LINUX_VERSION_CODE >= KERNEL_VERSION (4 , 3 , 0 ) \
2480+ && LINUX_VERSION_CODE <= KERNEL_VERSION (6 , 14 , 0 )
2481+ per_policy_has_boost_freq = policy_has_boost_freq (pFreqPolicy );
2482+ #endif
24732483#if LINUX_VERSION_CODE >= KERNEL_VERSION (4 , 8 , 0 )
24742484 struct cpufreq_frequency_table * table ;
24752485 enum RATIO_BOOST boost = BOOST (MIN );
@@ -2491,14 +2501,20 @@ static void Query_Linux_CPUFREQ(CLOCK clock, unsigned int cpu)
24912501 boost ++ ;
24922502 }
24932503 }
2494- if ((table -> flags & CPUFREQ_BOOST_FREQ ) == CPUFREQ_BOOST_FREQ ) {
2504+ #if LINUX_VERSION_CODE >= KERNEL_VERSION (3 , 14 , 0 )
2505+ per_tblflag_cpufreq_boost = \
2506+ (table -> flags & CPUFREQ_BOOST_FREQ ) == CPUFREQ_BOOST_FREQ ;
2507+ #endif
2508+ if (per_cpufreq_boost_enabled
2509+ || per_policy_has_boost_freq
2510+ || per_tblflag_cpufreq_boost )
2511+ {
24952512 if (COF2CPUFREQ (clock , COF ) \
24962513 > COF2CPUFREQ (clock , Core -> Boost [BOOST (TBH )]))
24972514 {
24982515 Core -> Boost [BOOST (TBO )] = Core -> Boost [BOOST (TBH )];
24992516 Core -> Boost [BOOST (TBH )] = COF ;
25002517 }
2501- PUBLIC (RO (Proc ))-> Features .Turbo_OPP = 1 ;
25022518 }
25032519 }
25042520 }
@@ -2509,6 +2525,8 @@ static void Query_Linux_CPUFREQ(CLOCK clock, unsigned int cpu)
25092525 boost * sizeof (enum RATIO_BOOST ));
25102526
25112527 memset (& Core -> Boost [BOOST (18 C )], 0 , diff * sizeof (enum RATIO_BOOST ));
2528+
2529+ PUBLIC (RO (Proc ))-> Features .Turbo_OPP = 1 ;
25122530 }
25132531#endif
25142532 }
@@ -2533,6 +2551,15 @@ static void Query_Linux_CPUFREQ(CLOCK clock, unsigned int cpu)
25332551 COF = Factory2COF (Core );
25342552 }
25352553 Core -> Boost [BOOST (TGT )] = COF ;
2554+
2555+ if (per_cpufreq_boost_enabled
2556+ || per_policy_has_boost_freq
2557+ || per_tblflag_cpufreq_boost )
2558+ {
2559+ BITSET_CC (BUS_LOCK , PUBLIC (RW (Proc ))-> TurboBoost , Core -> Bind );
2560+ } else {
2561+ BITCLR_CC (BUS_LOCK , PUBLIC (RW (Proc ))-> TurboBoost , Core -> Bind );
2562+ }
25362563}
25372564
25382565#ifdef CONFIG_PM_OPP
@@ -3334,6 +3361,7 @@ static void PerCore_Reset(CORE_RO *Core)
33343361 BITCLR_CC (BUS_LOCK , PUBLIC (RO (Proc ))-> PMU_Mask , Core -> Bind );
33353362 BITCLR_CC (BUS_LOCK , PUBLIC (RO (Proc ))-> HWP_Mask , Core -> Bind );
33363363 BITCLR_CC (BUS_LOCK , PUBLIC (RO (Proc ))-> CR_Mask , Core -> Bind );
3364+ BITCLR_CC (BUS_LOCK , PUBLIC (RO (Proc ))-> TurboBoost_Mask ,Core -> Bind );
33373365 BITCLR_CC (BUS_LOCK , PUBLIC (RO (Proc ))-> SPEC_CTRL_Mask , Core -> Bind );
33383366
33393367 BITCLR_CC (BUS_LOCK , PUBLIC (RW (Proc ))-> HWP , Core -> Bind );
@@ -3343,6 +3371,7 @@ static void PerCore_Reset(CORE_RO *Core)
33433371 BITCLR_CC (BUS_LOCK , PUBLIC (RW (Proc ))-> CSV3 , Core -> Bind );
33443372 BITCLR_CC (BUS_LOCK , PUBLIC (RW (Proc ))-> SSBS , Core -> Bind );
33453373 BITCLR_CC (BUS_LOCK , PUBLIC (RW (Proc ))-> VM , Core -> Bind );
3374+ BITCLR_CC (BUS_LOCK , PUBLIC (RW (Proc ))-> TurboBoost , Core -> Bind );
33463375
33473376 BITWISECLR (LOCKLESS , Core -> ThermalPoint .Mask );
33483377 BITWISECLR (LOCKLESS , Core -> ThermalPoint .Kind );
@@ -3582,6 +3611,7 @@ static void PerCore_GenericMachine(void *arg)
35823611 SystemRegisters (Core );
35833612
35843613 BITSET_CC (BUS_LOCK , PUBLIC (RO (Proc ))-> PMU_Mask , Core -> Bind );
3614+ BITSET_CC (BUS_LOCK , PUBLIC (RO (Proc ))-> TurboBoost_Mask ,Core -> Bind );
35853615 BITSET_CC (BUS_LOCK , PUBLIC (RO (Proc ))-> SPEC_CTRL_Mask , Core -> Bind );
35863616}
35873617
0 commit comments