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 1264DC678D5 for ; Wed, 8 Mar 2023 01:45:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 505CD892D2; Wed, 8 Mar 2023 01:45:52 +0000 (UTC) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id A43A710E0B4 for ; Wed, 8 Mar 2023 01:45:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678239949; x=1709775949; h=date:message-id:from:to:cc:subject:in-reply-to: references:mime-version; bh=HwSaamJkiOPTSz0aH2CnRwKbhC9bktD5j1B446+iQX8=; b=TzvxeFDGMSoa0S0CLsbMqJ/QeFlahfLCNiRU7Sdps1GXtFdP71R6gglQ v7nxS7mgo16ruB7GYXyrRL3sXPo9Ywk+LeW9W4Kcjig7p8dCd48xbK/FJ pSVHWigro2tSbJgn2oTLlwbGhFWR/ZtbZ6B11BfJJoFKRktmZeQuD/Jj+ WJgcUBDDckmB3Yycda/e1Y/dRVQv+fR2lmsmOlBRwxdbOgY1XllxdrqGo o+4CMUzwolXQcy9+w4KecqvJkadsX5/lxN6+zPgeM9oJ0FFe5V2TpdAUs NJQ3SJdf2knZrmoF9sBj7hOHL17/L5ZPQe73+kGA52k2D6z2JeN7MJ/kO w==; X-IronPort-AV: E=McAfee;i="6500,9779,10642"; a="363662599" X-IronPort-AV: E=Sophos;i="5.98,242,1673942400"; d="scan'208";a="363662599" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Mar 2023 17:45:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10642"; a="670137810" X-IronPort-AV: E=Sophos;i="5.98,242,1673942400"; d="scan'208";a="670137810" Received: from adixit-mobl.amr.corp.intel.com (HELO adixit-arch.intel.com) ([10.209.87.208]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Mar 2023 17:45:48 -0800 Date: Tue, 07 Mar 2023 17:45:48 -0800 Message-ID: <87lek8m2wj.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: Umesh Nerlige Ramappa In-Reply-To: <20230307201611.773103-9-umesh.nerlige.ramappa@intel.com> References: <20230307201611.773103-1-umesh.nerlige.ramappa@intel.com> <20230307201611.773103-9-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 v4 8/9] drm/i915/perf: Add engine class instance parameters to perf 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, 07 Mar 2023 12:16:10 -0800, Umesh Nerlige Ramappa wrote: > Hi Umesh, > + /* Defaults when class:instance is not passed */ > + class = I915_ENGINE_CLASS_RENDER; > + instance = 0; > + > for (i = 0; i < n_props; i++) { > u64 oa_period, oa_freq_hz; > u64 id, value; > @@ -4174,7 +4156,13 @@ static int read_properties_unlocked(struct i915_perf *perf, > } > props->poll_oa_period = value; > break; > - case DRM_I915_PERF_PROP_MAX: > + case DRM_I915_PERF_PROP_OA_ENGINE_CLASS: > + class = (u8)value; > + break; > + case DRM_I915_PERF_PROP_OA_ENGINE_INSTANCE: > + instance = (u8)value; > + break; I am wondering since this is uapi we should make it robust. So if the user passes either class or instance he must pass both and we should check for that. If only one is passed we should not implicitly assume the other as we are doing here (if only instance is passed here we will assume RCS and if only class is passed we will assume instance 0). I think making this explicit will avoid confusion later. Thoughts? > + default: > MISSING_CASE(id); > return -EINVAL; > } > @@ -4182,6 +4170,21 @@ static int read_properties_unlocked(struct i915_perf *perf, > uprop += 2; > } > > + props->engine = intel_engine_lookup_user(perf->i915, class, instance); > + if (!props->engine) { > + drm_dbg(&perf->i915->drm, > + "OA engine class and instance invalid %d:%d\n", > + class, instance); > + return -EINVAL; > + } Thanks. -- Ashutosh