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 A625DC32771 for ; Fri, 16 Sep 2022 00:47:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 847D610E340; Fri, 16 Sep 2022 00:47:39 +0000 (UTC) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id 543D110E340 for ; Fri, 16 Sep 2022 00:47:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663289256; x=1694825256; h=date:message-id:from:to:cc:subject:in-reply-to: references:mime-version; bh=6NXFRXSSL7DiD/Y5XOtsZZU/uxD1J28gRFRCWCZJifU=; b=AjsQO7ALyNUp3BeKT4ircwg6PE4E97TtBxkP4nw1+drALrk5NwcbIowq Z7lIe1ozLfEILiX/VL9JX3aCEiu3CYUszMpMYV3bT1JJve0AueiG1376y cSuZwdoNU1r0a+H/n7qoABKEIon194IjcbIJghMGdvmZRNyOtvyvK/Czc eKCWPtJvZYoAWMNHkOnSYUxEfk1a9qgyMdbokncLNub1hYBAzY4GxgH01 FrwrpqKCcB/kiPQhZKO6Br1abvhrQ/ziCQyiw0KLXe4+HuOb/CTmVXNek bGhXITpD+QcwOZxNTIyggBT2UALHQXe1dBDB0ak7zWAnnaOHRtsXxH+1c g==; X-IronPort-AV: E=McAfee;i="6500,9779,10471"; a="296467557" X-IronPort-AV: E=Sophos;i="5.93,319,1654585200"; d="scan'208";a="296467557" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2022 17:47:35 -0700 X-IronPort-AV: E=Sophos;i="5.93,319,1654585200"; d="scan'208";a="946188430" Received: from adixit-mobl.amr.corp.intel.com (HELO adixit-arch.intel.com) ([10.209.41.22]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2022 17:47:34 -0700 Date: Thu, 15 Sep 2022 17:47:33 -0700 Message-ID: <87czbw402i.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: Umesh Nerlige Ramappa In-Reply-To: <20220823204155.8178-13-umesh.nerlige.ramappa@intel.com> References: <20220823204155.8178-1-umesh.nerlige.ramappa@intel.com> <20220823204155.8178-13-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.1 (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=US-ASCII Subject: Re: [Intel-gfx] [PATCH 12/19] 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 Tue, 23 Aug 2022 13:41:48 -0700, Umesh Nerlige Ramappa wrote: > Hi Umesh, > @@ -740,23 +802,19 @@ static int gen8_append_oa_reports(struct i915_perf_stream *stream, > u8 *report = oa_buf_base + head; > u32 *report32 = (void *)report; > u32 ctx_id; > - u32 reason; > + u64 reason; > > /* > * The reason field includes flags identifying what > * triggered this specific report (mostly timer > * triggered or e.g. due to a context switch). > * > - * This field is never expected to be zero so we can > - * check that the report isn't invalid before copying > - * it to userspace... > + * In MMIO triggered reports, some platforms do not set the > + * reason bit in this field and it is valid to have a reason > + * field of zero. > */ > - reason = ((report32[0] >> OAREPORT_REASON_SHIFT) & > - (GRAPHICS_VER(stream->perf->i915) == 12 ? > - OAREPORT_REASON_MASK_EXTENDED : > - OAREPORT_REASON_MASK)); > - > - ctx_id = report32[2] & stream->specific_ctx_id_mask; > + reason = oa_report_reason(stream, report); > + ctx_id = oa_context_id(stream, report32); > > /* > * Squash whatever is in the CTX_ID field if it's marked as > @@ -766,9 +824,10 @@ static int gen8_append_oa_reports(struct i915_perf_stream *stream, > * Note: that we don't clear the valid_ctx_bit so userspace can > * understand that the ID has been squashed by the kernel. > */ > - if (!(report32[0] & stream->perf->gen8_valid_ctx_bit) && > - GRAPHICS_VER(stream->perf->i915) <= 11) > - ctx_id = report32[2] = INVALID_CTX_ID; > + if (oa_report_ctx_invalid(stream, report)) { > + ctx_id = INVALID_CTX_ID; > + oa_context_id_squash(stream, report32); > + } > > /* > * NB: For Gen 8 the OA unit no longer supports clock gating > @@ -812,7 +871,7 @@ static int gen8_append_oa_reports(struct i915_perf_stream *stream, > */ > if (stream->ctx && > stream->specific_ctx_id != ctx_id) { > - report32[2] = INVALID_CTX_ID; > + oa_context_id_squash(stream, report32); > } > > ret = append_oa_sample(stream, buf, count, offset, > @@ -824,11 +883,11 @@ static int gen8_append_oa_reports(struct i915_perf_stream *stream, > } > > /* > - * Clear out the first 2 dword as a mean to detect unlanded > + * Clear out the report id and timestamp as a means to detect unlanded > * reports. > */ > - report32[0] = 0; > - report32[1] = 0; > + oa_report_id_clear(stream, report32); > + oa_timestamp_clear(stream, report32); Because we now have these new functions, why do we now need two pointers report and report32 pointing to the same location? I think we can just have a single 'void *report' which we can pass into all these functions, correct? With this change, this is: Reviewed-by: Ashutosh Dixit