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 BA525C433F5 for ; Fri, 18 Feb 2022 20:28:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0135B10E18A; Fri, 18 Feb 2022 20:28:05 +0000 (UTC) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5474C10E18A for ; Fri, 18 Feb 2022 20:28:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645216083; x=1676752083; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=UsEaTjQQI4lSd68OlQpiotbuhNvbThbFiz4Pt0MlxC4=; b=IWg8/XkyN4y9OaEyk7mCs3D083pWA15+Ppv/WJncKM4YBN4WDo+KwlsJ wbmKrs5cCzqCBJrnUOpKT8pAM7v1HZAQHCij+Vmey7Mq9ibQUuY5tsmDj zRDZNHArVs9xiu259udj/SgzXS4bBhG29vWBDbt+F3hHo/rTXFp5H1Hr3 P5yM/FaMWagCXe/fRMos4SW8ioMxvUyrIlHjrjeYMmSkR8w3hTgw/EEWc 8qJr4OJE0f0NL4Qbqzzn9ehcRd45TJMf2ilBS8tl333hbosz18SuRnqV7 J7mNE+WC/JbRtYgstUaKtDCWYgrWYKC6Doo5xaxS4HsAH85CtzcTDuRjZ w==; X-IronPort-AV: E=McAfee;i="6200,9189,10262"; a="314477288" X-IronPort-AV: E=Sophos;i="5.88,379,1635231600"; d="scan'208";a="314477288" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Feb 2022 12:28:02 -0800 X-IronPort-AV: E=Sophos;i="5.88,379,1635231600"; d="scan'208";a="546461577" Received: from araschdo-mobl.amr.corp.intel.com (HELO intel.com) ([10.255.33.117]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Feb 2022 12:28:02 -0800 Date: Fri, 18 Feb 2022 15:27:59 -0500 From: Rodrigo Vivi To: Tejas Upadhyay Message-ID: References: <20220217123223.748184-1-tejaskumarx.surendrakumar.upadhyay@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220217123223.748184-1-tejaskumarx.surendrakumar.upadhyay@intel.com> Subject: Re: [Intel-gfx] [PATCH] drm/i915/gt: use get_reset_domain() helper 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, Feb 17, 2022 at 06:02:23PM +0530, Tejas Upadhyay wrote: > We dont need to implement reset_domain in intel_engine > _setup(), but can be done as a helper. Implemented as > engine->reset_domain = get_reset_domain(). > > Cc: Rodrigo Vivi > Signed-off-by: Tejas Upadhyay it is a good non-functional clean-up in the engine setup function and we will need this soon to be called from more other places, so: Reviewed-by: Rodrigo Vivi > --- > drivers/gpu/drm/i915/gt/intel_engine_cs.c | 74 +++++++++++++---------- > 1 file changed, 42 insertions(+), 32 deletions(-) > > diff --git a/drivers/gpu/drm/i915/gt/intel_engine_cs.c b/drivers/gpu/drm/i915/gt/intel_engine_cs.c > index e53008b4dd05..e855c801ba28 100644 > --- a/drivers/gpu/drm/i915/gt/intel_engine_cs.c > +++ b/drivers/gpu/drm/i915/gt/intel_engine_cs.c > @@ -293,6 +293,46 @@ static void nop_irq_handler(struct intel_engine_cs *engine, u16 iir) > GEM_DEBUG_WARN_ON(iir); > } > > +static u32 get_reset_domain(u8 ver, enum intel_engine_id id) > +{ > + u32 reset_domain; > + > + if (ver >= 11) { > + static const u32 engine_reset_domains[] = { > + [RCS0] = GEN11_GRDOM_RENDER, > + [BCS0] = GEN11_GRDOM_BLT, > + [VCS0] = GEN11_GRDOM_MEDIA, > + [VCS1] = GEN11_GRDOM_MEDIA2, > + [VCS2] = GEN11_GRDOM_MEDIA3, > + [VCS3] = GEN11_GRDOM_MEDIA4, > + [VCS4] = GEN11_GRDOM_MEDIA5, > + [VCS5] = GEN11_GRDOM_MEDIA6, > + [VCS6] = GEN11_GRDOM_MEDIA7, > + [VCS7] = GEN11_GRDOM_MEDIA8, > + [VECS0] = GEN11_GRDOM_VECS, > + [VECS1] = GEN11_GRDOM_VECS2, > + [VECS2] = GEN11_GRDOM_VECS3, > + [VECS3] = GEN11_GRDOM_VECS4, > + }; > + GEM_BUG_ON(id >= ARRAY_SIZE(engine_reset_domains) || > + !engine_reset_domains[id]); > + reset_domain = engine_reset_domains[id]; > + } else { > + static const u32 engine_reset_domains[] = { > + [RCS0] = GEN6_GRDOM_RENDER, > + [BCS0] = GEN6_GRDOM_BLT, > + [VCS0] = GEN6_GRDOM_MEDIA, > + [VCS1] = GEN8_GRDOM_MEDIA2, > + [VECS0] = GEN6_GRDOM_VECS, > + }; > + GEM_BUG_ON(id >= ARRAY_SIZE(engine_reset_domains) || > + !engine_reset_domains[id]); > + reset_domain = engine_reset_domains[id]; > + } > + > + return reset_domain; > +} > + > static int intel_engine_setup(struct intel_gt *gt, enum intel_engine_id id, > u8 logical_instance) > { > @@ -328,38 +368,8 @@ static int intel_engine_setup(struct intel_gt *gt, enum intel_engine_id id, > engine->id = id; > engine->legacy_idx = INVALID_ENGINE; > engine->mask = BIT(id); > - if (GRAPHICS_VER(gt->i915) >= 11) { > - static const u32 engine_reset_domains[] = { > - [RCS0] = GEN11_GRDOM_RENDER, > - [BCS0] = GEN11_GRDOM_BLT, > - [VCS0] = GEN11_GRDOM_MEDIA, > - [VCS1] = GEN11_GRDOM_MEDIA2, > - [VCS2] = GEN11_GRDOM_MEDIA3, > - [VCS3] = GEN11_GRDOM_MEDIA4, > - [VCS4] = GEN11_GRDOM_MEDIA5, > - [VCS5] = GEN11_GRDOM_MEDIA6, > - [VCS6] = GEN11_GRDOM_MEDIA7, > - [VCS7] = GEN11_GRDOM_MEDIA8, > - [VECS0] = GEN11_GRDOM_VECS, > - [VECS1] = GEN11_GRDOM_VECS2, > - [VECS2] = GEN11_GRDOM_VECS3, > - [VECS3] = GEN11_GRDOM_VECS4, > - }; > - GEM_BUG_ON(id >= ARRAY_SIZE(engine_reset_domains) || > - !engine_reset_domains[id]); > - engine->reset_domain = engine_reset_domains[id]; > - } else { > - static const u32 engine_reset_domains[] = { > - [RCS0] = GEN6_GRDOM_RENDER, > - [BCS0] = GEN6_GRDOM_BLT, > - [VCS0] = GEN6_GRDOM_MEDIA, > - [VCS1] = GEN8_GRDOM_MEDIA2, > - [VECS0] = GEN6_GRDOM_VECS, > - }; > - GEM_BUG_ON(id >= ARRAY_SIZE(engine_reset_domains) || > - !engine_reset_domains[id]); > - engine->reset_domain = engine_reset_domains[id]; > - } > + engine->reset_domain = get_reset_domain(GRAPHICS_VER(gt->i915), > + id); > engine->i915 = i915; > engine->gt = gt; > engine->uncore = gt->uncore; > -- > 2.34.1 >