Files
linux-nv-oot/drivers/gpu/host1x/actmon.c
Mikko Perttunen 41a9f72f78 gpu: host1x: Add API for reading actmon count
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>
2023-04-03 12:36:26 +00:00

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);