From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B9930EE3695 for ; Thu, 12 Feb 2026 16:24:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=7qp/RCJIu6lXGCpytVNbbpPksikj90WD8/CDtqJ+h1Q=; b=TaS2q0oLxsZpvM4lds5J55ukZU /iJw0wbjpcJ3vTaaFvPuk/rAE4VIrsGJ5a9lI9A/4L2OozY77gQcf6r4KQQQB9YAFntcWf0BxO/Os b4lYT/iKkNIjtPutr0sqHm/+iqz6M//cI4Jqg27MUDKvIndVqIRCnq2awHHFh/IfL9QhKYx5iiK+9 IS25yhExOcgUnrIaw2MXtcysHxZ3D/0YURsNWJw40P0LbMYKh5fdX+TWhQEV48HnHcFUH46RKp422 KE2x1BbTJQFdwoih9vt0f2sl8O6d/QKu92vO8mo0aya7wB4Bup2RPTTu+jEisBvED4zto/NvpL9B7 8ZEkl/Lg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vqZUD-00000002Lev-37o9; Thu, 12 Feb 2026 16:24:13 +0000 Received: from bali.collaboradmins.com ([148.251.105.195]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vqZU9-00000002LWf-0Cid; Thu, 12 Feb 2026 16:24:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1770913446; bh=vBBpxpebLiYJIkQxlVMyNrGvtfsuoFLONoMpU1V0tnA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=llB9yrhOo03sz5nB1W2bO7oKNmywE3mQx95PEoFBf5IO7Xmy+m53z8CS/dbszM40c DAHfMqq4pKyVJwTp7vVFJ+Wua5OLOKuvASybimOwsxRzJJxdfEketRMWJU5MfxtTct ZiIduCsgzdYTMJpzz0+IH7dGiaxEWUGfFiqAFQOTgdM4lroenJhxFgRj3prFsR8KT2 wGPjp7jMec5+ue0CqhZ09Qv5EcagKrxvwWXVhXULftOkWLuaaPVlocxLxojPxC7jH5 XsYmKve3wwz0EO3D11QTHCP8UZBxcSlyRFtbvaWZ3M2bsXxB7bwVBG2RBPnmVcFp2y GDWT7Uu2VNxYQ== Received: from trenzalore (modemcable014.2-22-96.mc.videotron.ca [96.22.2.14]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: detlev) by bali.collaboradmins.com (Postfix) with ESMTPSA id AA85B17E0E6A; Thu, 12 Feb 2026 17:24:03 +0100 (CET) From: Detlev Casanova To: linux-kernel@vger.kernel.org Cc: Nicolas Dufresne , Benjamin Gaignard , Philipp Zabel , Mauro Carvalho Chehab , Heiko Stuebner , Daniel Almeida , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Hans Verkuil , Laurent Pinchart , Ricardo Ribalda , Yunke Cao , Detlev Casanova , Sakari Ailus , Pavan Bobba , James Cowgill , Ma Ke , Jacopo Mondi , Daniel Scally , linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-trace-kernel@vger.kernel.org, kernel@collabora.com Subject: [PATCH 09/11] media: hantro: Add v4l2_hw run/done traces Date: Thu, 12 Feb 2026 11:23:26 -0500 Message-ID: <20260212162328.192217-10-detlev.casanova@collabora.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260212162328.192217-1-detlev.casanova@collabora.com> References: <20260212162328.192217-1-detlev.casanova@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260212_082409_373995_13897B28 X-CRM114-Status: GOOD ( 14.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add the trace calls as well as retrieving the number of clock cycles for the rockchip_vpu core. Signed-off-by: Detlev Casanova --- drivers/media/platform/verisilicon/hantro.h | 1 + drivers/media/platform/verisilicon/hantro_drv.c | 10 ++++++++++ .../media/platform/verisilicon/rockchip_vpu981_regs.h | 1 + drivers/media/platform/verisilicon/rockchip_vpu_hw.c | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/drivers/media/platform/verisilicon/hantro.h b/drivers/media/platform/verisilicon/hantro.h index 0353de154a1e..d5cddc783688 100644 --- a/drivers/media/platform/verisilicon/hantro.h +++ b/drivers/media/platform/verisilicon/hantro.h @@ -253,6 +253,7 @@ struct hantro_ctx { u32 sequence_cap; u32 sequence_out; + u32 hw_cycles; const struct hantro_fmt *vpu_src_fmt; struct v4l2_pix_format_mplane src_fmt; diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c index 94f58f4e4a4e..8dd26ca32459 100644 --- a/drivers/media/platform/verisilicon/hantro_drv.c +++ b/drivers/media/platform/verisilicon/hantro_drv.c @@ -25,6 +25,8 @@ #include #include +#include + #include "hantro_v4l2.h" #include "hantro.h" #include "hantro_hw.h" @@ -103,6 +105,9 @@ void hantro_irq_done(struct hantro_dev *vpu, struct hantro_ctx *ctx = v4l2_m2m_get_curr_priv(vpu->m2m_dev); + if (ctx) + trace_v4l2_hw_done(ctx->fh.tgid, ctx->fh.fd, ctx->hw_cycles); + /* * If cancel_delayed_work returns false * the timeout expired. The watchdog is running, @@ -125,6 +130,9 @@ void hantro_watchdog(struct work_struct *work) ctx = v4l2_m2m_get_curr_priv(vpu->m2m_dev); if (ctx) { vpu_err("frame processing timed out!\n"); + + trace_v4l2_hw_done(ctx->fh.tgid, ctx->fh.fd, ctx->hw_cycles); + if (ctx->codec_ops->reset) ctx->codec_ops->reset(ctx); hantro_job_finish(vpu, ctx, VB2_BUF_STATE_ERROR); @@ -189,6 +197,8 @@ static void device_run(void *priv) if (ctx->codec_ops->run(ctx)) goto err_cancel_job; + trace_v4l2_hw_run(ctx->fh.tgid, ctx->fh.fd); + return; err_cancel_job: diff --git a/drivers/media/platform/verisilicon/rockchip_vpu981_regs.h b/drivers/media/platform/verisilicon/rockchip_vpu981_regs.h index e4008da64f19..96b85470208b 100644 --- a/drivers/media/platform/verisilicon/rockchip_vpu981_regs.h +++ b/drivers/media/platform/verisilicon/rockchip_vpu981_regs.h @@ -451,6 +451,7 @@ #define av1_pp0_dup_ver AV1_DEC_REG(394, 16, 0xff) #define av1_pp0_dup_hor AV1_DEC_REG(394, 24, 0xff) +#define AV1_CYCLE_COUNT (AV1_SWREG(63)) #define AV1_TILE_OUT_LU (AV1_SWREG(65)) #define AV1_REFERENCE_Y(i) (AV1_SWREG(67) + ((i) * 0x8)) #define AV1_SEGMENTATION (AV1_SWREG(81)) diff --git a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c index 02673be9878e..f959151b6645 100644 --- a/drivers/media/platform/verisilicon/rockchip_vpu_hw.c +++ b/drivers/media/platform/verisilicon/rockchip_vpu_hw.c @@ -424,6 +424,8 @@ static irqreturn_t rk3588_vpu981_irq(int irq, void *dev_id) { struct hantro_dev *vpu = dev_id; enum vb2_buffer_state state; + struct hantro_ctx *ctx = + v4l2_m2m_get_curr_priv(vpu->m2m_dev); u32 status; status = vdpu_read(vpu, AV1_REG_INTERRUPT); @@ -433,6 +435,8 @@ static irqreturn_t rk3588_vpu981_irq(int irq, void *dev_id) vdpu_write(vpu, 0, AV1_REG_INTERRUPT); vdpu_write(vpu, AV1_REG_CONFIG_DEC_CLK_GATE_E, AV1_REG_CONFIG); + ctx->hw_cycles = vdpu_read(vpu, AV1_CYCLE_COUNT); + hantro_irq_done(vpu, state); return IRQ_HANDLED; -- 2.53.0