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 90373CD4F57 for ; Mon, 18 May 2026 23:47:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4EC4B10EA00; Mon, 18 May 2026 23:47:35 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="imZrIYbu"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id D6ABA10E9FE for ; Mon, 18 May 2026 23:47:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1779148051; x=1810684051; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=DvLv+gpV7wL5OTKkKaAJ5IEzuXg9pRRTCY04ySsL1O0=; b=imZrIYbuBtwLosxBdgWqyrl1gAdMPX5MN+lC656f9qnY3ikyy4atX4HP mCZ9PaGLeNuvDm8xKu6YzJjySdrAQ61mXjTdnvU7byyyN/PuGm2n3MgfU KXbRWZhH1z8xn5/I+T32OvW3Ke67q9idwe54Prk4rEC+vFgTYyC5Ah0kH TDxjWtPalhKP6hcvQvT1Xw6KqEuII6O6jwPK4CbEQwVZiqp5C9rCAjC8V fR+ZAIJ7/yM+hGLxQcYTt+4MvE44+9YT0+vg/Tk2l0z4QHMO1ptICvZhp rfyQwr8ZhQVJLN+wzch2bJgiqR+Pyux1l9+tP5yw+NJPII8hD3XcTkOk3 w==; X-CSE-ConnectionGUID: PDN49t2dSDGzI6fkJrF4GQ== X-CSE-MsgGUID: BpkI+F3rQXaPDxLAGLNVnA== X-IronPort-AV: E=McAfee;i="6800,10657,11790"; a="79866833" X-IronPort-AV: E=Sophos;i="6.23,242,1770624000"; d="scan'208";a="79866833" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2026 16:47:21 -0700 X-CSE-ConnectionGUID: vZjKRd8KSJaBLzIReq7dJg== X-CSE-MsgGUID: 7eX3bixNS7WKJUVxD35V2A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,242,1770624000"; d="scan'208";a="236959328" Received: from orsosgc001.jf.intel.com ([10.88.27.185]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2026 16:47:20 -0700 From: Ashutosh Dixit To: intel-xe@lists.freedesktop.org Subject: [PATCH 9/9] drm/xe/rtp: Ensure locking/ref counting for OA whitelists Date: Mon, 18 May 2026 16:47:16 -0700 Message-ID: <20260518234716.1540123-10-ashutosh.dixit@intel.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260518234716.1540123-1-ashutosh.dixit@intel.com> References: <20260518234716.1540123-1-ashutosh.dixit@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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" Since multiple OA streams might be open in parallel on a gt, ensure that proper locking is in place. Also ensure that OA registers are whitelisted when the first OA stream is open and de-whitelisted after the last OA stream is closed. Signed-off-by: Ashutosh Dixit --- drivers/gpu/drm/xe/xe_oa_types.h | 3 +++ drivers/gpu/drm/xe/xe_reg_whitelist.c | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/drivers/gpu/drm/xe/xe_oa_types.h b/drivers/gpu/drm/xe/xe_oa_types.h index 3d9ec8490899c..e876e9be92ba5 100644 --- a/drivers/gpu/drm/xe/xe_oa_types.h +++ b/drivers/gpu/drm/xe/xe_oa_types.h @@ -126,6 +126,9 @@ struct xe_oa_gt { /** @oa_unit: array of oa_units */ struct xe_oa_unit *oa_unit; + + /** @whitelist_count: number of open streams for which oa registers are whitelisted */ + u32 whitelist_count; }; /** diff --git a/drivers/gpu/drm/xe/xe_reg_whitelist.c b/drivers/gpu/drm/xe/xe_reg_whitelist.c index 50b34c5008df7..1b72f0d2935a2 100644 --- a/drivers/gpu/drm/xe/xe_reg_whitelist.c +++ b/drivers/gpu/drm/xe/xe_reg_whitelist.c @@ -255,6 +255,10 @@ void xe_reg_whitelist_oa_regs(struct xe_gt *gt) struct xe_hw_engine *hwe; enum xe_hw_engine_id id; + lockdep_assert_held(>->oa.gt_lock); + if (gt->oa.whitelist_count++) + return; + for_each_hw_engine(hwe, gt, id) __whitelist_oa_regs(hwe, true); } @@ -270,6 +274,11 @@ void xe_reg_dewhitelist_oa_regs(struct xe_gt *gt) struct xe_hw_engine *hwe; enum xe_hw_engine_id id; + lockdep_assert_held(>->oa.gt_lock); + xe_assert(gt_to_xe(gt), gt->oa.whitelist_count); + if (--gt->oa.whitelist_count) + return; + for_each_hw_engine(hwe, gt, id) __whitelist_oa_regs(hwe, false); } -- 2.54.0