From 89ea39c09d9cb8c89d82346ab81e124a35c65cd5 Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Tue, 23 Jan 2024 12:22:48 +0100 Subject: [PATCH] pan/perf: Reject panthor kernel driver Make sure we reject perfcnt users when the kernel driver is not panfrost. We might decide to abstract perf counters at the kmod level at some point, but we're not there yet. Signed-off-by: Boris Brezillon Reviewed-by: Antonino Maniscalco Reviewed-by: Erik Faye-Lund Part-of: --- src/panfrost/perf/pan_perf.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/panfrost/perf/pan_perf.c b/src/panfrost/perf/pan_perf.c index d64c27ca4b9..8f703fee70a 100644 --- a/src/panfrost/perf/pan_perf.c +++ b/src/panfrost/perf/pan_perf.c @@ -72,6 +72,13 @@ panfrost_lookup_counters(const char *name) void panfrost_perf_init(struct panfrost_perf *perf, int fd) { + ASSERTED drmVersionPtr version = drmGetVersion(fd); + + /* We only support panfrost at the moment. */ + assert(version && !strcmp(version->name, "panfrost")); + + drmFreeVersion(version); + perf->dev = pan_kmod_dev_create(fd, 0, NULL); assert(perf->dev);