- [Sys-clk-OC]: Avoid conflicts with ptm module setting boost clocks

- [Sys-clk-OC]: Reduce sensitivity of Auto CPU Boost (≥95%)
- [test_patch]: Throw error if no patching entries were found.
This commit is contained in:
KazushiM
2022-04-14 23:06:39 +08:00
parent 926b9016b1
commit c369641229
4 changed files with 35 additions and 17 deletions

View File

@@ -909,7 +909,17 @@ namespace ams::ldr::oc {
cnt[MEM_PLL_CLK],
cnt[GPU_MAX_CLOCK]);
if (cnt[CPU_CLOCK_VDD] > 1 ||
if (
#ifndef ATMOSPHERE_IS_STRATOSPHERE
!cnt[CPU_CLOCK_VDD] ||
!cnt[CPU_TABLE] ||
!cnt[GPU_TABLE] ||
!cnt[CPU_MAX_VOLT] ||
!cnt[GPU_PLL_CLK] ||
!cnt[MEM_PLL_CLK] ||
!cnt[GPU_MAX_CLOCK] ||
#endif
cnt[CPU_CLOCK_VDD] > 1 ||
cnt[CPU_TABLE] > 1 ||
cnt[GPU_TABLE] > 1 ||
cnt[CPU_MAX_VOLT] > 13 ||
@@ -1082,7 +1092,15 @@ namespace ams::ldr::oc {
cnt[MEM_VOLT],
cnt[MEM_PLL_CLK]);
if (cnt[CPU_CLOCK] > 1 ||
if (
#ifndef ATMOSPHERE_IS_STRATOSPHERE
!cnt[CPU_CLOCK] ||
!cnt[CPU_MAX_VOLT] ||
!cnt[MEM_CLOCK] ||
!cnt[MEM_VOLT] ||
!cnt[MEM_PLL_CLK] ||
#endif
cnt[CPU_CLOCK] > 1 ||
cnt[MEM_VOLT] > 2 ||
cnt[MEM_PLL_CLK] > 2)
{

View File

@@ -45,8 +45,16 @@ void* loadExec(const char* file_loc, size_t* out_size) {
exit(-1);
}
fseek(fp, 0, SEEK_END);
size_t size = ftell(fp);
if (fseek(fp, 0, SEEK_END) < 0) {
fprintf(stderr, "fseek error\n");
exit(-1);
}
long size = ftell(fp);
if (size == -1L) {
fprintf(stderr, "\"%s\" is a directory", file_loc);
exit(-1);
}
fseek(fp, 0, SEEK_SET);
void* buf = malloc(size);
@@ -55,7 +63,7 @@ void* loadExec(const char* file_loc, size_t* out_size) {
fclose(fp);
if (size < 8192) {
fprintf(stderr, "File is too small to process: \"%s\" (%lu B)\n", file_loc, size);
fprintf(stderr, "File is too small to process: \"%s\" (%ld B)\n", file_loc, size);
exit(-1);
}

View File

@@ -180,7 +180,7 @@ The `[values]` section allows you to alter timings in sys-clk, you should not ne
| Key | Desc | Default |
|:-----------------------:|-------------------------------------------------------------------------------|:-------:|
|**auto_cpu_boost** | Auto-boost CPU when system Core #3 utilization is high | ON |
|**auto_cpu_boost** | Auto-boost CPU when system Core #3 utilization ≥ 95% | ON |
|**sync_reversenx_mode** | Sync nominal profile (mode) with ReverseNX (-Tool and -RT) | ON |
|**temp_log_interval_ms** | Defines how often sys-clk log temperatures, in milliseconds (`0` to disable) | 0 ms |
|**csv_write_interval_ms**| Defines how often sys-clk writes to the CSV, in milliseconds (`0` to disable) | 0 ms |

View File

@@ -244,16 +244,7 @@ void ClockManager::WaitForNextTick()
uint64_t freeIdleTick = 19'200 * tickWaitTimeMs;
uint8_t freePerc = systemCoreIdleTick / (freeIdleTick / 100);
uint8_t systemCoreBoostFreeThreshold = 5;
switch (this->context->realProfile)
{
case SysClkProfile_HandheldChargingOfficial:
case SysClkProfile_Docked:
systemCoreBoostFreeThreshold = 10;
break;
default:
break;
}
constexpr uint8_t systemCoreBoostFreeThreshold = 5;
bool systemCoreBoostCPUPrevState = this->oc->systemCoreBoostCPU;
this->oc->systemCoreBoostCPU = (freePerc <= systemCoreBoostFreeThreshold);
@@ -416,7 +407,8 @@ bool ClockManager::RefreshContext()
}
// restore clocks to stock values on app or profile change
if(hasChanged)
// and let ptm module handle boost clocks rather than resetting
if (hasChanged && !IsCpuBoostMode())
Clocks::ResetToStock();
/* Check ReverseNX-RT and adjust nominal profile when context changes */