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 EFBDFCD8CA7 for ; Mon, 8 Jun 2026 22:36:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B18D910F9F3; Mon, 8 Jun 2026 22:36:32 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="R3zquThi"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) by gabe.freedesktop.org (Postfix) with ESMTPS id A17CD10F9EC for ; Mon, 8 Jun 2026 22:36:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1780958189; x=1812494189; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Q1BYh+PAVUvCw2/7H5Nnzyz+Au0Uh4GXtta3cc/eWEk=; b=R3zquThiDDeAzn6wUFLnuIh1s1YE5hHuOtWrjNrCENGvVcoNMhBiTg2+ zEqTRp4+6rWL6hDK7MYKh0hTevtTeP39+IxtgIZfb+fUhWsXKIX3KnfaB YEv0mHs4duY1Dz88KzDOQD7kvg794vtHFccCTtZtt2XdNE3iQVnUkocN8 PAzkz5XSoIUHpa0uMjdmePYt3BwE4cfhgbcZb/s4+4iegC9HQuLLFaLhk +hWxlYyY1TKGrCbtEX5YhOQAFefXcblckG3z2DKZQnktL5pO/j6RpK6G0 yX2elstum8qLVolG8Wy2qykVju+6/PMl9L+XgbvT2rsNfUT1aELMRp5qm A==; X-CSE-ConnectionGUID: G83k5hiQQbmT46af2OfdDw== X-CSE-MsgGUID: Q8IgYjrWQmWtC+1Rbi5fNQ== X-IronPort-AV: E=McAfee;i="6800,10657,11811"; a="81750982" X-IronPort-AV: E=Sophos;i="6.24,195,1774335600"; d="scan'208";a="81750982" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2026 15:36:29 -0700 X-CSE-ConnectionGUID: OvepYUc+TMqD0UPwwHL8Mw== X-CSE-MsgGUID: PmbHbMSgQrGcXNvx0i2zBA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.24,195,1774335600"; d="scan'208";a="269684765" Received: from orsosgc001.jf.intel.com ([10.88.27.185]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2026 15:36:29 -0700 From: Ashutosh Dixit To: intel-xe@lists.freedesktop.org Cc: Umesh Nerlige Ramappa Subject: [PATCH v2 9/9] drm/xe/rtp: Ensure locking/ref counting for OA whitelists Date: Mon, 8 Jun 2026 15:36:24 -0700 Message-ID: <20260608223624.3711760-10-ashutosh.dixit@intel.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260608223624.3711760-1-ashutosh.dixit@intel.com> References: <20260608223624.3711760-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 65971e1526d0e..7e13697425c1c 100644 --- a/drivers/gpu/drm/xe/xe_reg_whitelist.c +++ b/drivers/gpu/drm/xe/xe_reg_whitelist.c @@ -256,6 +256,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); } @@ -271,6 +275,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