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 B63D8C636CC for ; Fri, 17 Feb 2023 01:10:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3E32F10E1A3; Fri, 17 Feb 2023 01:10:30 +0000 (UTC) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by gabe.freedesktop.org (Postfix) with ESMTPS id DBDB810E138 for ; Fri, 17 Feb 2023 01:10:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676596227; x=1708132227; h=date:message-id:from:to:cc:subject:in-reply-to: references:mime-version; bh=IwP2g1kuMEPGr1mi8Uqg6eFO8R/CMo+AZ8Iako0lQTA=; b=VXCesUP9CWLZNBC2pMcf4RTiRFcBZN85q3kb11nzJAmlLd9rFPxsvkbA wwPAN2YeZkwpKSvoOeJIYue4/YF3qgpcgYXlcOiJjg97x4TJviOezgnaS 0IoDU6ba5BlZBP3KKhWmPsFBLVn88wJ7J/NLtYAQXGslEd+rxTmV3WA8I yI5zqBbj0lOcFrCs+P2KbDv1xKtdkx00aNr55mKWJInK4FIgQGtvEn5ZW TmCjGXBH4SlCRNGrfuPZ5C/PvUE3WSYoUxrE9EyRke2TJun2jbKLW+3mN r9IgMsEqkaqSxcttt76ZI39Rq9pK8pnjoyanI6FMV21+3dzPvXDXVWTno Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10623"; a="315594874" X-IronPort-AV: E=Sophos;i="5.97,304,1669104000"; d="scan'208";a="315594874" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Feb 2023 17:10:27 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10623"; a="647924331" X-IronPort-AV: E=Sophos;i="5.97,304,1669104000"; d="scan'208";a="647924331" Received: from adixit-mobl.amr.corp.intel.com (HELO adixit-arch.intel.com) ([10.209.69.178]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Feb 2023 17:10:27 -0800 Date: Thu, 16 Feb 2023 17:10:08 -0800 Message-ID: <87h6vlf66n.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: Umesh Nerlige Ramappa In-Reply-To: <20230217005850.2511422-4-umesh.nerlige.ramappa@intel.com> References: <20230217005850.2511422-1-umesh.nerlige.ramappa@intel.com> <20230217005850.2511422-4-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 v2 3/9] drm/i915/perf: Validate OA sseu config outside switch 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:44 -0800, Umesh Nerlige Ramappa wrote: > > Once OA supports media engine class:instance, the engine can only be > validated outside the switch since class and instance parameters are > separate entities. Since OA sseu config depends on engine > class:instance, validate OA sseu config outside the switch. > > v2: (Ashutosh) > - Clarify commit message > - Use drm_dbg instead of DRM_DEBUG > - Reorder stack variables Reviewed-by: Ashutosh Dixit > > Signed-off-by: Umesh Nerlige Ramappa > --- > drivers/gpu/drm/i915/i915_perf.c | 23 +++++++++++++---------- > 1 file changed, 13 insertions(+), 10 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c > index b0e1acbe90fc..1229f65534e2 100644 > --- a/drivers/gpu/drm/i915/i915_perf.c > +++ b/drivers/gpu/drm/i915/i915_perf.c > @@ -3950,7 +3950,9 @@ static int read_properties_unlocked(struct i915_perf *perf, > u32 n_props, > struct perf_open_properties *props) > { > + struct drm_i915_gem_context_param_sseu user_sseu; > u64 __user *uprop = uprops; > + bool config_sseu = false; > u32 i; > int ret; > > @@ -4079,8 +4081,6 @@ static int read_properties_unlocked(struct i915_perf *perf, > props->hold_preemption = !!value; > break; > case DRM_I915_PERF_PROP_GLOBAL_SSEU: { > - struct drm_i915_gem_context_param_sseu user_sseu; > - > if (GRAPHICS_VER_FULL(perf->i915) >= IP_VER(12, 50)) { > drm_dbg(&perf->i915->drm, > "SSEU config not supported on gfx %x\n", > @@ -4095,14 +4095,7 @@ static int read_properties_unlocked(struct i915_perf *perf, > "Unable to copy global sseu parameter\n"); > return -EFAULT; > } > - > - ret = get_sseu_config(&props->sseu, props->engine, &user_sseu); > - if (ret) { > - drm_dbg(&perf->i915->drm, > - "Invalid SSEU configuration\n"); > - return ret; > - } > - props->has_sseu = true; > + config_sseu = true; > break; > } > case DRM_I915_PERF_PROP_POLL_OA_PERIOD: > @@ -4122,6 +4115,16 @@ static int read_properties_unlocked(struct i915_perf *perf, > uprop += 2; > } > > + if (config_sseu) { > + ret = get_sseu_config(&props->sseu, props->engine, &user_sseu); > + if (ret) { > + drm_dbg(&perf->i915->drm, > + "Invalid SSEU configuration\n"); > + return ret; > + } > + props->has_sseu = true; > + } > + > return 0; > } > > -- > 2.36.1 >