Skip to content

Commit c2e28ed

Browse files
committed
[AMD][Raphael] Attempt to read the SoC voltage
1 parent 90d4825 commit c2e28ed

File tree

2 files changed

+33
-13
lines changed

2 files changed

+33
-13
lines changed

x86_64/amd_reg.h

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2314,6 +2314,10 @@ typedef union
23142314
#define SMU_AMD_RMB_SVI(_plane) (0x0006f010 + (_plane << 2))
23152315
#endif
23162316

2317+
#ifndef SMU_AMD_F19H_SVI
2318+
#define SMU_AMD_F19H_SVI(_plane) (0x0007300c + (_plane << 2))
2319+
#endif
2320+
23172321
typedef union
23182322
{/* --- SMU SVI [ 0x5a00c ; 0x5a010 ; 0x5a014 ; 0x6f038] ---
23192323
* [ CPU addr] [ SoC addr]
@@ -2333,7 +2337,7 @@ typedef union
23332337
VID : 24-16, /* Voltage: SVI{0,1}_PLANE0_VDDCOR */
23342338
ReservedBits2 : 32-24;
23352339
};
2336-
} AMD_17_SVI;
2340+
} AMD_F17H_SVI;
23372341

23382342
typedef union
23392343
{/* --- SMU SVI [ Rembrandt ] ---
@@ -2369,13 +2373,16 @@ typedef union
23692373
ReservedBits : 24-0, /* MTS: All zeros */
23702374
VID : 32-24; /* Voltage ID */
23712375
};
2372-
} AMD_17_CORE_VID;
2376+
} AMD_F17H_CORE_VID;
23732377

23742378
typedef union
2375-
{/* --- SMU SVI [ Genoa ] ---
2376-
* ZEN4 [AF_11] [ 0x5a010 ] [ 0x5a014 ]
2379+
{/* --- SMU SVI [ ZEN4 ] ---
2380+
* Genoa [AF_11] [ 0x5a010 ] [ 0x5a014 ]
23772381
* Idle: 0x00009a81 0x00019a81
23782382
* Load: 0x0000a401 0x0001a401
2383+
* Raphael [AF_61] [ 0x73010 ] [ 0x73014 ]
2384+
* Idle: 0x0000bd41 0x0001bd41
2385+
* Load: 0x0000b9c1 0x0001b901
23792386
*/
23802387
unsigned int value;
23812388
struct {
@@ -2385,4 +2392,4 @@ typedef union
23852392
PKG : 17-16, /* 1 for 2nd processor socket */
23862393
RSVD : 32-17;
23872394
};
2388-
} AMD_GNA_SVI;
2395+
} AMD_F19H_SVI;

x86_64/corefreqk.c

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20521,7 +20521,7 @@ static void Call_Genoa_ACCU(CORE_RO *Core)
2052120521
Call_HSMP_ACCU(Core);
2052220522
}
2052320523

20524-
static void SoC_RAPL(AMD_17_SVI SVI, const unsigned long long factor)
20524+
static void SoC_RAPL(AMD_F17H_SVI SVI, const unsigned long long factor)
2052520525
{
2052620526
unsigned long long VCC, ICC, ACCU;
2052720527
/* PLATFORM RAPL workaround to provide the SoC power */
@@ -20537,7 +20537,7 @@ static void SoC_RAPL(AMD_17_SVI SVI, const unsigned long long factor)
2053720537
static void Call_SVI( const unsigned int plane0, const unsigned int plane1,
2053820538
const unsigned long long factor )
2053920539
{
20540-
AMD_17_SVI SVI = {.value = 0};
20540+
AMD_F17H_SVI SVI = {.value = 0};
2054120541

2054220542
Core_AMD_SMN_Read( SVI,
2054320543
SMU_AMD_F17H_SVI(plane0),
@@ -20557,7 +20557,7 @@ static void Call_SVI( const unsigned int plane0, const unsigned int plane1,
2055720557
static void Call_SVI_APU(const unsigned int plane0, const unsigned int plane1,
2055820558
const unsigned long long factor)
2055920559
{
20560-
AMD_17_SVI SVI = {.value = 0};
20560+
AMD_F17H_SVI SVI = {.value = 0};
2056120561

2056220562
Core_AMD_SMN_Read( SVI,
2056320563
SMU_AMD_F17_60H_SVI(plane0),
@@ -20604,14 +20604,27 @@ static void Call_DFLT( const unsigned int plane0, const unsigned int plane1,
2060420604
PUBLIC(RO(Core,AT( PUBLIC(RO(Proc))->Service.Core )))->PowerThermal.VID;
2060520605
}
2060620606

20607+
static void Call_Raphael(const unsigned int plane0, const unsigned int plane1,
20608+
const unsigned long long factor)
20609+
{
20610+
AMD_F19H_SVI SVI = {.value = 0};
20611+
20612+
Call_DFLT(plane0, plane1, factor);
20613+
20614+
Core_AMD_SMN_Read(SVI,
20615+
PUBLIC(RO(Core, AT(PUBLIC(RO(Proc))->Service.Core)))->T.PackageID == 0 ?
20616+
SMU_AMD_F19H_SVI(plane0) : SMU_AMD_F19H_SVI(plane1),
20617+
PRIVATE(OF(Zen)).Device.DF);
20618+
20619+
PUBLIC(RO(Proc))->PowerThermal.VID.SOC = SVI.SVI1;
20620+
}
20621+
2060720622
static void Call_Genoa( const unsigned int plane0, const unsigned int plane1,
2060820623
const unsigned long long factor )
2060920624
{
20610-
AMD_GNA_SVI SVI = {.value = 0};
20611-
UNUSED(factor);
20625+
AMD_F19H_SVI SVI = {.value = 0};
2061220626

20613-
PUBLIC(RO(Proc))->PowerThermal.VID.CPU = \
20614-
PUBLIC(RO(Core,AT( PUBLIC(RO(Proc))->Service.Core )))->PowerThermal.VID;
20627+
Call_DFLT(plane0, plane1, factor);
2061520628

2061620629
Core_AMD_SMN_Read(SVI,
2061720630
PUBLIC(RO(Core, AT(PUBLIC(RO(Proc))->Service.Core)))->T.PackageID == 0 ?
@@ -20669,7 +20682,7 @@ static enum hrtimer_restart Cycle_AMD_Zen3Plus_RMB(struct hrtimer *pTimer)
2066920682
}
2067020683
static enum hrtimer_restart Cycle_AMD_Zen4_RPL(struct hrtimer *pTimer)
2067120684
{
20672-
return Entry_AMD_F17h(pTimer, Call_MSR_ACCU, Call_DFLT, 0, 0, 0LLU);
20685+
return Entry_AMD_F17h(pTimer, Call_MSR_ACCU, Call_Raphael, 1, 2, 0LLU);
2067320686
}
2067420687
static enum hrtimer_restart Cycle_AMD_Zen4_Genoa(struct hrtimer *pTimer)
2067520688
{

0 commit comments

Comments
 (0)