From nobody Sat Nov 30 00:38:54 2024 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 62ABD1DA631; Fri, 13 Sep 2024 12:49:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726231774; cv=pass; b=neiGye6rzP04D49xEn3qUpNIcFyG0mv0eeVLeJ2opBMw3Tw4NbcZAiJbTugpT2E58pzn9ZgME66GifzVoMCcaXCWgVWnlRnvlNtvWgG9V5LfSDZbsQF3PyuNpiNDbvCxI0KIfeyZEUWdVg1qvpDQMN2ZKYysqwUxt9+aQ26amvg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726231774; c=relaxed/simple; bh=U1DtZzqZKE5RUP3RWTTzsnPjiJqr4hbeCcDRftonru8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JpROlPZv30Cah5/+h54pCER5O3B1zglk79iewS8qIFmCO6MokSLAmWlmHEgLPm21rvs01z0sCPmmbKqqcD26+pelqAoSwLpMz/7KZmpFUPwbhMdKVMbxfg3YPxP+35dZ+zZtWyvfsBu7DkBQgOBjt4i+Bl4QDbXE9lN0ts4ArLc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=adrian.larumbe@collabora.com header.b=Z4OUU7kV; arc=pass smtp.client-ip=136.143.188.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=collabora.com header.i=adrian.larumbe@collabora.com header.b="Z4OUU7kV" ARC-Seal: i=1; a=rsa-sha256; t=1726231755; cv=none; d=zohomail.com; s=zohoarc; b=TUrPqXJk9J0fdH9dnrCeQsdI9CO2fX3HAM+mrSlvfFYyoUWDSCFz7brFnnqPpND6Hg+nssLwwtecILqLGzjZNEoGt19Hp2eQsoLsWi88NvHBVbnd+CJb8hF520l77HiVaaNt9gK/NHhjQZ4YxD/eDicIfdTxkDUa6wXxXfwKAaQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726231755; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=Bg8cEuHY3FqFvgbNKqgL5Klp48iy29eZx78dMXXM66s=; b=XtZ+LCLtf1u37wTyGiyTeN9ysxCZZjGcTXhGu9lHec8ZRlFkiXKg7ZY4LpUH81RtqpBknpeGofYfE0iarWPbBoJo4QXggJmMhGuaqUZRSOBmLSGlHFfVy+s8ywJbCBSUlVwzsYH53k9R7hOIZhRjT/nsCp2HfIQbI1lqXGCfB+Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=adrian.larumbe@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1726231755; s=zohomail; d=collabora.com; i=adrian.larumbe@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=Bg8cEuHY3FqFvgbNKqgL5Klp48iy29eZx78dMXXM66s=; b=Z4OUU7kVbqBj1vPfRwNyltKcfN+t0DZ00hkdh/dbMFwRbveUB6WvkEuvEFaLjixk fHxDp5YlferXPdOjQMD3Hmw/kC5tQ9q80RfUTJjtP6TvHb5eVJlRV8BKltWmiaTpIbP uHGX5f2msD/8ZSaAgKz0iudgZUfl9s0cpXHrd/Fw= Received: by mx.zohomail.com with SMTPS id 1726231753254913.3190101156621; Fri, 13 Sep 2024 05:49:13 -0700 (PDT) From: =?UTF-8?q?Adri=C3=A1n=20Larumbe?= To: Boris Brezillon , Steven Price , Liviu Dudau , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Sumit Semwal , =?UTF-8?q?Christian=20K=C3=B6nig?= Cc: kernel@collabora.com, =?UTF-8?q?Adri=C3=A1n=20Larumbe?= , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org Subject: [PATCH v6 1/5] drm/panthor: introduce job cycle and timestamp accounting Date: Fri, 13 Sep 2024 13:42:09 +0100 Message-ID: <20240913124857.389630-2-adrian.larumbe@collabora.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240913124857.389630-1-adrian.larumbe@collabora.com> References: <20240913124857.389630-1-adrian.larumbe@collabora.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Enable calculations of job submission times in clock cycles and wall time. This is done by expanding the boilerplate command stream when running a job to include instructions that compute said times right before and after a user CS. A separate kernel BO is created per queue to store those values. Jobs can access their sampled data through an index different from that of the queue's ringbuffer. The reason for this is saving memory on the profiling information kernel BO, since the amount of simultaneous profiled jobs we can write into the queue's ringbuffer might be much smaller than for regular jobs, as the former take more CSF instructions. This commit is done in preparation for enabling DRM fdinfo support in the Panthor driver, which depends on the numbers calculated herein. A profile mode mask has been added that will in a future commit allow UM to toggle performance metric sampling behaviour, which is disabled by default to save power. When a ringbuffer CS is constructed, timestamp and cycling sampling instructions are added depending on the enabled flags in the profiling mask. A helper was provided that calculates the number of instructions for a given set of enablement mask, and these are passed as the number of credits when initialising a DRM scheduler job. Signed-off-by: Adri=C3=A1n Larumbe Reviewed-by: Boris Brezillon Reviewed-by: Liviu Dudau --- drivers/gpu/drm/panthor/panthor_device.h | 22 ++ drivers/gpu/drm/panthor/panthor_sched.c | 337 ++++++++++++++++++++--- 2 files changed, 315 insertions(+), 44 deletions(-) diff --git a/drivers/gpu/drm/panthor/panthor_device.h b/drivers/gpu/drm/pan= thor/panthor_device.h index e388c0472ba7..a48e30d0af30 100644 --- a/drivers/gpu/drm/panthor/panthor_device.h +++ b/drivers/gpu/drm/panthor/panthor_device.h @@ -66,6 +66,25 @@ struct panthor_irq { atomic_t suspended; }; =20 +/** + * enum panthor_device_profiling_mode - Profiling state + */ +enum panthor_device_profiling_flags { + /** @PANTHOR_DEVICE_PROFILING_DISABLED: Profiling is disabled. */ + PANTHOR_DEVICE_PROFILING_DISABLED =3D 0, + + /** @PANTHOR_DEVICE_PROFILING_CYCLES: Sampling job cycles. */ + PANTHOR_DEVICE_PROFILING_CYCLES =3D BIT(0), + + /** @PANTHOR_DEVICE_PROFILING_TIMESTAMP: Sampling job timestamp. */ + PANTHOR_DEVICE_PROFILING_TIMESTAMP =3D BIT(1), + + /** @PANTHOR_DEVICE_PROFILING_ALL: Sampling everything. */ + PANTHOR_DEVICE_PROFILING_ALL =3D + PANTHOR_DEVICE_PROFILING_CYCLES | + PANTHOR_DEVICE_PROFILING_TIMESTAMP, +}; + /** * struct panthor_device - Panthor device */ @@ -162,6 +181,9 @@ struct panthor_device { */ struct page *dummy_latest_flush; } pm; + + /** @profile_mask: User-set profiling flags for job accounting. */ + u32 profile_mask; }; =20 /** diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/pant= hor/panthor_sched.c index 42afdf0ddb7e..bcba52558f1e 100644 --- a/drivers/gpu/drm/panthor/panthor_sched.c +++ b/drivers/gpu/drm/panthor/panthor_sched.c @@ -93,6 +93,9 @@ #define MIN_CSGS 3 #define MAX_CSG_PRIO 0xf =20 +#define NUM_INSTRS_PER_CACHE_LINE (64 / sizeof(u64)) +#define MAX_INSTRS_PER_JOB 24 + struct panthor_group; =20 /** @@ -476,6 +479,18 @@ struct panthor_queue { */ struct list_head in_flight_jobs; } fence_ctx; + + /** @profiling_info: Job profiling data slots and access information. */ + struct { + /** @slots: Kernel BO holding the slots. */ + struct panthor_kernel_bo *slots; + + /** @slot_count: Number of jobs ringbuffer can hold at once. */ + u32 slot_count; + + /** @profiling_seqno: Index of the next available profiling information = slot. */ + u32 seqno; + } profiling; }; =20 /** @@ -661,6 +676,18 @@ struct panthor_group { struct list_head wait_node; }; =20 +struct panthor_job_profiling_data { + struct { + u64 before; + u64 after; + } cycles; + + struct { + u64 before; + u64 after; + } time; +}; + /** * group_queue_work() - Queue a group work * @group: Group to queue the work for. @@ -774,6 +801,15 @@ struct panthor_job { =20 /** @done_fence: Fence signaled when the job is finished or cancelled. */ struct dma_fence *done_fence; + + /** @profiling: Job profiling information. */ + struct { + /** @mask: Current device job profiling enablement bitmask. */ + u32 mask; + + /** @slot: Job index in the profiling slots BO. */ + u32 slot; + } profiling; }; =20 static void @@ -838,6 +874,7 @@ static void group_free_queue(struct panthor_group *grou= p, struct panthor_queue * =20 panthor_kernel_bo_destroy(queue->ringbuf); panthor_kernel_bo_destroy(queue->iface.mem); + panthor_kernel_bo_destroy(queue->profiling.slots); =20 /* Release the last_fence we were holding, if any. */ dma_fence_put(queue->fence_ctx.last_fence); @@ -1982,8 +2019,6 @@ tick_ctx_init(struct panthor_scheduler *sched, } } =20 -#define NUM_INSTRS_PER_SLOT 16 - static void group_term_post_processing(struct panthor_group *group) { @@ -2815,65 +2850,211 @@ static void group_sync_upd_work(struct work_struct= *work) group_put(group); } =20 -static struct dma_fence * -queue_run_job(struct drm_sched_job *sched_job) +struct panthor_job_ringbuf_instrs { + u64 buffer[MAX_INSTRS_PER_JOB]; + u32 count; +}; + +struct panthor_job_instr { + u32 profile_mask; + u64 instr; +}; + +#define JOB_INSTR(__prof, __instr) \ + { \ + .profile_mask =3D __prof, \ + .instr =3D __instr, \ + } + +static void +copy_instrs_to_ringbuf(struct panthor_queue *queue, + struct panthor_job *job, + struct panthor_job_ringbuf_instrs *instrs) +{ + ssize_t ringbuf_size =3D panthor_kernel_bo_size(queue->ringbuf); + u32 start =3D job->ringbuf.start & (ringbuf_size - 1); + ssize_t size, written; + + /* + * We need to write a whole slot, including any trailing zeroes + * that may come at the end of it. Also, because instrs.buffer has + * been zero-initialised, there's no need to pad it with 0's + */ + instrs->count =3D ALIGN(instrs->count, NUM_INSTRS_PER_CACHE_LINE); + size =3D instrs->count * sizeof(u64); + written =3D min(ringbuf_size - start, size); + + memcpy(queue->ringbuf->kmap + start, instrs->buffer, written); + + if (written < size) + memcpy(queue->ringbuf->kmap, + &instrs->buffer[(ringbuf_size - start)/sizeof(u64)], + size - written); +} + +struct panthor_job_cs_params { + u32 profile_mask; + u64 addr_reg; u64 val_reg; + u64 cycle_reg; u64 time_reg; + u64 sync_addr; u64 times_addr; + u64 cs_start; u64 cs_size; + u32 last_flush; u32 waitall_mask; +}; + +static void +get_job_cs_params(struct panthor_job *job, struct panthor_job_cs_params *p= arams) { - struct panthor_job *job =3D container_of(sched_job, struct panthor_job, b= ase); struct panthor_group *group =3D job->group; struct panthor_queue *queue =3D group->queues[job->queue_idx]; struct panthor_device *ptdev =3D group->ptdev; struct panthor_scheduler *sched =3D ptdev->scheduler; - u32 ringbuf_size =3D panthor_kernel_bo_size(queue->ringbuf); - u32 ringbuf_insert =3D queue->iface.input->insert & (ringbuf_size - 1); - u64 addr_reg =3D ptdev->csif_info.cs_reg_count - - ptdev->csif_info.unpreserved_cs_reg_count; - u64 val_reg =3D addr_reg + 2; - u64 sync_addr =3D panthor_kernel_bo_gpuva(group->syncobjs) + - job->queue_idx * sizeof(struct panthor_syncobj_64b); - u32 waitall_mask =3D GENMASK(sched->sb_slot_count - 1, 0); - struct dma_fence *done_fence; - int ret; =20 - u64 call_instrs[NUM_INSTRS_PER_SLOT] =3D { + params->addr_reg =3D ptdev->csif_info.cs_reg_count - + ptdev->csif_info.unpreserved_cs_reg_count; + params->val_reg =3D params->addr_reg + 2; + params->cycle_reg =3D params->addr_reg; + params->time_reg =3D params->val_reg; + + params->sync_addr =3D panthor_kernel_bo_gpuva(group->syncobjs) + + job->queue_idx * sizeof(struct panthor_syncobj_64b); + params->times_addr =3D panthor_kernel_bo_gpuva(queue->profiling.slots) + + (job->profiling.slot * sizeof(struct panthor_job_profiling_data)); + params->waitall_mask =3D GENMASK(sched->sb_slot_count - 1, 0); + + params->cs_start =3D job->call_info.start; + params->cs_size =3D job->call_info.size; + params->last_flush =3D job->call_info.latest_flush; + + params->profile_mask =3D job->profiling.mask; +} + +static void +prepare_job_instrs(const struct panthor_job_cs_params *params, + struct panthor_job_ringbuf_instrs *instrs) +{ + const struct panthor_job_instr instr_seq[] =3D { /* MOV32 rX+2, cs.latest_flush */ - (2ull << 56) | (val_reg << 48) | job->call_info.latest_flush, + JOB_INSTR(PANTHOR_DEVICE_PROFILING_DISABLED, + (2ull << 56) | (params->val_reg << 48) | params->last_flush), =20 /* FLUSH_CACHE2.clean_inv_all.no_wait.signal(0) rX+2 */ - (36ull << 56) | (0ull << 48) | (val_reg << 40) | (0 << 16) | 0x233, + JOB_INSTR(PANTHOR_DEVICE_PROFILING_DISABLED, + (36ull << 56) | (0ull << 48) | (params->val_reg << 40) | (0 << 16) | = 0x233), + + /* MOV48 rX:rX+1, cycles_offset */ + JOB_INSTR(PANTHOR_DEVICE_PROFILING_CYCLES, + (1ull << 56) | (params->cycle_reg << 48) | + (params->times_addr + + offsetof(struct panthor_job_profiling_data, cycles.before))), + /* STORE_STATE cycles */ + JOB_INSTR(PANTHOR_DEVICE_PROFILING_CYCLES, + (40ull << 56) | (params->cycle_reg << 40) | (1ll << 32)), + /* MOV48 rX:rX+1, time_offset */ + JOB_INSTR(PANTHOR_DEVICE_PROFILING_TIMESTAMP, + (1ull << 56) | (params->time_reg << 48) | + (params->times_addr + + offsetof(struct panthor_job_profiling_data, time.before))), + /* STORE_STATE timer */ + JOB_INSTR(PANTHOR_DEVICE_PROFILING_TIMESTAMP, + (40ull << 56) | (params->time_reg << 40) | (0ll << 32)), =20 /* MOV48 rX:rX+1, cs.start */ - (1ull << 56) | (addr_reg << 48) | job->call_info.start, - + JOB_INSTR(PANTHOR_DEVICE_PROFILING_DISABLED, + (1ull << 56) | (params->addr_reg << 48) | params->cs_start), /* MOV32 rX+2, cs.size */ - (2ull << 56) | (val_reg << 48) | job->call_info.size, - + JOB_INSTR(PANTHOR_DEVICE_PROFILING_DISABLED, + (2ull << 56) | (params->val_reg << 48) | params->cs_size), /* WAIT(0) =3D> waits for FLUSH_CACHE2 instruction */ - (3ull << 56) | (1 << 16), - + JOB_INSTR(PANTHOR_DEVICE_PROFILING_DISABLED, (3ull << 56) | (1 << 16)), /* CALL rX:rX+1, rX+2 */ - (32ull << 56) | (addr_reg << 40) | (val_reg << 32), + JOB_INSTR(PANTHOR_DEVICE_PROFILING_DISABLED, + (32ull << 56) | (params->addr_reg << 40) | (params->val_reg << 32)), + + /* MOV48 rX:rX+1, cycles_offset */ + JOB_INSTR(PANTHOR_DEVICE_PROFILING_CYCLES, + (1ull << 56) | (params->cycle_reg << 48) | + (params->times_addr + + offsetof(struct panthor_job_profiling_data, cycles.after))), + /* STORE_STATE cycles */ + JOB_INSTR(PANTHOR_DEVICE_PROFILING_CYCLES, + (40ull << 56) | (params->cycle_reg << 40) | (1ll << 32)), + + /* MOV48 rX:rX+1, time_offset */ + JOB_INSTR(PANTHOR_DEVICE_PROFILING_TIMESTAMP, + (1ull << 56) | (params->time_reg << 48) | + (params->times_addr + + offsetof(struct panthor_job_profiling_data, time.after))), + /* STORE_STATE timer */ + JOB_INSTR(PANTHOR_DEVICE_PROFILING_TIMESTAMP, + (40ull << 56) | (params->time_reg << 40) | (0ll << 32)), =20 /* MOV48 rX:rX+1, sync_addr */ - (1ull << 56) | (addr_reg << 48) | sync_addr, - + JOB_INSTR(PANTHOR_DEVICE_PROFILING_DISABLED, + (1ull << 56) | (params->addr_reg << 48) | params->sync_addr), /* MOV48 rX+2, #1 */ - (1ull << 56) | (val_reg << 48) | 1, - + JOB_INSTR(PANTHOR_DEVICE_PROFILING_DISABLED, + (1ull << 56) | (params->val_reg << 48) | 1), /* WAIT(all) */ - (3ull << 56) | (waitall_mask << 16), - + JOB_INSTR(PANTHOR_DEVICE_PROFILING_DISABLED, + (3ull << 56) | (params->waitall_mask << 16)), /* SYNC_ADD64.system_scope.propage_err.nowait rX:rX+1, rX+2*/ - (51ull << 56) | (0ull << 48) | (addr_reg << 40) | (val_reg << 32) | (0 <= < 16) | 1, - + JOB_INSTR(PANTHOR_DEVICE_PROFILING_DISABLED, + (51ull << 56) | (0ull << 48) | (params->addr_reg << 40) | + (params->val_reg << 32) | (0 << 16) | 1), /* ERROR_BARRIER, so we can recover from faults at job * boundaries. */ - (47ull << 56), + JOB_INSTR(PANTHOR_DEVICE_PROFILING_DISABLED, (47ull << 56)), + }; + u32 pad; + + /* NEED to be cacheline aligned to please the prefetcher. */ + static_assert(sizeof(instrs->buffer) % 64 =3D=3D 0, + "panthor_job_ringbuf_instrs::buffer is not aligned on a cacheline"= ); + + /* Make sure we have enough storage to store the whole sequence. */ + static_assert(ALIGN(ARRAY_SIZE(instr_seq), NUM_INSTRS_PER_CACHE_LINE) =3D= =3D + ARRAY_SIZE(instrs->buffer), + "instr_seq vs panthor_job_ringbuf_instrs::buffer size mismatch"); + + for (u32 i =3D 0; i < ARRAY_SIZE(instr_seq); i++) { + /* If the profile mask of this instruction is not enabled, skip it. */ + if (instr_seq[i].profile_mask && + !(instr_seq[i].profile_mask & params->profile_mask)) + continue; + + instrs->buffer[instrs->count++] =3D instr_seq[i].instr; + } + + pad =3D ALIGN(instrs->count, NUM_INSTRS_PER_CACHE_LINE); + memset(&instrs->buffer[instrs->count], 0, + (pad - instrs->count) * sizeof(instrs->buffer[0])); + instrs->count =3D pad; +} + +static u32 calc_job_credits(u32 profile_mask) +{ + struct panthor_job_ringbuf_instrs instrs; + struct panthor_job_cs_params params =3D { + .profile_mask =3D profile_mask, }; =20 - /* Need to be cacheline aligned to please the prefetcher. */ - static_assert(sizeof(call_instrs) % 64 =3D=3D 0, - "call_instrs is not aligned on a cacheline"); + prepare_job_instrs(¶ms, &instrs); + return instrs.count; +} + +static struct dma_fence * +queue_run_job(struct drm_sched_job *sched_job) +{ + struct panthor_job *job =3D container_of(sched_job, struct panthor_job, b= ase); + struct panthor_group *group =3D job->group; + struct panthor_queue *queue =3D group->queues[job->queue_idx]; + struct panthor_device *ptdev =3D group->ptdev; + struct panthor_scheduler *sched =3D ptdev->scheduler; + struct panthor_job_ringbuf_instrs instrs; + struct panthor_job_cs_params cs_params; + struct dma_fence *done_fence; + int ret; =20 /* Stream size is zero, nothing to do except making sure all previously * submitted jobs are done before we signal the @@ -2900,17 +3081,23 @@ queue_run_job(struct drm_sched_job *sched_job) queue->fence_ctx.id, atomic64_inc_return(&queue->fence_ctx.seqno)); =20 - memcpy(queue->ringbuf->kmap + ringbuf_insert, - call_instrs, sizeof(call_instrs)); + job->profiling.slot =3D queue->profiling.seqno++; + if (queue->profiling.seqno =3D=3D queue->profiling.slot_count) + queue->profiling.seqno =3D 0; + + job->ringbuf.start =3D queue->iface.input->insert; + + get_job_cs_params(job, &cs_params); + prepare_job_instrs(&cs_params, &instrs); + copy_instrs_to_ringbuf(queue, job, &instrs); + + job->ringbuf.end =3D job->ringbuf.start + (instrs.count * sizeof(u64)); =20 panthor_job_get(&job->base); spin_lock(&queue->fence_ctx.lock); list_add_tail(&job->node, &queue->fence_ctx.in_flight_jobs); spin_unlock(&queue->fence_ctx.lock); =20 - job->ringbuf.start =3D queue->iface.input->insert; - job->ringbuf.end =3D job->ringbuf.start + sizeof(call_instrs); - /* Make sure the ring buffer is updated before the INSERT * register. */ @@ -3003,6 +3190,34 @@ static const struct drm_sched_backend_ops panthor_qu= eue_sched_ops =3D { .free_job =3D queue_free_job, }; =20 +static u32 calc_profiling_ringbuf_num_slots(struct panthor_device *ptdev, + u32 cs_ringbuf_size) +{ + u32 min_profiled_job_instrs =3D U32_MAX; + u32 last_flag =3D fls(PANTHOR_DEVICE_PROFILING_ALL); + + /* + * We want to calculate the minimum size of a profiled job's CS, + * because since they need additional instructions for the sampling + * of performance metrics, they might take up further slots in + * the queue's ringbuffer. This means we might not need as many job + * slots for keeping track of their profiling information. What we + * need is the maximum number of slots we should allocate to this end, + * which matches the maximum number of profiled jobs we can place + * simultaneously in the queue's ring buffer. + * That has to be calculated separately for every single job profiling + * flag, but not in the case job profiling is disabled, since unprofiled + * jobs don't need to keep track of this at all. + */ + for (u32 i =3D 0; i < last_flag; i++) { + if (BIT(i) & PANTHOR_DEVICE_PROFILING_ALL) + min_profiled_job_instrs =3D + min(min_profiled_job_instrs, calc_job_credits(BIT(i))); + } + + return DIV_ROUND_UP(cs_ringbuf_size, min_profiled_job_instrs * sizeof(u64= )); +} + static struct panthor_queue * group_create_queue(struct panthor_group *group, const struct drm_panthor_queue_create *args) @@ -3056,9 +3271,35 @@ group_create_queue(struct panthor_group *group, goto err_free_queue; } =20 + queue->profiling.slot_count =3D + calc_profiling_ringbuf_num_slots(group->ptdev, args->ringbuf_size); + + queue->profiling.slots =3D + panthor_kernel_bo_create(group->ptdev, group->vm, + queue->profiling.slot_count * + sizeof(struct panthor_job_profiling_data), + DRM_PANTHOR_BO_NO_MMAP, + DRM_PANTHOR_VM_BIND_OP_MAP_NOEXEC | + DRM_PANTHOR_VM_BIND_OP_MAP_UNCACHED, + PANTHOR_VM_KERNEL_AUTO_VA); + + if (IS_ERR(queue->profiling.slots)) { + ret =3D PTR_ERR(queue->profiling.slots); + goto err_free_queue; + } + + ret =3D panthor_kernel_bo_vmap(queue->profiling.slots); + if (ret) + goto err_free_queue; + + /* + * Credit limit argument tells us the total number of instructions + * across all CS slots in the ringbuffer, with some jobs requiring + * twice as many as others, depending on their profiling status. + */ ret =3D drm_sched_init(&queue->scheduler, &panthor_queue_sched_ops, group->ptdev->scheduler->wq, 1, - args->ringbuf_size / (NUM_INSTRS_PER_SLOT * sizeof(u64)), + args->ringbuf_size / sizeof(u64), 0, msecs_to_jiffies(JOB_TIMEOUT_MS), group->ptdev->reset.wq, NULL, "panthor-queue", group->ptdev->base.dev); @@ -3354,6 +3595,7 @@ panthor_job_create(struct panthor_file *pfile, { struct panthor_group_pool *gpool =3D pfile->groups; struct panthor_job *job; + u32 credits; int ret; =20 if (qsubmit->pad) @@ -3407,9 +3649,16 @@ panthor_job_create(struct panthor_file *pfile, } } =20 + job->profiling.mask =3D pfile->ptdev->profile_mask; + credits =3D calc_job_credits(job->profiling.mask); + if (credits =3D=3D 0) { + ret =3D -EINVAL; + goto err_put_job; + } + ret =3D drm_sched_job_init(&job->base, &job->group->queues[job->queue_idx]->entity, - 1, job->group); + credits, job->group); if (ret) goto err_put_job; =20 --=20 2.46.0 From nobody Sat Nov 30 00:38:54 2024 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A8CEF1DA2F5; Fri, 13 Sep 2024 12:49:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726231775; cv=pass; b=nGrXUHRjjgLq2po9P5CUJF8B/YJrW6CN3WWLl+805gsm57ytPWKRo95RzA9N5hS8KFhvmVKELb16IqnA38/KzwR2we2sX0sMGz3S0XSu+/d62kiI5eT5IeKlX+ArLgt/IiBWhY7BOUkBPFGoPE6BIrK5uKLCqev/SSguwdWXIkM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726231775; c=relaxed/simple; bh=j9fxkIckaZRFjZBTdCAB2ad0eiY6EGtMfgHWpTnR1gw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=XiHz96PhW1NOYjS4rFTtkGLHQRl73gXjtFUanBgeCKSWMiKechYZH0Jzl1QgcwuXz2RqisKiUNT4GmABMll7WLG/kdM0YL/9pVprORHfw2a91XRr+n2+AKbK5LoaclwPins8cYFY2HmLsaj0Egh0c+iBeEyBqWL/fPDrrHUAdRU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=adrian.larumbe@collabora.com header.b=RVtsq11r; arc=pass smtp.client-ip=136.143.188.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=collabora.com header.i=adrian.larumbe@collabora.com header.b="RVtsq11r" ARC-Seal: i=1; a=rsa-sha256; t=1726231757; cv=none; d=zohomail.com; s=zohoarc; b=eRmUTlczT4Ojz0yLmORGlctuuhknFZc9oFV7cb3pjIH6snTZFemK1ZWdWKUDII4tKXPEr1qfvxrb8WOKl1ikaKXNXvkx2dyhRMFz/MgNByELtd3MncutYZbilftF+tk2b+TaXDV3iyNaAQaTKPCeiMsIzFSaAwDqTzphNXfdRWY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726231757; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=tOmkiNeVoubNbMOpF1oIX3mV4RjrwsW567k6frbbaH0=; b=jYtRyEFLCnGB7yHKVDyteYV5PW4Mj9nOhOJv0ckONctxuSbOR63rSt7y/g3UIMw/SNwTX210L23/UJJfEXqUPddmmCu8rASHSUrP8ktLKAbFvpY7zPWiEtuv/VVwpLQBn3nnD01W5hkvWNxdGIiw0b1cKD2aFXskYecNSXxytnc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=adrian.larumbe@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1726231757; s=zohomail; d=collabora.com; i=adrian.larumbe@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=tOmkiNeVoubNbMOpF1oIX3mV4RjrwsW567k6frbbaH0=; b=RVtsq11rrXBBASWwxE6s7NyEnLttF2Qia1wJqeYybL8M9LkJt7ZiWRMYsgTBtwfS 4U/IGhQbJE01/psB2BUeI8q/LWoGm0w/OUtYcvwzkUH42D1OaMl+/PTGEdxGn301PLu pYSrugdtylsBRU8LsGYdjChmY8fOP9/e2q+3oC64= Received: by mx.zohomail.com with SMTPS id 1726231756259603.0430132743846; Fri, 13 Sep 2024 05:49:16 -0700 (PDT) From: =?UTF-8?q?Adri=C3=A1n=20Larumbe?= To: Boris Brezillon , Steven Price , Liviu Dudau , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Sumit Semwal , =?UTF-8?q?Christian=20K=C3=B6nig?= Cc: kernel@collabora.com, =?UTF-8?q?Adri=C3=A1n=20Larumbe?= , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org Subject: [PATCH v6 2/5] drm/panthor: record current and maximum device clock frequencies Date: Fri, 13 Sep 2024 13:42:10 +0100 Message-ID: <20240913124857.389630-3-adrian.larumbe@collabora.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240913124857.389630-1-adrian.larumbe@collabora.com> References: <20240913124857.389630-1-adrian.larumbe@collabora.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable In order to support UM in calculating rates of GPU utilisation, the current operating and maximum GPU clock frequencies must be recorded during device initialisation, and also during OPP state transitions. Signed-off-by: Adri=C3=A1n Larumbe Reviewed-by: Boris Brezillon Reviewed-by: Steven Price --- drivers/gpu/drm/panthor/panthor_devfreq.c | 18 +++++++++++++++++- drivers/gpu/drm/panthor/panthor_device.h | 6 ++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panthor/panthor_devfreq.c b/drivers/gpu/drm/pa= nthor/panthor_devfreq.c index c6d3c327cc24..9d0f891b9b53 100644 --- a/drivers/gpu/drm/panthor/panthor_devfreq.c +++ b/drivers/gpu/drm/panthor/panthor_devfreq.c @@ -62,14 +62,20 @@ static void panthor_devfreq_update_utilization(struct p= anthor_devfreq *pdevfreq) static int panthor_devfreq_target(struct device *dev, unsigned long *freq, u32 flags) { + struct panthor_device *ptdev =3D dev_get_drvdata(dev); struct dev_pm_opp *opp; + int err; =20 opp =3D devfreq_recommended_opp(dev, freq, flags); if (IS_ERR(opp)) return PTR_ERR(opp); dev_pm_opp_put(opp); =20 - return dev_pm_opp_set_rate(dev, *freq); + err =3D dev_pm_opp_set_rate(dev, *freq); + if (!err) + ptdev->current_frequency =3D *freq; + + return err; } =20 static void panthor_devfreq_reset(struct panthor_devfreq *pdevfreq) @@ -130,6 +136,7 @@ int panthor_devfreq_init(struct panthor_device *ptdev) struct panthor_devfreq *pdevfreq; struct dev_pm_opp *opp; unsigned long cur_freq; + unsigned long freq =3D ULONG_MAX; int ret; =20 pdevfreq =3D drmm_kzalloc(&ptdev->base, sizeof(*ptdev->devfreq), GFP_KERN= EL); @@ -161,6 +168,7 @@ int panthor_devfreq_init(struct panthor_device *ptdev) return PTR_ERR(opp); =20 panthor_devfreq_profile.initial_freq =3D cur_freq; + ptdev->current_frequency =3D cur_freq; =20 /* Regulator coupling only takes care of synchronizing/balancing voltage * updates, but the coupled regulator needs to be enabled manually. @@ -204,6 +212,14 @@ int panthor_devfreq_init(struct panthor_device *ptdev) =20 dev_pm_opp_put(opp); =20 + /* Find the fastest defined rate */ + opp =3D dev_pm_opp_find_freq_floor(dev, &freq); + if (IS_ERR(opp)) + return PTR_ERR(opp); + ptdev->fast_rate =3D freq; + + dev_pm_opp_put(opp); + /* * Setup default thresholds for the simple_ondemand governor. * The values are chosen based on experiments. diff --git a/drivers/gpu/drm/panthor/panthor_device.h b/drivers/gpu/drm/pan= thor/panthor_device.h index a48e30d0af30..2109905813e8 100644 --- a/drivers/gpu/drm/panthor/panthor_device.h +++ b/drivers/gpu/drm/panthor/panthor_device.h @@ -184,6 +184,12 @@ struct panthor_device { =20 /** @profile_mask: User-set profiling flags for job accounting. */ u32 profile_mask; + + /** @current_frequency: Device clock frequency at present. Set by DVFS*/ + unsigned long current_frequency; + + /** @fast_rate: Maximum device clock frequency. Set by DVFS */ + unsigned long fast_rate; }; =20 /** --=20 2.46.0 From nobody Sat Nov 30 00:38:54 2024 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 78B071DB54C; Fri, 13 Sep 2024 12:49:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726231779; cv=pass; b=FmxYvBgt/RtZpYIm9UdTBqYFwhfzQ92wuXty/HePx2XWHJDvEGSJfUDVm7LXpEwJX7vxBx0D7+FljMxSYFIcFuS0V8jly/Nul2+/t92VQ4RYIbpbzJvBut2Vk9Z8Cmea2oe7kZz1bHRKOS9ZB6FLuKjLDEcD2Yj0VeBI9tIpBgI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726231779; c=relaxed/simple; bh=JdrVn6yA7tFS+Rzkp34M+WnMVYy13uJnwi539CgN3N4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=IrFxBLEPaOhCJ8vrLavRjQirOQUuwO7bwkrMAirmQ155KKs6l/cEGvS3enRLxk+3SlBgOW3E64820efMofn6Yio9w5xnQwH6V/JfQxKYfft8ItCRCQ7W/vc1v+qfLgvCKnF0xMjIJh5Dp8pUrYkfn4kNyaeAwdEuUdloFXKDL98= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=adrian.larumbe@collabora.com header.b=ZDel0Ip6; arc=pass smtp.client-ip=136.143.188.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=collabora.com header.i=adrian.larumbe@collabora.com header.b="ZDel0Ip6" ARC-Seal: i=1; a=rsa-sha256; t=1726231761; cv=none; d=zohomail.com; s=zohoarc; b=Hkut/kQ4RMrItpjx5NBhkUbMjLTaQGv5GoGjr+FE+O5vNaMBE1SKe/nmLltmftRE5WqgHBHOTZSb7eS2T52piQcRa0ZMVy2M0pz5HLcPe/nxqNI+HYA39PiYwE9BiaHWqV4TPvmz5t9/O/iC1z1mICuHWofR8hekGn1hzFR80po= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726231761; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=yOac6qUxMbWR/YO0jAVVZTBjc9gLRvQRzzXmrU4q+QI=; b=ZOqD5qxgtLW+169mkdDsiZlVC4ROn+LC3q9QeWtEjnZZa9jAV6Siqic6xgxuYW75j+WfTcT25hUyQUBfcoDr/gxXe8oQKair8lisL0YoP7xhno9REacGJ6VwGqYJUkPPxce3jbaoEB+UxZVl8d/FtQ+Kxg9GmCoXC2tVALyDBC4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=adrian.larumbe@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1726231761; s=zohomail; d=collabora.com; i=adrian.larumbe@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=yOac6qUxMbWR/YO0jAVVZTBjc9gLRvQRzzXmrU4q+QI=; b=ZDel0Ip6HXI2VuCQC/51kXP5yWczq2q5ke4vLawqh7B9QL1Dp+E7JMqUbYxoJIy1 dUwsbsVFADMKl8AmCOa7yJVqv3+tAo+0mQVHz+CxQaJdcMqvYuGRiiDn6FX4wEgVeWC jTZhrPO6T13jPFnyKyOGvbL2wellQ+oXzpZTtUyA= Received: by mx.zohomail.com with SMTPS id 1726231759222815.3323371020737; Fri, 13 Sep 2024 05:49:19 -0700 (PDT) From: =?UTF-8?q?Adri=C3=A1n=20Larumbe?= To: Boris Brezillon , Steven Price , Liviu Dudau , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Sumit Semwal , =?UTF-8?q?Christian=20K=C3=B6nig?= Cc: kernel@collabora.com, =?UTF-8?q?Adri=C3=A1n=20Larumbe?= , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org Subject: [PATCH v6 3/5] drm/panthor: add DRM fdinfo support Date: Fri, 13 Sep 2024 13:42:11 +0100 Message-ID: <20240913124857.389630-4-adrian.larumbe@collabora.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240913124857.389630-1-adrian.larumbe@collabora.com> References: <20240913124857.389630-1-adrian.larumbe@collabora.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Drawing from the FW-calculated values in a previous commit, we can increase the numbers for an open file by collecting them from finished jobs when updating their group synchronisation objects. Display of fdinfo key-value pairs is governed by a bitmask that is by default unset in the present commit, and supporting manual toggle of it will be the matter of a later commit. Signed-off-by: Adri=C3=A1n Larumbe Reviewed-by: Steven Price Reviewed-by: Boris Brezillon --- drivers/gpu/drm/panthor/panthor_device.h | 8 ++++ drivers/gpu/drm/panthor/panthor_drv.c | 34 ++++++++++++++ drivers/gpu/drm/panthor/panthor_sched.c | 56 ++++++++++++++++++++++++ drivers/gpu/drm/panthor/panthor_sched.h | 2 + 4 files changed, 100 insertions(+) diff --git a/drivers/gpu/drm/panthor/panthor_device.h b/drivers/gpu/drm/pan= thor/panthor_device.h index 2109905813e8..0e68f5a70d20 100644 --- a/drivers/gpu/drm/panthor/panthor_device.h +++ b/drivers/gpu/drm/panthor/panthor_device.h @@ -192,6 +192,11 @@ struct panthor_device { unsigned long fast_rate; }; =20 +struct panthor_gpu_usage { + u64 time; + u64 cycles; +}; + /** * struct panthor_file - Panthor file */ @@ -204,6 +209,9 @@ struct panthor_file { =20 /** @groups: Scheduling group pool attached to this file. */ struct panthor_group_pool *groups; + + /** @stats: cycle and timestamp measures for job execution. */ + struct panthor_gpu_usage stats; }; =20 int panthor_device_init(struct panthor_device *ptdev); diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/pantho= r/panthor_drv.c index 0caf9e9a8c45..233b265c0819 100644 --- a/drivers/gpu/drm/panthor/panthor_drv.c +++ b/drivers/gpu/drm/panthor/panthor_drv.c @@ -13,6 +13,7 @@ #include #include #include +#include =20 #include #include @@ -1414,6 +1415,37 @@ static int panthor_mmap(struct file *filp, struct vm= _area_struct *vma) return ret; } =20 +static void panthor_gpu_show_fdinfo(struct panthor_device *ptdev, + struct panthor_file *pfile, + struct drm_printer *p) +{ + if (ptdev->profile_mask & PANTHOR_DEVICE_PROFILING_ALL) + panthor_fdinfo_gather_group_samples(pfile); + + if (ptdev->profile_mask & PANTHOR_DEVICE_PROFILING_TIMESTAMP) { +#ifdef CONFIG_ARM_ARCH_TIMER + drm_printf(p, "drm-engine-panthor:\t%llu ns\n", + DIV_ROUND_UP_ULL((pfile->stats.time * NSEC_PER_SEC), + arch_timer_get_cntfrq())); +#endif + } + if (ptdev->profile_mask & PANTHOR_DEVICE_PROFILING_CYCLES) + drm_printf(p, "drm-cycles-panthor:\t%llu\n", pfile->stats.cycles); + + drm_printf(p, "drm-maxfreq-panthor:\t%lu Hz\n", ptdev->fast_rate); + drm_printf(p, "drm-curfreq-panthor:\t%lu Hz\n", ptdev->current_frequency); +} + +static void panthor_show_fdinfo(struct drm_printer *p, struct drm_file *fi= le) +{ + struct drm_device *dev =3D file->minor->dev; + struct panthor_device *ptdev =3D container_of(dev, struct panthor_device,= base); + + panthor_gpu_show_fdinfo(ptdev, file->driver_priv, p); + + drm_show_memory_stats(p, file); +} + static const struct file_operations panthor_drm_driver_fops =3D { .open =3D drm_open, .release =3D drm_release, @@ -1423,6 +1455,7 @@ static const struct file_operations panthor_drm_drive= r_fops =3D { .read =3D drm_read, .llseek =3D noop_llseek, .mmap =3D panthor_mmap, + .show_fdinfo =3D drm_show_fdinfo, }; =20 #ifdef CONFIG_DEBUG_FS @@ -1442,6 +1475,7 @@ static const struct drm_driver panthor_drm_driver =3D= { DRIVER_SYNCOBJ_TIMELINE | DRIVER_GEM_GPUVA, .open =3D panthor_open, .postclose =3D panthor_postclose, + .show_fdinfo =3D panthor_show_fdinfo, .ioctls =3D panthor_drm_driver_ioctls, .num_ioctls =3D ARRAY_SIZE(panthor_drm_driver_ioctls), .fops =3D &panthor_drm_driver_fops, diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/pant= hor/panthor_sched.c index bcba52558f1e..d822bf9b59fa 100644 --- a/drivers/gpu/drm/panthor/panthor_sched.c +++ b/drivers/gpu/drm/panthor/panthor_sched.c @@ -619,6 +619,18 @@ struct panthor_group { */ struct panthor_kernel_bo *syncobjs; =20 + /** @fdinfo: Per-file total cycle and timestamp values reference. */ + struct { + /** @data: Total sampled values for jobs in queues from this group. */ + struct panthor_gpu_usage data; + + /** + * @lock: Mutex to govern concurrent access from drm file's fdinfo callb= ack + * and job post-completion processing function + */ + struct mutex lock; + } fdinfo; + /** @state: Group state. */ enum panthor_group_state state; =20 @@ -889,6 +901,8 @@ static void group_release_work(struct work_struct *work) release_work); u32 i; =20 + mutex_destroy(&group->fdinfo.lock); + for (i =3D 0; i < group->queue_count; i++) group_free_queue(group, group->queues[i]); =20 @@ -2811,6 +2825,44 @@ void panthor_sched_post_reset(struct panthor_device = *ptdev, bool reset_failed) } } =20 +static void update_fdinfo_stats(struct panthor_job *job) +{ + struct panthor_group *group =3D job->group; + struct panthor_queue *queue =3D group->queues[job->queue_idx]; + struct panthor_gpu_usage *fdinfo =3D &group->fdinfo.data; + struct panthor_job_profiling_data *times; + + times =3D (struct panthor_job_profiling_data *) + ((unsigned long) queue->profiling.slots->kmap + + (job->profiling.slot * sizeof(struct panthor_job_profiling_data))); + + mutex_lock(&group->fdinfo.lock); + if (job->profiling.mask & PANTHOR_DEVICE_PROFILING_CYCLES) + fdinfo->cycles +=3D times->cycles.after - times->cycles.before; + if (job->profiling.mask & PANTHOR_DEVICE_PROFILING_TIMESTAMP) + fdinfo->time +=3D times->time.after - times->time.before; + mutex_unlock(&group->fdinfo.lock); +} + +void panthor_fdinfo_gather_group_samples(struct panthor_file *pfile) +{ + struct panthor_group_pool *gpool =3D pfile->groups; + struct panthor_group *group; + unsigned long i; + + if (IS_ERR_OR_NULL(gpool)) + return; + + xa_for_each(&gpool->xa, i, group) { + mutex_lock(&group->fdinfo.lock); + pfile->stats.cycles +=3D group->fdinfo.data.cycles; + pfile->stats.time +=3D group->fdinfo.data.time; + group->fdinfo.data.cycles =3D 0; + group->fdinfo.data.time =3D 0; + mutex_unlock(&group->fdinfo.lock); + } +} + static void group_sync_upd_work(struct work_struct *work) { struct panthor_group *group =3D @@ -2843,6 +2895,8 @@ static void group_sync_upd_work(struct work_struct *w= ork) dma_fence_end_signalling(cookie); =20 list_for_each_entry_safe(job, job_tmp, &done_jobs, node) { + if (job->profiling.mask) + update_fdinfo_stats(job); list_del_init(&job->node); panthor_job_put(&job->base); } @@ -3440,6 +3494,8 @@ int panthor_group_create(struct panthor_file *pfile, } mutex_unlock(&sched->reset.lock); =20 + mutex_init(&group->fdinfo.lock); + return gid; =20 err_put_group: diff --git a/drivers/gpu/drm/panthor/panthor_sched.h b/drivers/gpu/drm/pant= hor/panthor_sched.h index 3a30d2328b30..5ae6b4bde7c5 100644 --- a/drivers/gpu/drm/panthor/panthor_sched.h +++ b/drivers/gpu/drm/panthor/panthor_sched.h @@ -47,4 +47,6 @@ void panthor_sched_resume(struct panthor_device *ptdev); void panthor_sched_report_mmu_fault(struct panthor_device *ptdev); void panthor_sched_report_fw_events(struct panthor_device *ptdev, u32 even= ts); =20 +void panthor_fdinfo_gather_group_samples(struct panthor_file *pfile); + #endif --=20 2.46.0 From nobody Sat Nov 30 00:38:54 2024 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D7A511DB95B; Fri, 13 Sep 2024 12:49:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726231785; cv=pass; b=l24tbfnf8RZICt83/oNgSk+oD7uLf8E34rluNhAoaBDwqWUrxQqE7kfdvicMQMiXsrvZScmNSYCXZMByFYqEGvSOL2IJ3jI3DrUaucOVIAeIyfn7CWrWTNFVB9daR5XiiotM1rahn9WDQ7ZNYrYU9256YN4OKzaFKrzOSKITOr4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726231785; c=relaxed/simple; bh=tIFpVNDyc21xlXr9AysvdU3FO0rHAQ10Nyj/l2kixHQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=NmMAiChpQSCKwOq3nnOWPcMAiTUELMZcYalhCYFjF4VeWuAFKveb/3DpcIbC5G2+PIbsRCDS5OZnyWj9TuFQ7r0ENWoStwJav33IoeIPePLDWx7JoXYE19isw6fZM6MuaDuZE2XyFhVH6ZjH3MOK2HoyKrmTfL8XBFsHxX1ek5U= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=adrian.larumbe@collabora.com header.b=SISPdPx5; arc=pass smtp.client-ip=136.143.188.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=collabora.com header.i=adrian.larumbe@collabora.com header.b="SISPdPx5" ARC-Seal: i=1; a=rsa-sha256; t=1726231763; cv=none; d=zohomail.com; s=zohoarc; b=MFRy6oPt60THSxZqoXkpgQIt0kzTke7b3KapYqJcJ7Rt+Hkmi/nfNfdqeA5fcp2YOPXA8FAoC3kEvSBcz4VYXqzq1x7yY68TVe/uxSUOcR0CDbK9ijuPEOiZqnTMpxcgliJOuShMP300IaB9yjfR7+/Y57hQ5htcVaEyj2BSXfM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726231763; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=h+CEnwN7RG4Q8rPu3tiFv71mEVaf/Ddp1giVyFfwYDU=; b=RaMj6IphDftaehrPqU6HarBI62+NOfC8iyxujnCA92W4dmMq+wIsDdA84Z6p7NbrAiinZzRUMM8SLoYMnSrd6/ZY/PgI43Hx2peykxiB9O6EWsssqQ0MXtQfo6E/1UxwTB2UWyEuyVW4SoSTp+4D0uqVZiOp2+IdM/xqpVPNkaE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=adrian.larumbe@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1726231763; s=zohomail; d=collabora.com; i=adrian.larumbe@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=h+CEnwN7RG4Q8rPu3tiFv71mEVaf/Ddp1giVyFfwYDU=; b=SISPdPx5iWHJHCWGyRBsHODTQCDKS25EsBynY8d+eQ9RuzQ/J/rlOLyqX9vgJP/s h+pHNXOrBSN41LHH0VY7NanIiO2MLBorhRKUXEmw1oRhWAycbD/U8cQtJB+CKLX2+PT DUlupkYX4RX0r/L5UavtQOlS2nonfGrA1uThd8yU= Received: by mx.zohomail.com with SMTPS id 17262317623101004.3058460531499; Fri, 13 Sep 2024 05:49:22 -0700 (PDT) From: =?UTF-8?q?Adri=C3=A1n=20Larumbe?= To: Boris Brezillon , Steven Price , Liviu Dudau , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Sumit Semwal , =?UTF-8?q?Christian=20K=C3=B6nig?= Cc: kernel@collabora.com, =?UTF-8?q?Adri=C3=A1n=20Larumbe?= , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org Subject: [PATCH v6 4/5] drm/panthor: enable fdinfo for memory stats Date: Fri, 13 Sep 2024 13:42:12 +0100 Message-ID: <20240913124857.389630-5-adrian.larumbe@collabora.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240913124857.389630-1-adrian.larumbe@collabora.com> References: <20240913124857.389630-1-adrian.larumbe@collabora.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Implement drm object's status callback. Also, we consider a PRIME imported BO to be resident if its matching dma_buf has an open attachment, which means its backing storage had already been allocated. Signed-off-by: Adri=C3=A1n Larumbe Reviewed-by: Steven Price Reviewed-by: Liviu Dudau Reviewed-by: Boris Brezillon --- drivers/gpu/drm/panthor/panthor_gem.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/drm/panthor/panthor_gem.c b/drivers/gpu/drm/pantho= r/panthor_gem.c index 38f560864879..c60b599665d8 100644 --- a/drivers/gpu/drm/panthor/panthor_gem.c +++ b/drivers/gpu/drm/panthor/panthor_gem.c @@ -145,6 +145,17 @@ panthor_gem_prime_export(struct drm_gem_object *obj, i= nt flags) return drm_gem_prime_export(obj, flags); } =20 +static enum drm_gem_object_status panthor_gem_status(struct drm_gem_object= *obj) +{ + struct panthor_gem_object *bo =3D to_panthor_bo(obj); + enum drm_gem_object_status res =3D 0; + + if (bo->base.base.import_attach || bo->base.pages) + res |=3D DRM_GEM_OBJECT_RESIDENT; + + return res; +} + static const struct drm_gem_object_funcs panthor_gem_funcs =3D { .free =3D panthor_gem_free_object, .print_info =3D drm_gem_shmem_object_print_info, @@ -154,6 +165,7 @@ static const struct drm_gem_object_funcs panthor_gem_fu= ncs =3D { .vmap =3D drm_gem_shmem_object_vmap, .vunmap =3D drm_gem_shmem_object_vunmap, .mmap =3D panthor_gem_mmap, + .status =3D panthor_gem_status, .export =3D panthor_gem_prime_export, .vm_ops =3D &drm_gem_shmem_vm_ops, }; --=20 2.46.0 From nobody Sat Nov 30 00:38:54 2024 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 101431DA619; Fri, 13 Sep 2024 12:49:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726231786; cv=pass; b=n+BUv74WBpIAxmm0Oh2flCKUKUMb5KfkBb6/oaFoSEGuUZNLg607l9D5gmTI7/XpZpobLZqpYQ7pjN5Ehk7Jp/3EHF/yXP/laQ3966CJw4PVB8OFaslF8sUwj0lRjnVUZIk6RY6ysAhXRELw78fBlUMn7p0Uv+j+TtSoKM3iKuk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726231786; c=relaxed/simple; bh=asAKIMloSf1nvWG/eY0Vpe2S7Uh/A8aA1LS8hR1uMGU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=g/ky5sjMvJaHJMgwyjlt244gYDs9jvI0/UJ1p0UW189Z20EUsm1VuFFzLbBaBo0GXVO51EommOfjeUmd4g1CszGmOihuUYoZdCwcPz6DH2lc0z9GDWqP3COXzRnXPGUKA8M0a+aF/P5TW8UhDhoEYLHgVPWXuPA0SGc16N3aO1s= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=adrian.larumbe@collabora.com header.b=EduZNAa1; arc=pass smtp.client-ip=136.143.188.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=collabora.com header.i=adrian.larumbe@collabora.com header.b="EduZNAa1" ARC-Seal: i=1; a=rsa-sha256; t=1726231767; cv=none; d=zohomail.com; s=zohoarc; b=kX8xnFyIF0YwUcO1em0NFK76ybiqVlSfq6wBncXwLViEVzddfvh+scoFQYfnlOmS9KPhojaML/GfM/v3Mmg7T+bs6oDb13L75iQ9K/OLgxgijIU4ZW89LgRdT4KlKmWq7kvo+p3D4Tyf7C58AzjFtBXlCeuWEbklBCNwHT40yIQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726231767; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=8Zx1uYvQJHEfMq1P3R7kwkjfLptnJ4BSs6hKaoa5xIA=; b=b4NrpurorTXkOnAebVNnocdMh8ecd/7wtksFt0UEv8D53gh84fePXrVv95/WF35r5kNSj49fGjNodD7bqoNJBMAV2tfNMlxpUvI0VUuWkeimY1z/uMOcYvlvUSKQ2eEc7R1EM3StkXh0tJ46KgUZEuHL2Vf1TC9rpkWdtVt+YGw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=adrian.larumbe@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1726231767; s=zohomail; d=collabora.com; i=adrian.larumbe@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=8Zx1uYvQJHEfMq1P3R7kwkjfLptnJ4BSs6hKaoa5xIA=; b=EduZNAa19+GxhbeGdsnhnoOhDdhTGxyuu/Su24xLLIFcOWCvo5MaoW27jBhIrMdp S/UueQmrPz6EILOoYrv+fX6RGJdOoPaT+mZIpe+qWCRjrcZGUMn5t6SU7I+HabUbEHq qSVVxpIkeALwu4WmzS26mUgURzvVZXD8erfpp2es= Received: by mx.zohomail.com with SMTPS id 1726231765207404.5400860623354; Fri, 13 Sep 2024 05:49:25 -0700 (PDT) From: =?UTF-8?q?Adri=C3=A1n=20Larumbe?= To: Boris Brezillon , Steven Price , Liviu Dudau , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Sumit Semwal , =?UTF-8?q?Christian=20K=C3=B6nig?= Cc: kernel@collabora.com, =?UTF-8?q?Adri=C3=A1n=20Larumbe?= , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org Subject: [PATCH v6 5/5] drm/panthor: add sysfs knob for enabling job profiling Date: Fri, 13 Sep 2024 13:42:13 +0100 Message-ID: <20240913124857.389630-6-adrian.larumbe@collabora.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240913124857.389630-1-adrian.larumbe@collabora.com> References: <20240913124857.389630-1-adrian.larumbe@collabora.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable This commit introduces a DRM device sysfs attribute that lets UM control the job accounting status in the device. The knob variable had been brought in as part of a previous commit, but now we're able to fix it manually. As sysfs files are part of a driver's uAPI, describe its legitimate input values and output format in a documentation file. Signed-off-by: Adri=C3=A1n Larumbe Reviewed-by: Steven Price Reviewed-by: Boris Brezillon --- .../testing/sysfs-driver-panthor-profiling | 10 ++++ Documentation/gpu/panthor.rst | 46 +++++++++++++++++++ drivers/gpu/drm/panthor/panthor_drv.c | 39 ++++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-driver-panthor-profiling create mode 100644 Documentation/gpu/panthor.rst diff --git a/Documentation/ABI/testing/sysfs-driver-panthor-profiling b/Doc= umentation/ABI/testing/sysfs-driver-panthor-profiling new file mode 100644 index 000000000000..af05fccedc15 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-driver-panthor-profiling @@ -0,0 +1,10 @@ +What: /sys/bus/platform/drivers/panthor/.../profiling +Date: September 2024 +KernelVersion: 6.11.0 +Contact: Adrian Larumbe +Description: + Bitmask to enable drm fdinfo's job profiling measurements. + Valid values are: + 0: Don't enable fdinfo job profiling sources. + 1: Enable GPU cycle measurements for running jobs. + 2: Enable GPU timestamp sampling for running jobs. diff --git a/Documentation/gpu/panthor.rst b/Documentation/gpu/panthor.rst new file mode 100644 index 000000000000..cbf5c4429a2d --- /dev/null +++ b/Documentation/gpu/panthor.rst @@ -0,0 +1,46 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D + drm/Panthor CSF driver +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D + +.. _panfrost-usage-stats: + +Panthor DRM client usage stats implementation +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +The drm/Panthor driver implements the DRM client usage stats specification= as +documented in :ref:`drm-client-usage-stats`. + +Example of the output showing the implemented key value pairs and entirety= of +the currently possible format options: + +:: + pos: 0 + flags: 02400002 + mnt_id: 29 + ino: 491 + drm-driver: panthor + drm-client-id: 10 + drm-engine-panthor: 111110952750 ns + drm-cycles-panthor: 94439687187 + drm-maxfreq-panthor: 1000000000 Hz + drm-curfreq-panthor: 1000000000 Hz + drm-total-memory: 16480 KiB + drm-shared-memory: 0 + drm-active-memory: 16200 KiB + drm-resident-memory: 16480 KiB + drm-purgeable-memory: 0 + +Possible `drm-engine-` key names are: `panthor`. +`drm-curfreq-` values convey the current operating frequency for that engi= ne. + +Users must bear in mind that engine and cycle sampling are disabled by def= ault, +because of power saving concerns. `fdinfo` users and benchmark application= s which +query the fdinfo file must make sure to toggle the job profiling status of= the +driver by writing into the appropriate sysfs node:: + + echo > /sys/bus/platform/drivers/panthor/[a-f0-9]*.gpu/profiling + +Where `N` is a bit mask where cycle and timestamp sampling are respectively +enabled by the first and second bits. diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/pantho= r/panthor_drv.c index 233b265c0819..6f47d9d1d86a 100644 --- a/drivers/gpu/drm/panthor/panthor_drv.c +++ b/drivers/gpu/drm/panthor/panthor_drv.c @@ -1513,6 +1513,44 @@ static void panthor_remove(struct platform_device *p= dev) panthor_device_unplug(ptdev); } =20 +static ssize_t profiling_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct panthor_device *ptdev =3D dev_get_drvdata(dev); + + return sysfs_emit(buf, "%d\n", ptdev->profile_mask); +} + +static ssize_t profiling_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t len) +{ + struct panthor_device *ptdev =3D dev_get_drvdata(dev); + u32 value; + int err; + + err =3D kstrtou32(buf, 0, &value); + if (err) + return err; + + if ((value & ~PANTHOR_DEVICE_PROFILING_ALL) !=3D 0) + return -EINVAL; + + ptdev->profile_mask =3D value; + + return len; +} + +static DEVICE_ATTR_RW(profiling); + +static struct attribute *panthor_attrs[] =3D { + &dev_attr_profiling.attr, + NULL, +}; + +ATTRIBUTE_GROUPS(panthor); + static const struct of_device_id dt_match[] =3D { { .compatible =3D "rockchip,rk3588-mali" }, { .compatible =3D "arm,mali-valhall-csf" }, @@ -1532,6 +1570,7 @@ static struct platform_driver panthor_driver =3D { .name =3D "panthor", .pm =3D pm_ptr(&panthor_pm_ops), .of_match_table =3D dt_match, + .dev_groups =3D panthor_groups, }, }; =20 --=20 2.46.0