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 9AA0DC7618A for ; Mon, 20 Mar 2023 04:01:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2022010E170; Mon, 20 Mar 2023 04:01:24 +0000 (UTC) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id EFD5F10E170 for ; Mon, 20 Mar 2023 04:01:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679284881; x=1710820881; h=date:message-id:from:to:cc:subject:in-reply-to: references:mime-version; bh=J9GtHL+QDC/TtWte87eLUmyXPqmz+1oZeyp4LvFrpOI=; b=LxDMznKR2ptpvFljpKsXrxmOBzLDBXceGhP51A6W9spckb1Xx6Wc7rBz VD9dLWn6p+2jF+y79Ncy76cDT9vSYEPZyCQ8YRDMpl+aCnHs8ckcMwPgc ui6Etdf3FtVINPGGNxvQu14NWJEHtxBHVf6E8PyUlSLF4AEdXc9ta4gyB w1llxa8zcMeORKkmcMJiyjY+5QnC1lM2iEHtzceBvECGps0p4Q4YKMIx/ cqcMAI/7Ui2H0hjHmGkjiH0OXIZDimkqjCNZa71TIfxNhtyJJDyzjpkvN xQgOnfVyWGtP3gwezpwU9N2CP3r7XwZhvVIhkNjkkYGmRkAZzGy184PeN A==; X-IronPort-AV: E=McAfee;i="6600,9927,10654"; a="338593698" X-IronPort-AV: E=Sophos;i="5.98,274,1673942400"; d="scan'208";a="338593698" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Mar 2023 21:01:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10654"; a="770040092" X-IronPort-AV: E=Sophos;i="5.98,274,1673942400"; d="scan'208";a="770040092" Received: from adixit-mobl.amr.corp.intel.com (HELO adixit-arch.intel.com) ([10.212.250.140]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Mar 2023 21:01:21 -0700 Date: Sun, 19 Mar 2023 20:56:00 -0700 Message-ID: <87v8iwt6sv.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: Umesh Nerlige Ramappa In-Reply-To: <20230317231641.2815418-12-umesh.nerlige.ramappa@intel.com> References: <20230317231641.2815418-1-umesh.nerlige.ramappa@intel.com> <20230317231641.2815418-12-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=US-ASCII Subject: Re: [Intel-gfx] [PATCH v7 11/11] drm/i915/perf: Wa_14017512683: Disable OAM if media C6 is enabled in BIOS 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 Fri, 17 Mar 2023 16:16:41 -0700, Umesh Nerlige Ramappa wrote: > Hi Umesh, Please read from bottom to top. Mostly nits but let's see what you think. > OAM does not work with media C6 enabled on some steppings of MTL. > Disable OAM if we detect that media C6 was enabled in bios. > > v2: (Ashutosh) > - Remove drm_notice from the driver load path > - Log a drm_err when opening an OAM stream on affected steppings > > Signed-off-by: Umesh Nerlige Ramappa > --- > drivers/gpu/drm/i915/i915_perf.c | 41 ++++++++++++++++++++++++++++++++ > 1 file changed, 41 insertions(+) > > diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c > index 18afa76653b7..823379d63caf 100644 > --- a/drivers/gpu/drm/i915/i915_perf.c > +++ b/drivers/gpu/drm/i915/i915_perf.c > @@ -209,6 +209,7 @@ > #include "gt/intel_gt_regs.h" > #include "gt/intel_lrc.h" > #include "gt/intel_lrc_reg.h" > +#include "gt/intel_rc6.h" > #include "gt/intel_ring.h" > #include "gt/uc/intel_guc_slpc.h" > > @@ -4216,6 +4217,20 @@ static int read_properties_unlocked(struct i915_perf *perf, > return -EINVAL; > } > > + /* > + * Wa_14017512683: mtl[a0..c0): Use of OAM must be preceded with Media > + * C6 disable in BIOS. Fail if Media C6 is enabled on steppings where OAM > + * does not work as expected. > + */ > + if (IS_MTL_MEDIA_STEP(props->engine->i915, STEP_A0, STEP_C0) && > + props->engine->gt->type == GT_MEDIA && Instead of gt type I think it's better to check perf_group->type. That is why as I said below maybe better to have a valid perf_group even in this case. > + intel_check_bios_c6_setup(&props->engine->gt->rc6)) { > + drm_dbg(&perf->i915->drm, > + "OAM requires media C6 to be disabled in BIOS\n"); > + return -EINVAL; > + } So now we can change this check to something like: if (engine->perf_group->type == OAM && i915_perf->mtl_bios_mc6_enabled) > + > + > if (!engine_supports_oa(props->engine)) { > drm_dbg(&perf->i915->drm, > "Engine not supported by OA %d:%d\n", > @@ -4897,6 +4912,15 @@ static u32 num_perf_groups_per_gt(struct intel_gt *gt) > > static u32 __oam_engine_group(struct intel_engine_cs *engine) > { > + /* > + * Wa_14017512683: mtl[a0..c0): Use of OAM must be preceded with Media > + * C6 disable in BIOS. To disable use of OAM with media engines, set the > + * oa_group to PERF_GROUP_INVALID. > + */ > + if (IS_MTL_MEDIA_STEP(engine->i915, STEP_A0, STEP_C0) && > + intel_check_bios_c6_setup(&engine->gt->rc6)) > + return PERF_GROUP_INVALID; I think we should just remove this. Let the perf group be valid in this case too since we cannot support OA for a different reason. Then we can use the OAM perf group above. Though if we drop this we have only 2 instances of the checks instead of 3 so maybe ok to not have i915_perf->mtl_bios_mc6_enabled? > + > if (GRAPHICS_VER_FULL(engine->i915) >= IP_VER(12, 70)) { > /* > * There's 1 SAMEDIA gt and 1 OAM per SAMEDIA gt. All media slices > @@ -5316,6 +5340,23 @@ int i915_perf_ioctl_version(struct drm_i915_private *i915) > * > * 7: Add support for video decode and enhancement classes. > */ > + > + /* > + * Wa_14017512683: mtl[a0..c0): Use of OAM must be preceded with Media > + * C6 disable in BIOS. If Media C6 is enabled in BIOS, return version 6 > + * to indicate that OA media is not supported. > + */ > + if (IS_MTL_MEDIA_STEP(i915, STEP_A0, STEP_C0)) { > + struct intel_gt *gt; > + int i; > + > + for_each_gt(gt, i915, i) { > + if (gt->type == GT_MEDIA && > + intel_check_bios_c6_setup(>->rc6)) Rather than repeat this comment and these checks (MTL stepping and intel_check_bios_c6_setup) 3 times, I think it will be simpler to set a variable (say i915_perf->mtl_bios_mc6_enabled) in i915_perf_init() and reuse that in the 3 places. > + return 6; > + } > + } > + > return 7; > } Thanks. -- Ashutosh