Skip to content

Commit 5ec7b7c

Browse files
committed
[AMD][Genoa] Attempt to read SOC voltage
* Apply monitoring interval in RAM consumption calculation
1 parent 094c2f3 commit 5ec7b7c

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

x86_64/amd_reg.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2370,3 +2370,19 @@ typedef union
23702370
VID : 32-24; /* Voltage ID */
23712371
};
23722372
} AMD_17_CORE_VID;
2373+
2374+
typedef union
2375+
{/* --- SMU SVI [ Genoa ] ---
2376+
* ZEN4 [AF_11] [ 0x5a010 ] [ 0x5a014 ]
2377+
* Idle: 0x00009a81 0x00019a81
2378+
* Load: 0x0000a401 0x0001a401
2379+
*/
2380+
unsigned int value;
2381+
struct {
2382+
unsigned int
2383+
SVI0 : 8-0,
2384+
SVI1 : 16-8,
2385+
PKG : 17-16, /* 1 for 2nd processor socket */
2386+
RSVD : 32-17;
2387+
};
2388+
} AMD_GNA_SVI;

x86_64/corefreqk.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20498,7 +20498,8 @@ static void Call_HSMP_ACCU(CORE_RO *Core)
2049820498
{
2049920499
Core->Delta.RAM.ACCU = (unsigned long long) DIMM_PWR.mWatt;
2050020500
Core->Delta.RAM.ACCU <<= PUBLIC(RO(Proc))->PowerThermal.Unit.ESU;
20501-
Core->Delta.RAM.ACCU = Core->Delta.RAM.ACCU / 1000LLU;
20501+
Core->Delta.RAM.ACCU *= PUBLIC(RO(Proc))->SleepInterval;
20502+
Core->Delta.RAM.ACCU = Core->Delta.RAM.ACCU / (1000LLU * 1000LLU);
2050220503
}
2050320504
}
2050420505
else if (IS_HSMP_OOO(rx))
@@ -20600,12 +20601,18 @@ static void Call_DFLT( const unsigned int plane0, const unsigned int plane1,
2060020601
static void Call_Genoa( const unsigned int plane0, const unsigned int plane1,
2060120602
const unsigned long long factor )
2060220603
{
20603-
UNUSED(plane0);
20604-
UNUSED(plane1);
20604+
AMD_GNA_SVI SVI = {.value = 0};
2060520605
UNUSED(factor);
2060620606

2060720607
PUBLIC(RO(Proc))->PowerThermal.VID.CPU = \
2060820608
PUBLIC(RO(Core,AT( PUBLIC(RO(Proc))->Service.Core )))->PowerThermal.VID;
20609+
20610+
Core_AMD_SMN_Read(SVI,
20611+
PUBLIC(RO(Core, AT(PUBLIC(RO(Proc))->Service.Core)))->T.PackageID == 0 ?
20612+
SMU_AMD_F17H_SVI(plane0) : SMU_AMD_F17H_SVI(plane1),
20613+
PRIVATE(OF(Zen)).Device.DF);
20614+
20615+
PUBLIC(RO(Proc))->PowerThermal.VID.SOC = SVI.SVI1;
2060920616
}
2061020617

2061120618
static enum hrtimer_restart Entry_AMD_F17h(struct hrtimer *pTimer,
@@ -20660,7 +20667,7 @@ static enum hrtimer_restart Cycle_AMD_Zen4_RPL(struct hrtimer *pTimer)
2066020667
}
2066120668
static enum hrtimer_restart Cycle_AMD_Zen4_Genoa(struct hrtimer *pTimer)
2066220669
{
20663-
return Entry_AMD_F17h(pTimer, Call_Genoa_ACCU, Call_Genoa, 0, 0, 0LLU);
20670+
return Entry_AMD_F17h(pTimer, Call_Genoa_ACCU, Call_Genoa, 1, 2, 0LLU);
2066420671
}
2066520672
static enum hrtimer_restart Cycle_AMD_F17h(struct hrtimer *pTimer)
2066620673
{

0 commit comments

Comments
 (0)