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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 29FD7C61DA3 for ; Tue, 21 Feb 2023 22:14:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A081110E1A0; Tue, 21 Feb 2023 22:14:55 +0000 (UTC) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id B6E7D10E1A0 for ; Tue, 21 Feb 2023 22:14:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1677017693; x=1708553693; h=date:message-id:from:to:cc:subject:in-reply-to: references:mime-version:content-transfer-encoding; bh=MYKOw8b/MWHZ2OJlCMA9PQKK8kYk/Y0ibTcvz7cne5c=; b=dWEKn4ZQJJ3L5ipKuVYHQmJlApUY5K3Rsc+nrNsSn5iL0K+6+GPLDXEM jbtEsmckLhiacM+xodslMA3xioDeQs9y8EQUKzHvyTdqMpFSbIPfCR9Yw 4fjbYGi7PTBzoWX/U0jTm4vpc8hywaVFEmgsnMrjJH/+5PDIaLalEJOhl gRt8vb5+8TK35KAX4ysswUrNqC/tMRjFd94jOcnGzM8+T2z41vBuSm6ez 3UOg1HpqUGBQmMvPh91xZLEJu65t0bz3zjRixogvI/CHq1Z/IHXxncPem 9PJAPzbcF5c9miD4OinPe9yxDkVQyGiBUKSvjH7lHYod46ZYvcxm15Jjh w==; X-IronPort-AV: E=McAfee;i="6500,9779,10628"; a="397457552" X-IronPort-AV: E=Sophos;i="5.97,317,1669104000"; d="scan'208";a="397457552" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Feb 2023 14:14:36 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10628"; a="845874111" X-IronPort-AV: E=Sophos;i="5.97,317,1669104000"; d="scan'208";a="845874111" Received: from adixit-mobl.amr.corp.intel.com (HELO adixit-arch.intel.com) ([10.209.49.150]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Feb 2023 14:14:35 -0800 Date: Tue, 21 Feb 2023 14:14:35 -0800 Message-ID: <87cz62br90.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: Umesh Nerlige Ramappa In-Reply-To: <20230217005850.2511422-7-umesh.nerlige.ramappa@intel.com> References: <20230217005850.2511422-1-umesh.nerlige.ramappa@intel.com> <20230217005850.2511422-7-umesh.nerlige.ramappa@intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/28.2 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Intel-gfx] [PATCH v2 6/9] drm/i915/perf: Parse 64bit report header formats correctly X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Thu, 16 Feb 2023 16:58:47 -0800, Umesh Nerlige Ramappa wrote: > > Now that OA formats come in flavor of 64 bit reports, the report header > has 64 bit report-id, timestamp, context-id and gpu-ticks fields. When > filtering these reports, use the right width for these fields. > > Note that upper dword of context id is reserved, so squash lower dword > only. > > Signed-off-by: Umesh Nerlige Ramappa > --- > drivers/gpu/drm/i915/i915_perf.c | 105 ++++++++++++++++++++----- > drivers/gpu/drm/i915/i915_perf_types.h | 6 ++ > 2 files changed, 92 insertions(+), 19 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915= _perf.c > index 3306653c0b85..9715b964aa1e 100644 > --- a/drivers/gpu/drm/i915/i915_perf.c > +++ b/drivers/gpu/drm/i915/i915_perf.c > @@ -441,6 +441,75 @@ static u32 gen7_oa_hw_tail_read(struct i915_perf_str= eam *stream) > return oastatus1 & GEN7_OASTATUS1_TAIL_MASK; > } > > +#define oa_report_header_64bit(__s) \ > + ((__s)->oa_buffer.format->header =3D=3D HDR_64_BIT) > + > +static inline u64 > +oa_report_id(struct i915_perf_stream *stream, void *report) > +{ > + return oa_report_header_64bit(stream) ? *(u64 *)report : *(u32 *)report; > +} > + > +static inline u64 > +oa_report_reason(struct i915_perf_stream *stream, void *report) > +{ > + return (oa_report_id(stream, report) >> OAREPORT_REASON_SHIFT) & > + (GRAPHICS_VER(stream->perf->i915) =3D=3D 12 ? > + OAREPORT_REASON_MASK_EXTENDED : > + OAREPORT_REASON_MASK); > +} > + > +static inline void > +oa_report_id_clear(struct i915_perf_stream *stream, u32 *report) > +{ > + if (oa_report_header_64bit(stream)) > + *(u64 *)report =3D 0; > + else > + *report =3D 0; > +} > + > +static inline bool > +oa_report_ctx_invalid(struct i915_perf_stream *stream, void *report) > +{ > + return !(oa_report_id(stream, report) & > + stream->perf->gen8_valid_ctx_bit) && > + GRAPHICS_VER(stream->perf->i915) <=3D 11; > +} > + > +static inline u64 > +oa_timestamp(struct i915_perf_stream *stream, void *report) > +{ > + return oa_report_header_64bit(stream) ? > + *((u64 *)report + 1) : > + *((u32 *)report + 1); > +} > + > +static inline void > +oa_timestamp_clear(struct i915_perf_stream *stream, u32 *report) > +{ > + if (oa_report_header_64bit(stream)) > + *(u64 *)&report[2] =3D 0; > + else > + report[1] =3D 0; > +} > + > +static inline u32 > +oa_context_id(struct i915_perf_stream *stream, u32 *report) > +{ > + u32 ctx_id =3D oa_report_header_64bit(stream) ? report[4] : report[2]; > + > + return ctx_id & stream->specific_ctx_id_mask; > +} > + > +static inline void > +oa_context_id_squash(struct i915_perf_stream *stream, u32 *report) > +{ > + if (oa_report_header_64bit(stream)) > + report[4] =3D INVALID_CTX_ID; > + else > + report[2] =3D INVALID_CTX_ID; > +} Let's drop 'inline' from all these functions, the convention is to let compiler decide to inline. > + > /** > * oa_buffer_check_unlocked - check for data and update tail ptr state > * @stream: i915 stream instance > @@ -521,9 +590,10 @@ static bool oa_buffer_check_unlocked(struct i915_per= f_stream *stream) > * If not : (=E2=95=AF=C2=B0=E2=96=A1=C2=B0=EF=BC=89=E2=95=AF=EF=B8=B5 = =E2=94=BB=E2=94=81=E2=94=BB > */ Might as well fix up the comment above to say report_id and timestamp instead of dword 0 and 1. With the above changes, this is: Reviewed-by: Ashutosh Dixit