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>
This commit is contained in:
Mikko Perttunen
2023-02-28 11:12:18 +02:00
committed by Laxman Dewangan
parent 4207a59049
commit 41a9f72f78
5 changed files with 48 additions and 2 deletions

View File

@@ -748,6 +748,7 @@ static int host1x_get_syncpt_pools(struct host1x *host)
static int host1x_probe(struct platform_device *pdev)
{
struct resource *res;
struct host1x *host;
int err;
@@ -758,8 +759,6 @@ static int host1x_probe(struct platform_device *pdev)
host->info = of_device_get_match_data(&pdev->dev);
if (host->info->has_hypervisor) {
struct resource *res;
host->regs = devm_platform_ioremap_resource_byname(pdev, "vm");
if (IS_ERR(host->regs))
return PTR_ERR(host->regs);
@@ -782,6 +781,13 @@ static int host1x_probe(struct platform_device *pdev)
return PTR_ERR(host->regs);
}
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "actmon");
if (res) {
host->actmon_regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(host->actmon_regs))
return PTR_ERR(host->actmon_regs);
}
host->syncpt_irq = platform_get_irq(pdev, 0);
if (host->syncpt_irq < 0)
return host->syncpt_irq;