mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
Add API for reading the activity monitor average count for VIC, NVENC, and NVDEC. There is currently no support for initializing actmon, so this relies on someone else on a virtualized system having initialized it (and mapped the actmon region read-only). Bug 3973633 Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com> Change-Id: Ia1bfec6a090d4effb288b17cbac4d42bf5d0b4e5 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2864719 Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com> Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com> GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
37 lines
699 B
C
37 lines
699 B
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* Tegra host1x activity monitor interfaes
|
|
*
|
|
* Copyright (c) 2023, NVIDIA Corporation.
|
|
*/
|
|
|
|
#include "dev.h"
|
|
|
|
int host1x_actmon_read_avg_count(struct host1x_client *client)
|
|
{
|
|
struct host1x *host = dev_get_drvdata(client->host->parent);
|
|
unsigned int offset;
|
|
|
|
if (!host->actmon_regs)
|
|
return -ENODEV;
|
|
|
|
/* FIXME: Only T234 supported */
|
|
|
|
switch (client->class) {
|
|
case HOST1X_CLASS_NVENC:
|
|
offset = 0x0;
|
|
break;
|
|
case HOST1X_CLASS_VIC:
|
|
offset = 0x10000;
|
|
break;
|
|
case HOST1X_CLASS_NVDEC:
|
|
offset = 0x20000;
|
|
break;
|
|
default:
|
|
return -EINVAL;
|
|
}
|
|
|
|
return readl(host->actmon_regs + offset + 0xa4);
|
|
}
|
|
EXPORT_SYMBOL(host1x_actmon_read_avg_count);
|