Skip to content

Commit 7a9a994

Browse files
committed
[Intel/Hybrid] Allows to alter Secondary Maximum Turbo Ratio Limit
1 parent 7b9245e commit 7a9a994

6 files changed

+69
-6
lines changed

corefreq-cli-rsc-en.h

+1
Original file line numberDiff line numberDiff line change
@@ -2080,6 +2080,7 @@
20802080
#define RSC_XAPIC_CODE " xAPIC"
20812081
#define RSC_X2APIC_CODE " x2APIC"
20822082
#define RSC_FIRMWARE_CODE "Firmware"
2083+
#define RSC_HYBRID_CODE "Hybrid"
20832084

20842085
#define RSC_TOPOLOGY_HDR_PKG_CODE "CPU Pkg Apic"
20852086
#define RSC_TOPOLOGY_HDR_SMT_CODE " Core/Thread"

corefreq-cli-rsc.c

+1
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,7 @@ RESOURCE_ST Resource[] = {
533533
LDT(RSC_ARCHITECTURE),
534534
LDT(RSC_VENDOR_ID),
535535
LDQ(RSC_FIRMWARE),
536+
LDQ(RSC_HYBRID),
536537
LDT(RSC_MICROCODE),
537538
LDT(RSC_SIGNATURE),
538539
LDT(RSC_STEPPING),

corefreq-cli-rsc.h

+1
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ enum {
337337
RSC_ARCHITECTURE,
338338
RSC_VENDOR_ID,
339339
RSC_FIRMWARE,
340+
RSC_HYBRID,
340341
RSC_MICROCODE,
341342
RSC_SIGNATURE,
342343
RSC_STEPPING,

corefreq-cli.c

+50-3
Original file line numberDiff line numberDiff line change
@@ -936,8 +936,24 @@ void RefreshTopFreq(TGrid *grid, DATA_TYPE data)
936936
struct FLIP_FLOP *CFlop = &RO(Shm)->Cpu[top].FlipFlop[
937937
!RO(Shm)->Cpu[top].Toggle
938938
];
939-
RefreshItemFreq(grid, ratio,
940-
ABS_FREQ_MHz(double, ratio, CFlop->Clock));
939+
RefreshItemFreq(grid, ratio, ABS_FREQ_MHz(double, ratio, CFlop->Clock));
940+
}
941+
942+
void RefreshHybridFreq(TGrid *grid, DATA_TYPE data)
943+
{
944+
enum RATIO_BOOST boost = data.uint[0];
945+
unsigned int ratio = RO(Shm)->Cpu[
946+
RO(Shm)->Proc.Service.Hybrid
947+
].Boost[boost];
948+
949+
struct FLIP_FLOP *CFlop = &RO(Shm)->Cpu[
950+
RO(Shm)->Proc.Service.Hybrid
951+
].FlipFlop[
952+
!RO(Shm)->Cpu[
953+
RO(Shm)->Proc.Service.Hybrid
954+
].Toggle
955+
];
956+
RefreshItemFreq(grid, ratio, ABS_FREQ_MHz(double, ratio, CFlop->Clock));
941957
}
942958

943959
void RefreshConfigTDP(TGrid *grid, DATA_TYPE data)
@@ -1183,7 +1199,7 @@ REASON_CODE SysInfoProc(Window *win, CUINT width, CELL_FUNC OutFunc)
11831199
}
11841200
PUT( SCANKEY_NULL, attrib[RO(Shm)->Proc.Features.Turbo_Unlock],
11851201
width, 2, "%s%.*s[%7.*s]", RSC(BOOST).CODE(),
1186-
width - 23, hSpace, 6,
1202+
width - 12 - RSZ(BOOST), hSpace, 6,
11871203
RO(Shm)->Proc.Features.Turbo_Unlock ?
11881204
RSC(UNLOCK).CODE() : RSC(LOCK).CODE() );
11891205

