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 0A9B9C61CE7 for ; Fri, 6 Jun 2025 16:42:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D95CB10E135; Fri, 6 Jun 2025 16:42:50 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="RSynn/ZB"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) by gabe.freedesktop.org (Postfix) with ESMTPS id C475610E135 for ; Fri, 6 Jun 2025 16:42:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1749228167; x=1780764167; h=date:message-id:from:to:cc:subject:in-reply-to: references:mime-version; bh=G1g0B8UdUWaisLrilAxsZLmIjVzwrtlrutaZwNu2mso=; b=RSynn/ZBpTxoChZCgSR/5Ao7824Tp90sW2mn8Z0N9sk1fcLuLxNDPvpv nMWVZOhgZQPL2WWXwwHHwEIMnGvnZojeVun/HRIHmmHjIgKSdjBInuMWM DIeVYQh/UELuvQQeulVO9h92Z8nYCz/5cQL0XK6F6F894axMEBKGZOqQ9 ZS1xZAf9ju8hdFyNEzQoDbugm7/5EmO4fE4F84vaRGgIynnE8wop3jjb4 Vcg+m5CO8C0p/MSkEkGDlSyGRbbpiMdl5tRrALvz2v9KdADqoCg2svC/m CESrUuhzwWxMqa1JXNNbZBf23AHuRaira8wEDlQTGPNitJb0nZp3nI5iv A==; X-CSE-ConnectionGUID: y0UGGqDrQOelItH4Sq324w== X-CSE-MsgGUID: 1sEAC/ifS5SslMaagPGGEg== X-IronPort-AV: E=McAfee;i="6800,10657,11456"; a="54011847" X-IronPort-AV: E=Sophos;i="6.16,215,1744095600"; d="scan'208";a="54011847" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 09:42:44 -0700 X-CSE-ConnectionGUID: dvSL0KE+Sa6/egb/oDsUAg== X-CSE-MsgGUID: IPtvhvirS+mzCwLBfRuJnw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.16,215,1744095600"; d="scan'208";a="146839553" Received: from kcgill-mobl.amr.corp.intel.com (HELO adixit-MOBL3.intel.com) ([10.125.48.241]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2025 09:42:41 -0700 Date: Fri, 06 Jun 2025 09:42:40 -0700 Message-ID: <87v7p8u8hr.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: Umesh Nerlige Ramappa Cc: Subject: Re: [PATCH 1/5] drm/xe/oa/uapi: Expose media OA units In-Reply-To: <87zfemt53o.wl-ashutosh.dixit@intel.com> References: <20250603202133.2713863-1-ashutosh.dixit@intel.com> <20250603202133.2713863-2-ashutosh.dixit@intel.com> <87zfemt53o.wl-ashutosh.dixit@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/29.4 (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 X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" On Thu, 05 Jun 2025 11:28:59 -0700, Dixit, Ashutosh wrote: > > On Wed, 04 Jun 2025 16:42:04 -0700, Umesh Nerlige Ramappa wrote: > > Hi Umesh, > > On Tue, Jun 03, 2025 at 01:21:29PM -0700, Ashutosh Dixit wrote: > > > On Xe2+ platforms, media engines are attached to "SCMI" OA media (OAM) > > > units. One or more SCMI OAM units might be present on a platform. In > > > addition there is another OAM unit for global events, called > > > OAM-SAG. Performance metrics for media workloads can be obtained from these > > > OAM units, similar to OAG. > > > > > > Expose these OAM units for userspace to use. OAM-SAG is exposed as an OA > > > unit without any attached engines. > > > > > > Bspec: 70819, 67103, 63844, 72572, 74476, 61284 > > > > > > v2: Fix xe_gt_WARN_ON in __hwe_oam_unit for < 12.7 platforms > > > v3: Return XE_OA_UNIT_INVALID for < 12.7 to indicate no OAM units > > > v4: Move xe_oa_print_oa_units() to separate patch > > > v5: Introduce DRM_XE_OA_UNIT_TYPE_OAM_SAG > > > > > > Signed-off-by: Ashutosh Dixit > > > --- > > > drivers/gpu/drm/xe/xe_oa.c | 68 ++++++++++++++++++++++++++++---------- > > > include/uapi/drm/xe_drm.h | 3 ++ > > > 2 files changed, 54 insertions(+), 17 deletions(-) > > > > > > diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c > > > index fb842fa0552e5..0de0d5a18df74 100644 > > > --- a/drivers/gpu/drm/xe/xe_oa.c > > > +++ b/drivers/gpu/drm/xe/xe_oa.c > > > @@ -43,6 +43,12 @@ > > > #define DEFAULT_POLL_PERIOD_NS (NSEC_PER_SEC / DEFAULT_POLL_FREQUENCY_HZ) > > > #define XE_OA_UNIT_INVALID U32_MAX > > > > > > +enum xe_oam_unit_type { > > > + XE_OAM_UNIT_SAG, > > > + XE_OAM_UNIT_SCMI_0, > > > + XE_OAM_UNIT_SCMI_1, > > > +}; > > > + > > > enum xe_oa_submit_deps { > > > XE_OA_SUBMIT_NO_DEPS, > > > XE_OA_SUBMIT_ADD_DEPS, > > > @@ -1881,6 +1887,7 @@ static bool engine_supports_oa_format(const struct xe_hw_engine *hwe, int type) > > > return type == DRM_XE_OA_FMT_TYPE_OAG || type == DRM_XE_OA_FMT_TYPE_OAR || > > > type == DRM_XE_OA_FMT_TYPE_OAC || type == DRM_XE_OA_FMT_TYPE_PEC; > > > case DRM_XE_OA_UNIT_TYPE_OAM: > > > + case DRM_XE_OA_UNIT_TYPE_OAM_SAG: > > > return type == DRM_XE_OA_FMT_TYPE_OAM || type == DRM_XE_OA_FMT_TYPE_OAM_MPEC; > > > default: > > > return false; > > > @@ -2448,20 +2455,38 @@ int xe_oa_register(struct xe_device *xe) > > > > > > static u32 num_oa_units_per_gt(struct xe_gt *gt) > > > { > > > - return 1; > > > + if (!xe_gt_is_media_type(gt) || GRAPHICS_VER(gt_to_xe(gt)) < 20) > > > + return 1; > > > + else if (!IS_DGFX(gt_to_xe(gt))) > > > + return XE_OAM_UNIT_SCMI_0 + 1; /* SAG + SCMI_0 */ > > > + else > > > + return XE_OAM_UNIT_SCMI_1 + 1; /* SAG + SCMI_0 + SCMI_1 */ > > > } > > > > > > static u32 __hwe_oam_unit(struct xe_hw_engine *hwe) > > > { > > > - if (GRAPHICS_VERx100(gt_to_xe(hwe->gt)) >= 1270) { > > > - /* > > > - * There's 1 SAMEDIA gt and 1 OAM per SAMEDIA gt. All media slices > > > - * within the gt use the same OAM. All MTL/LNL SKUs list 1 SA MEDIA > > > - */ > > > - xe_gt_WARN_ON(hwe->gt, hwe->gt->info.type != XE_GT_TYPE_MEDIA); > > > + if (GRAPHICS_VERx100(gt_to_xe(hwe->gt)) < 1270) > > > + return XE_OA_UNIT_INVALID; > > > > > > + xe_gt_WARN_ON(hwe->gt, !xe_gt_is_media_type(hwe->gt)); > > > + > > > + if (GRAPHICS_VER(gt_to_xe(hwe->gt)) < 20) > > > return 0; > > > - } > > > + /* > > > + * XE_OAM_UNIT_SAG has only GSCCS attached to it, but only on some platforms. Also > > > + * GSCCS cannot be used to submit batches to program the OAM unit. Therefore we don't > > > + * assign an OA unit to GSCCS. This means that XE_OAM_UNIT_SAG is exposed as an OA > > > + * unit without attached engines. Fused off engines can also result in oa_unit's with > > > + * num_engines == 0. OA streams can be opened on all OA units. > > > + */ > > > + else if (hwe->engine_id == XE_HW_ENGINE_GSCCS0) > > > > You could just drop the case XE_ENGINE_CLASS_OTHER in caller > > (__hwe_oa_unit()) and then you dont need the XE_HW_ENGINE_GSCCS0 check > > here. > > Yes, I was doing that initially. But then I changed to this to make it > *explicit* that even when GSC is attached to OAM-SAG, it is not assigned to > any OA unit. Because it is really an exception, as the comment above > explains. > > If you are asking why XE_ENGINE_CLASS_OTHER calls __hwe_oam_unit(), that is > because GSC is present on media GT and is used for HuC authentication > etc. (also related to media). > > If you insist I can change it, but I think it is better to leave as > is. This way it is part of the code, the other way it will be in a comment > (and would be implicit and later people might wonder if it is missed). Let > me know. > > > > > > + return XE_OA_UNIT_INVALID; > > > + else if (!IS_DGFX(gt_to_xe(hwe->gt))) > > > + return XE_OAM_UNIT_SCMI_0; > > > + else if (hwe->class == XE_ENGINE_CLASS_VIDEO_DECODE) > > > + return (hwe->instance / 2 & 0x1) + 1; > > > > should be same as (hwe->instance / 2) + 1; > > To map any possible VCS (VCS0 - VCS7) to OAM-SCMI-0 or OAM-SCMI-1 we need > the '& 0x1'. > > > > > > + else if (hwe->class == XE_ENGINE_CLASS_VIDEO_ENHANCE) > > > + return (hwe->instance & 0x1) + 1; > > > > same here, should be same as (hwe->instance + 1) > > Similarly, to map any possible VECS (VECS0 - VECS3) to OAM-SCMI-0 or 1 we > need the '& 0x1'. So I ended up not making any changes to this patch. Anyway please take another look and let me know what you think. Thanks. -- Ashutosh