gpu: host1x: Support updating actmon watermark

Add support for updating actmon watermark thresholds so that
actmon DFS can work properly.

Add support for enabling or disabling watermark interrupts.

Bug 3788919

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: Id1d0b744bc8a0a19fccbb3044d4267ae35cd5feb
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2897816
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Rajkumar Kasirajan <rkasirajan@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Johnny Liu
2023-05-03 10:11:54 +00:00
committed by mobile promotions
parent d06443deae
commit 18b0b032d4
2 changed files with 47 additions and 0 deletions

View File

@@ -491,3 +491,43 @@ int host1x_actmon_read_avg_count(struct host1x_client *client)
return readl(host->actmon_regs + offset + 0xa4); return readl(host->actmon_regs + offset + 0xa4);
} }
EXPORT_SYMBOL(host1x_actmon_read_avg_count); EXPORT_SYMBOL(host1x_actmon_read_avg_count);
void host1x_actmon_update_active_wmark(struct host1x_client *client,
u32 avg_upper_wmark,
u32 avg_lower_wmark,
u32 consec_upper_wmark,
u32 consec_lower_wmark,
bool upper_wmark_enabled,
bool lower_wmark_enabled)
{
struct host1x_actmon *actmon = client->actmon;
struct host1x_actmon_module *module;
u32 val = 0;
if (!actmon || !actmon->num_modules)
return;
module = &actmon->modules[HOST1X_ACTMON_MODULE_ACTIVE];
/* Update watermark thresholds */
actmon_module_writel(module,
avg_upper_wmark / 1000 * actmon->usecs_per_sample / 1000,
HOST1X_ACTMON_MODULE_AVG_UPPER_WMARK_REG);
actmon_module_writel(module,
avg_lower_wmark / 1000 * actmon->usecs_per_sample / 1000,
HOST1X_ACTMON_MODULE_AVG_LOWER_WMARK_REG);
actmon_module_writel(module,
consec_upper_wmark / 1000 * actmon->usecs_per_sample / 1000,
HOST1X_ACTMON_MODULE_UPPER_WMARK_REG);
actmon_module_writel(module,
consec_lower_wmark / 1000 * actmon->usecs_per_sample / 1000,
HOST1X_ACTMON_MODULE_LOWER_WMARK_REG);
/* Update watermark interrupt enable bits */
val |= HOST1X_ACTMON_MODULE_INTR_AVG_WMARK_ABOVE_ENB(upper_wmark_enabled);
val |= HOST1X_ACTMON_MODULE_INTR_AVG_WMARK_BELOW_ENB(lower_wmark_enabled);
val |= HOST1X_ACTMON_MODULE_INTR_CONSEC_WMARK_ABOVE_ENB(upper_wmark_enabled);
val |= HOST1X_ACTMON_MODULE_INTR_CONSEC_WMARK_BELOW_ENB(lower_wmark_enabled);
actmon_module_writel(module, val, HOST1X_ACTMON_MODULE_INTR_ENB_REG);
}
EXPORT_SYMBOL(host1x_actmon_update_active_wmark);

View File

@@ -531,5 +531,12 @@ void host1x_actmon_update_client_rate(struct host1x_client *client,
unsigned long rate, unsigned long rate,
u32 *weight); u32 *weight);
void host1x_actmon_read_active_norm(struct host1x_client *client, unsigned long *usage); void host1x_actmon_read_active_norm(struct host1x_client *client, unsigned long *usage);
void host1x_actmon_update_active_wmark(struct host1x_client *client,
u32 avg_upper_wmark,
u32 avg_lower_wmark,
u32 consec_upper_wmark,
u32 consec_lower_wmark,
bool upper_wmark_enabled,
bool lower_wmark_enabled);
#endif #endif