From ba36333fd8a5a467a72ea10ab76b14e63eef9c35 Mon Sep 17 00:00:00 2001 From: John Anthony Date: Mon, 30 Sep 2024 17:30:04 +0200 Subject: [PATCH] pan/kmod: Add max_tasks_per_core to kmod props max_tasks_per_core is available via the THREAD_FEATURES register. Reviewed-by: Boris Brezillon Part-of: --- src/panfrost/lib/kmod/pan_kmod.h | 3 +++ src/panfrost/lib/kmod/panfrost_kmod.c | 1 + src/panfrost/lib/kmod/panthor_kmod.c | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/panfrost/lib/kmod/pan_kmod.h b/src/panfrost/lib/kmod/pan_kmod.h index 33c79cbf60d..f75b009bf12 100644 --- a/src/panfrost/lib/kmod/pan_kmod.h +++ b/src/panfrost/lib/kmod/pan_kmod.h @@ -176,6 +176,9 @@ struct pan_kmod_dev_props { /* Maximum number of threads per core. */ uint32_t max_threads_per_core; + /* Maximum number of compute tasks per core. */ + uint8_t max_tasks_per_core; + /* Maximum number of threads per workgroup. */ uint32_t max_threads_per_wg; diff --git a/src/panfrost/lib/kmod/panfrost_kmod.c b/src/panfrost/lib/kmod/panfrost_kmod.c index d6004882932..d2c91d4442b 100644 --- a/src/panfrost/lib/kmod/panfrost_kmod.c +++ b/src/panfrost/lib/kmod/panfrost_kmod.c @@ -135,6 +135,7 @@ panfrost_dev_query_thread_props(const struct pan_kmod_dev *dev, uint32_t thread_features = panfrost_query_raw(fd, DRM_PANFROST_PARAM_THREAD_FEATURES, true, 0); + props->max_tasks_per_core = MAX2(thread_features >> 24, 1); props->num_registers_per_core = thread_features & 0xffff; if (!props->num_registers_per_core) { switch (pan_arch(props->gpu_prod_id)) { diff --git a/src/panfrost/lib/kmod/panthor_kmod.c b/src/panfrost/lib/kmod/panthor_kmod.c index 776b2d781ed..6254f01030f 100644 --- a/src/panfrost/lib/kmod/panthor_kmod.c +++ b/src/panfrost/lib/kmod/panthor_kmod.c @@ -225,6 +225,7 @@ panthor_dev_query_thread_props(const struct panthor_kmod_dev *panthor_dev, { props->max_threads_per_wg = panthor_dev->props.gpu.thread_max_workgroup_size; props->max_threads_per_core = panthor_dev->props.gpu.max_threads; + props->max_tasks_per_core = panthor_dev->props.gpu.thread_features >> 24; props->num_registers_per_core = panthor_dev->props.gpu.thread_features & 0x3fffff; @@ -233,7 +234,7 @@ panthor_dev_query_thread_props(const struct panthor_kmod_dev *panthor_dev, * quirk here. */ assert(props->max_threads_per_wg && props->max_threads_per_core && - props->num_registers_per_core); + props->max_tasks_per_core && props->num_registers_per_core); /* There is no THREAD_TLS_ALLOC register on v10+, and the maximum number * of TLS instance per core is assumed to be the maximum number of threads