[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200710074143.306787-5-christian.gmeiner@gmail.com>
Date: Fri, 10 Jul 2020 09:41:27 +0200
From: Christian Gmeiner <christian.gmeiner@...il.com>
To: linux-kernel@...r.kernel.org
Cc: cphealy@...il.com, Christian Gmeiner <christian.gmeiner@...il.com>,
Lucas Stach <l.stach@...gutronix.de>,
Russell King <linux+etnaviv@...linux.org.uk>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>, etnaviv@...ts.freedesktop.org,
dri-devel@...ts.freedesktop.org
Subject: [PATCH 4/4] drm/etnaviv: export loadavg via perfmon
Make it possible to access the sub-GPU component load value from
user space with the perfmon infrastructure.
Signed-off-by: Christian Gmeiner <christian.gmeiner@...il.com>
---
drivers/gpu/drm/etnaviv/etnaviv_perfmon.c | 79 +++++++++++++++++++++++
1 file changed, 79 insertions(+)
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c b/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c
index 75f9db8f7bec..614d86e2802d 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c
@@ -98,6 +98,19 @@ static u32 hi_total_idle_cycle_read(struct etnaviv_gpu *gpu,
return gpu_read(gpu, reg);
}
+static u32 load_read(struct etnaviv_gpu *gpu,
+ const struct etnaviv_pm_domain *domain,
+ const struct etnaviv_pm_signal *signal)
+{
+ u32 load;
+
+ spin_lock_bh(&gpu->loadavg_spinlock);
+ load = gpu->loadavg_percentage[signal->data];
+ spin_unlock_bh(&gpu->loadavg_spinlock);
+
+ return load;
+}
+
static const struct etnaviv_pm_domain doms_3d[] = {
{
.name = "HI",
@@ -387,6 +400,72 @@ static const struct etnaviv_pm_domain doms_3d[] = {
&perf_reg_read
}
}
+ },
+ {
+ .name = "LOAD",
+ .nr_signals = 12,
+ .signal = (const struct etnaviv_pm_signal[]) {
+ {
+ "FE",
+ 0,
+ &load_read
+ },
+ {
+ "DE",
+ 1,
+ &load_read
+ },
+ {
+ "PE",
+ 2,
+ &load_read
+ },
+ {
+ "SH",
+ 3,
+ &load_read
+ },
+ {
+ "PA",
+ 4,
+ &load_read
+ },
+ {
+ "SE",
+ 5,
+ &load_read
+ },
+ {
+ "RA",
+ 6,
+ &load_read
+ },
+ {
+ "TX",
+ 7,
+ &load_read
+ },
+ {
+ "VG",
+ 8,
+ &load_read
+ },
+ {
+ "IM",
+ 9,
+ &load_read
+ },
+ {
+ "FP",
+ 10,
+ &load_read
+ },
+ {
+ "TS",
+ 11,
+ &load_read
+ }
+ }
}
};
--
2.26.2
Powered by blists - more mailing lists