@@ -1248,6 +1264,37 @@ REASON_CODE SysInfoProc(Window *win, CUINT width, CELL_FUNC OutFunc)
12481264
width, OutFunc, attrib[3] ),
12491265
RefreshTopFreq, boost );
12501266
}
1267+
if (RO(Shm)->Proc.Features.ExtFeature.EDX.Hybrid == 1)
1268+
{
1269+
PUT( SCANKEY_NULL, attrib[RO(Shm)->Proc.Features.Turbo_Unlock],
1270+
width, 2, "%s%.*s[%7.*s]", RSC(HYBRID).CODE(),
1271+
width - 12 - RSZ(HYBRID), hSpace, 6,
1272+
RO(Shm)->Proc.Features.Turbo_Unlock ?
1273+
RSC(UNLOCK).CODE() : RSC(LOCK).CODE() );
1274+
1275+
for(boost = BOOST(1C), activeCores = 1;
1276+
boost > BOOST(1C)-(enum RATIO_BOOST)RO(Shm)->Proc.Features.SpecTurboRatio;
1277+
boost--, activeCores++)
1278+
{
1279+
CLOCK_ARG clockMod={.NC=BOXKEY_TURBO_CLOCK_NC | activeCores,.Offset=0};
1280+
char pfx[10+1+1];
1281+
StrFormat(pfx, 10+1+1, "%2uC", activeCores);
1282+
1283+
CFlop = &RO(Shm)->Cpu[
1284+
RO(Shm)->Proc.Service.Hybrid
1285+
].FlipFlop[
1286+
!RO(Shm)->Cpu[RO(Shm)->Proc.Service.Hybrid].Toggle
1287+
];
1288+
1289+
GridCall( PrintRatioFreq(win, CFlop,
1290+
0, pfx, &RO(Shm)->Cpu[
1291+
RO(Shm)->Proc.Service.Hybrid
1292+
].Boost[boost],
1293+
1, clockMod.ullong,
1294+
width, OutFunc, attrib[3] ),
1295+
RefreshHybridFreq, boost );
1296+
}
1297+
}
12511298

12521299
PUT( SCANKEY_NULL, attrib[RO(Shm)->Proc.Features.Uncore_Unlock],
12531300
width, 2, "%s%.*s[%7.*s]", RSC(UNCORE).CODE(),

corefreqk.c

+14-3
Original file line numberDiff line numberDiff line change
@@ -2565,8 +2565,19 @@ long For_All_Turbo_Clock(CLOCK_ARG *pClockMod, void (*ConfigFunc)(void *))
25652565
static void Intel_Turbo_Cfg8C_PerCore(void *arg)
25662566
{
25672567
CLOCK_TURBO_ARG *pClockCfg8C = (CLOCK_TURBO_ARG *) arg;
2568+
unsigned int registerAddress = MSR_TURBO_RATIO_LIMIT;
25682569

2569-
RDMSR(pClockCfg8C->Config.Cfg0, MSR_TURBO_RATIO_LIMIT);
2570+
if (PUBLIC(RO(Proc))->Features.ExtFeature.EDX.Hybrid == 1)
2571+
{
2572+
CORE_RO *Core;
2573+
unsigned int cpu = smp_processor_id();
2574+
Core = (CORE_RO *) PUBLIC(RO(Core, AT(cpu)));
2575+
2576+
if (Core->T.Cluster.Hybrid.CoreType == Hybrid_Atom) {
2577+
registerAddress = MSR_SECONDARY_TURBO_RATIO_LIMIT;
2578+
}
2579+
}
2580+
RDMSR(pClockCfg8C->Config.Cfg0, registerAddress);
25702581

25712582
if (pClockCfg8C->pClockMod != NULL) /* Read-Only function called ? */
25722583
{
@@ -2644,8 +2655,8 @@ static void Intel_Turbo_Cfg8C_PerCore(void *arg)
26442655
break;
26452656
}
26462657
if (WrRd8C) {
2647-
WRMSR(pClockCfg8C->Config.Cfg0, MSR_TURBO_RATIO_LIMIT);
2648-
RDMSR(pClockCfg8C->Config.Cfg0, MSR_TURBO_RATIO_LIMIT);
2658+
WRMSR(pClockCfg8C->Config.Cfg0, registerAddress);
2659+
RDMSR(pClockCfg8C->Config.Cfg0, registerAddress);
26492660
pClockCfg8C->rc = RC_OK_COMPUTE;
26502661
}
26512662
} else {

intelmsr.h

+2
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@
7676
#define MSR_TURBO_RATIO_LIMIT3 0x000001ac
7777
#endif
7878

79+
#define MSR_SECONDARY_TURBO_RATIO_LIMIT 0x00000650
80+
7981
#ifndef MSR_TURBO_POWER_CURRENT_LIMIT
8082
#define MSR_TURBO_POWER_CURRENT_LIMIT 0x000001ac
8183
#endif

0 commit comments

Comments
 (0)