add wip erista vmax

This commit is contained in:
souldbminersmwc committed 2026-09-29 19:28:07 -04:00
1 parent c78010a1e5
commit 8953cedd50
12 files changed
+86 -17

No files matched your search

@@ -115,6 +115,7 @@ volatile CustomizeTable C = {
.eristaGpuUV = 0,
.eristaGpuVmin = 810,
.eristaGpuVmax = 1050, /* unused for now*/
.marikoGpuUV = 2,
/* Vmin past 795mV won't work due boot voltage being 800mV. */
@@ -118,7 +118,8 @@ struct CustomizeTable {
u32 eristaGpuUV;
u32 eristaGpuVmin;
u32 eristaGpuVmax;
u32 marikoGpuUV;
u32 marikoGpuVmin;
u32 marikoGpuVmax;
@@ -93,6 +93,7 @@ namespace ams::ldr {
R_DEFINE_ERROR_RESULT(HookUnavailable, 1030);
R_DEFINE_ERROR_RESULT(InvalidNvsrvDevTable, 1031);
R_DEFINE_ERROR_RESULT(InvalidForceVerbosityPattern, 1032);
R_DEFINE_ERROR_RESULT(InvalidGpuRgltrPattern, 1033);
}
namespace ams::ldr::hoc {
@@ -60,10 +60,11 @@ namespace ams::ldr::hoc::pcv::erista {
{"CPU Volt Dfll", &CpuVoltDfll, 1, nullptr, CpuTune0Low },
{"GPU Volt DVFS", &GpuVoltDVFS, 1, nullptr, GpuVminOfficial },
{"GPU Volt Thermals", &GpuVoltThermals, 1, nullptr, GpuVminOfficial },
// {"GPU Rgltr Max Vlt", &GpuRgltrMax, 2, nullptr, MaxGpuRgltrVolt },
{"GPU Freq Table", GpuFreqCvbTable<false>, 1, nullptr, GpuCvbDefaultMaxFreq },
{"GPU Freq Asm", &GpuFreqMaxAsm, 2, &GpuMaxClockPatternFn },
{"GPU PLL Max", &GpuFreqPllMax, 1, nullptr, GpuClkPllMax },
// {"GPU PLL Limit", &GpuFreqPllLimit, 4, nullptr, GpuClkPllLimit },
{"GPU PLL Limit", &GpuFreqPllLimit, 4, nullptr, GpuClkPllLimit },
{"MEM Table Asm", &MemMtcTableAsm, 4, &MemMtcGetGetTablePatternFn },
{"MEM Freq Mtc", &MemFreqMtcTable, 1, nullptr, EmcClkOSLimit },
{"MEM Freq Max", &MemFreqMax, 0, nullptr, EmcClkOSLimit },
@@ -34,6 +34,10 @@ namespace ams::ldr::hoc::pcv::erista {
PATCH_OFFSET(ptr, C.eristaGpuVmin);
}
// if(C.eristaGpuVmax) {
// PATCH_OFFSET(ptr + 1, C.eristaGpuVmax);
// }
R_SUCCEED();
}
@@ -50,6 +54,15 @@ namespace ams::ldr::hoc::pcv::erista {
PATCH_OFFSET(ptr + 12, C.eristaGpuVmin);
}
// if(C.eristaGpuVmax) {
// PATCH_OFFSET(ptr - 2, C.eristaGpuVmax);
// PATCH_OFFSET(ptr + 1, C.eristaGpuVmax);
// PATCH_OFFSET(ptr + 4, C.eristaGpuVmax);
// PATCH_OFFSET(ptr + 7, C.eristaGpuVmax);
// PATCH_OFFSET(ptr + 10, C.eristaGpuVmax);
// PATCH_OFFSET(ptr + 13, C.eristaGpuVmax);
// }
R_SUCCEED();
}
@@ -107,17 +120,34 @@ namespace ams::ldr::hoc::pcv::erista {
R_SUCCEED();
}
// patch out 1305MHz limit on erista, don't use this!
// Result GpuFreqPllLimit(u32 *ptr) {
// u32 prev_freq = *(ptr - 1);
/* Not strictly needed but there for completeness. Table will limit far before this */
Result GpuFreqPllLimit(u32 *ptr) {
u32 prev_freq = *(ptr - 1);
// if (prev_freq != 128000 && prev_freq != 1300000 && prev_freq != 76800) {
// R_THROW(ldr::ResultInvalidGpuPllEntry());
if (prev_freq != 128000 && prev_freq != 1300000 && prev_freq != 76800) {
R_THROW(ldr::ResultInvalidGpuPllEntry());
}
PATCH_OFFSET(ptr, 3600000);
R_SUCCEED();
}
// Result GpuRgltrMax(u32* ptr) {
// /* Confirm that we are in the correct struct */
// if (std::memcmp(ptr - 5, GpuRgltrVoltPattern, sizeof(GpuRgltrVoltPattern))) {
// R_THROW(ldr::ResultInvalidGpuRgltrPattern());
// }
// PATCH_OFFSET(ptr, 3600000);
// /* Ensure that the max voltage is actually present before patching it */
// if(C.eristaGpuVmax) {
// /* Rgltr Vmax is in uV for some reason? */
// PATCH_OFFSET(ptr, C.eristaGpuVmax * 1000);
// } else {
// /* Lower the default max for safety */
// PATCH_OFFSET(ptr, MaxGoodGpuRgltrVolt);
// }
// R_SUCCEED();
// }
}
@@ -71,12 +71,26 @@ namespace ams::ldr::hoc::pcv::erista {
{ },
};
// constexpr u32 MaxGpuRgltrVolt = 1150'000; // 1.15V
// constexpr u32 MaxGoodGpuRgltrVolt = 1050'000; // NVIDIA rating
// // 0x20 byte struct (8xu32), RgltrEntry. TODO: determine what the other values are
// inline constexpr u32 GpuRgltrVoltPattern[] = {
// 0x2, // unknown, -5
// 0x0, // padding
// 6250, // Step
// 0x0, // padding
// 618750, // Min volt?
// 1150000, // max volt, anchor
// 0x0, // padding
// 1000000, // unknown
// };
// static_assert(sizeof(GpuRgltrVoltPattern) == (sizeof(u32) * 8), "Invalid GpuRgltrVoltPattern");
Result GpuVoltDVFS(u32 *ptr);
Result GpuVoltThermals(u32 *ptr);
Result GpuFreqMaxAsm(u32 *ptr32);
Result GpuFreqPllMax(u32 *ptr);
// patch out 1305MHz limit on erista, don't use this!
// Result GpuFreqPllLimit(u32 *ptr);
Result GpuFreqPllLimit(u32 *ptr);
// Result GpuRgltrMax(u32* ptr);
}
@@ -161,6 +161,7 @@ namespace ams::ldr::hoc::pcv {
{ eristaGpuDvfsMaxFreq, 768'000, 1152'000, panic::Gpu, },
{ marikoGpuDvfsMaxFreq, 768'000, 1574'400, panic::Gpu, },
{ C.marikoGpuVmax, 800, 995, panic::Gpu, }, /* Official GPU vMax is 1050mV */
{ C.eristaGpuVmax, 800, 1050, panic::Gpu },
};
for (auto &v : validators) {
@@ -139,6 +139,7 @@ typedef enum {
KipConfigValue_eristaGpuUV,
KipConfigValue_eristaGpuVmin,
KipConfigValue_eristaGpuVmax,
KipConfigValue_marikoGpuUV,
KipConfigValue_marikoGpuVmin,
@@ -456,6 +457,8 @@ static inline const char* hocclkFormatConfigValue(HocClkConfigValue val, bool pr
return pretty ? "Erista GPU Undervolt" : "erista_gpu_uv";
case KipConfigValue_eristaGpuVmin:
return pretty ? "Erista GPU Vmin" : "erista_gpu_vmin";
case KipConfigValue_eristaGpuVmax:
return pretty ? "Erista GPU Vmax" : "erista_gpu_vmax";
// GPU – Mariko
case KipConfigValue_marikoGpuUV:
@@ -707,6 +710,7 @@ static inline uint64_t hocclkValidConfigValue(HocClkConfigValue val, uint64_t in
case KipConfigValue_marikoCpuMaxClock:
case KipConfigValue_eristaGpuUV:
case KipConfigValue_eristaGpuVmin:
case KipConfigValue_eristaGpuVmax:
case KipConfigValue_marikoGpuUV:
case KipConfigValue_marikoGpuVmin:
case KipConfigValue_marikoGpuVmax:
@@ -538,6 +538,12 @@ std::vector<std::string> ConfigInfoStrings(HocClkConfigValue val, bool isMariko,
"Default: 810 mV (812mV as erista is stepped by 6.5mV instead of 5mV)"
};
case KipConfigValue_eristaGpuVmax:
return {
"Maximum GPU voltage",
"Default: 1050mV"
};
case KipConfigValue_commonGpuVoltOffset:
return {
"The offset added/subtracted to all GPU voltages marked as \"auto\"",
@@ -2570,6 +2570,8 @@ class GpuSubmenuGui : public MiscGui {
{}, gpuUvConfE, false, true);
addConfigButton(KipConfigValue_eristaGpuVmin, "GPU Minimum Voltage", ValueRange(675, 875, 5, "mV", 1), "GPU Minimum Voltage",
&thresholdsDisabled, {}, {}, false, true);
// addConfigButton(KipConfigValue_eristaGpuVmax, "GPU Maximum Voltage", ValueRange(800, 1050, 5, "mV", 1), "GPU Maximum Voltage",
// &thresholdsDisabled, {}, {}, false, true);
} else {
addConfigButton(KipConfigValue_marikoGpuUV, "GPU Undervolt Table", ValueRange(0, 1, 1, "", 1), "GPU Undervolt Table", &thresholdsDisabled,
{}, gpuUvConfM, false, true);
@@ -2590,10 +2592,8 @@ class GpuSubmenuGui : public MiscGui {
addConfigButton(KipConfigValue_marikoGpuVmin, "GPU VMIN", ValueRange(0, 0, 0, "0", 1), "GPU VMIN", &thresholdsDisabled, {}, mGpuVoltsVmin,
false, true);
ValueThresholds MgpuVmaxThresholds(805, 850);
if(IsMariko()) {
addConfigButton(KipConfigValue_marikoGpuVmax, "GPU Maximum Voltage", ValueRange(800, 995, 5, "mV", 1), "GPU Maximum Voltage",
&MgpuVmaxThresholds, {}, {}, false, true);
}
addConfigButton(KipConfigValue_marikoGpuVmax, "GPU Maximum Voltage", ValueRange(800, 995, 5, "mV", 1), "GPU Maximum Voltage",
&MgpuVmaxThresholds, {}, {}, false, true);
}
std::vector<NamedValue> gpuOffset = {
@@ -124,6 +124,7 @@ namespace file::kip {
CUST_WRITE_FIELD_BATCH(&table, eristaGpuUV, file::config::GetConfigValue(KipConfigValue_eristaGpuUV));
CUST_WRITE_FIELD_BATCH(&table, eristaGpuVmin, file::config::GetConfigValue(KipConfigValue_eristaGpuVmin));
CUST_WRITE_FIELD_BATCH(&table, eristaGpuVmax, file::config::GetConfigValue(KipConfigValue_eristaGpuVmax));
CUST_WRITE_FIELD_BATCH(&table, marikoGpuUV, file::config::GetConfigValue(KipConfigValue_marikoGpuUV));
CUST_WRITE_FIELD_BATCH(&table, marikoGpuVmin, file::config::GetConfigValue(KipConfigValue_marikoGpuVmin));
@@ -322,6 +323,8 @@ namespace file::kip {
configValues.values[KipConfigValue_eristaGpuUV] = cust_get_erista_gpu_uv(&table);
configValues.values[KipConfigValue_eristaGpuVmin] = cust_get_erista_gpu_vmin(&table);
configValues.values[KipConfigValue_eristaGpuVmax] = cust_get_erista_gpu_vmax(&table);
configValues.values[KipConfigValue_marikoGpuUV] = cust_get_mariko_gpu_uv(&table);
configValues.values[KipConfigValue_marikoGpuVmin] = cust_get_mariko_gpu_vmin(&table);
configValues.values[KipConfigValue_marikoGpuVmax] = cust_get_mariko_gpu_vmax(&table);
@@ -86,6 +86,7 @@ namespace file::kip {
u32 eristaGpuUV;
u32 eristaGpuVmin;
u32 eristaGpuVmax;
u32 marikoGpuUV;
u32 marikoGpuVmin;
@@ -364,6 +365,9 @@ namespace file::kip {
static inline bool cust_set_erista_gpu_vmin(const char *p, u32 v) {
CUST_WRITE_FIELD(p, eristaGpuVmin, v);
}
static inline bool cust_set_erista_gpu_vmax(const char *p, u32 v) {
CUST_WRITE_FIELD(p, eristaGpuVmax, v);
}
static inline bool cust_set_mariko_gpu_uv(const char *p, u32 v) {
CUST_WRITE_FIELD(p, marikoGpuUV, v);
}
@@ -581,6 +585,9 @@ namespace file::kip {
static inline u32 cust_get_erista_gpu_vmin(const CustomizeTable *t) {
return CUST_GET_FIELD(t, eristaGpuVmin);
}
static inline u32 cust_get_erista_gpu_vmax(const CustomizeTable *t) {
return CUST_GET_FIELD(t, eristaGpuVmax);
}
static inline u32 cust_get_mariko_gpu_uv(const CustomizeTable *t) {
return CUST_GET_FIELD(t, marikoGpuUV);
}