drm/tegra: Set actmon count weight for nvdec once

Method invocation for updating count weight for nvdec may conflict
with a job being submitted through host1x.

Change the implementation to set count weight values for both actmon and
the engine once in runtime resume cycle to prevent possible conflicts.

Bug 3962196

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: I19d160abd90373721df78cdb107ca396a206a6e8
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2952692
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Johnny Liu
2023-08-08 13:50:33 +00:00
committed by mobile promotions
parent 69d9f479a4
commit d412dc39e1

View File

@@ -91,10 +91,8 @@ static inline void nvdec_writel(struct nvdec *nvdec, u32 value,
static int nvdec_set_rate(struct nvdec *nvdec, unsigned long rate)
{
const struct nvdec_config *config = nvdec->config;
struct host1x_client *client = &nvdec->client.base;
unsigned long dev_rate;
u32 weight, emc_kbps;
u32 emc_kbps;
int err;
err = clk_set_rate(nvdec->clks[0].clk, rate);
@@ -113,20 +111,6 @@ static int nvdec_set_rate(struct nvdec *nvdec, unsigned long rate)
dev_warn(nvdec->dev, "failed to set icc bw: %d\n", err);
}
host1x_actmon_update_client_rate(client, dev_rate, &weight);
if (!weight)
return 0;
if (!config->has_riscv) {
nvdec_writel(nvdec, weight, NVDEC_TFBIF_ACTMON_ACTIVE_WEIGHT);
} else {
nvdec_writel(nvdec,
NVDEC_FW_MTHD_ADDR_ACTMON_ACTIVE_WEIGHT,
NVDEC_FALCON_UCLASS_METHOD_OFFSET);
nvdec_writel(nvdec, weight, NVDEC_FALCON_UCLASS_METHOD_DATA);
}
return 0;
}
@@ -552,6 +536,27 @@ static void nvdec_actmon_reg_init(struct nvdec *nvdec)
}
}
static void nvdec_count_weight_init(struct nvdec *nvdec, unsigned long rate)
{
const struct nvdec_config *config = nvdec->config;
struct host1x_client *client = &nvdec->client.base;
u32 weight;
host1x_actmon_update_client_rate(client, rate, &weight);
if (!weight)
return;
if (!config->has_riscv) {
nvdec_writel(nvdec, weight, NVDEC_TFBIF_ACTMON_ACTIVE_WEIGHT);
} else {
nvdec_writel(nvdec,
NVDEC_FW_MTHD_ADDR_ACTMON_ACTIVE_WEIGHT,
NVDEC_FALCON_UCLASS_METHOD_OFFSET);
nvdec_writel(nvdec, weight, NVDEC_FALCON_UCLASS_METHOD_DATA);
}
}
static __maybe_unused int nvdec_runtime_resume(struct device *dev)
{
struct nvdec *nvdec = dev_get_drvdata(dev);
@@ -583,6 +588,8 @@ static __maybe_unused int nvdec_runtime_resume(struct device *dev)
nvdec_actmon_reg_init(nvdec);
nvdec_count_weight_init(nvdec, nvdec->devfreq->resume_freq);
host1x_actmon_enable(&nvdec->client.base);
return 0;