Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 89ED3352038 for ; Wed, 5 Aug 2026 02:46:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785897988; cv=none; b=S19HltIDBHqeSiB+ebK1BqqPGQiYcqPoHWaIxwQdYT83klgaqFL0x7B1HKCjlyEHBLuWncR+9ZgE6fBo4QsZs5bYT8oTHPVnP127M4ckVKuTGyLRXHXnEueIX8tfriccSeaNxkb466nl8E0IsBdEubinLmLbYpZFFr7ALiD2fTA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785897988; c=relaxed/simple; bh=7DSc25FkZpxr26sBpDrz59W8rG18G9Ewn97tPTacDjM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lxWs6cdFjfcUE0iOfrGb+U9dJDdvOgRk2Zrbio6Hm3DTGhAIreMawWtE5bbKmdMdKSN2Kh9j7GZxyptLKW1i9W5nagH2EZgEEHj1vmPWQfSgE8oEb0A1CqdycsvZilkCQQFZe6p+I7XS7DabZNvs0MdauEkEwyTgVdAQUSi+aa0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Vmr9r+cc; arc=none smtp.client-ip=192.198.163.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Vmr9r+cc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1785897988; x=1817433988; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7DSc25FkZpxr26sBpDrz59W8rG18G9Ewn97tPTacDjM=; b=Vmr9r+ccdJHUC5QG/6nItaW3RL6t8B2T6dwyNbnSFCziAthDcmr65l7g HzSRLfKsFVHmmmElF7ve3Npw5/hJDKIjklYDS3JYlx+lTKhWEqtE/dfDS mDdiQJ7qfC/5Rp7EqGFLZlCmTD9Mc7ofgUGSEuUiItBHv56I/az6dRHeX JuAXWkixHe4ypM55EoaI9j+62XvGJAOMJf69wrc7TClL0pW5f46GK8JOI bBO+92VNOmVWyS2CK0/HWGuABwLSDaVyC2RFQOnWgx5XLk3dZb255z5R1 gaAwIIGPphP2mhjhl3/TwLtfvJ+sJ8HtF/Lx7eXBbWLiKnj2zKMxSeqco Q==; X-CSE-ConnectionGUID: 4KkNy71qQLqTlkIwrhcsAw== X-CSE-MsgGUID: UGjcIT3/RlO0tJzRK5WIoA== X-IronPort-AV: E=McAfee;i="6800,10657,11865"; a="85586062" X-IronPort-AV: E=Sophos;i="6.25,205,1779174000"; d="scan'208";a="85586062" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Aug 2026 19:46:21 -0700 X-CSE-ConnectionGUID: ea4345LhTVONILhst4VKqQ== X-CSE-MsgGUID: we2amrfCRqORLY4kLXv9BA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,205,1779174000"; d="scan'208";a="265925521" Received: from orsosgc001.jf.intel.com ([10.88.27.185]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Aug 2026 19:46:20 -0700 From: Ashutosh Dixit To: stable@vger.kernel.org Cc: Sasha Levin Subject: [PATCH 6.18.y v2 10/10] drm/xe/rtp: Ensure locking/ref counting for OA whitelists Date: Tue, 4 Aug 2026 19:46:14 -0700 Message-ID: <20260805024614.3406679-11-ashutosh.dixit@intel.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260805024614.3406679-1-ashutosh.dixit@intel.com> References: <20260805024614.3406679-1-ashutosh.dixit@intel.com> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit [ Upstream commit ef78e2a22f72c892fd6663f0760abd208d49a3e2 ] 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. Fixes: 828a8eaf37c3 ("drm/xe/oa: Add MMIO trigger support") Cc: stable@vger.kernel.org # v6.12+ Signed-off-by: Ashutosh Dixit Reviewed-by: Umesh Nerlige Ramappa Link: https://patch.msgid.link/20260615224227.34880-10-ashutosh.dixit@intel.com --- drivers/gpu/drm/xe/xe_oa_types.h | 3 +++ drivers/gpu/drm/xe/xe_reg_whitelist.c | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/drivers/gpu/drm/xe/xe_oa_types.h b/drivers/gpu/drm/xe/xe_oa_types.h index daf701b5d48b9..48f9520f560c2 100644 --- a/drivers/gpu/drm/xe/xe_oa_types.h +++ b/drivers/gpu/drm/xe/xe_oa_types.h @@ -125,6 +125,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 e77f50da4a268..eb1d6f52f75fb 100644 --- a/drivers/gpu/drm/xe/xe_reg_whitelist.c +++ b/drivers/gpu/drm/xe/xe_reg_whitelist.c @@ -9,6 +9,7 @@ #include "regs/xe_gt_regs.h" #include "regs/xe_oa_regs.h" #include "regs/xe_regs.h" +#include "xe_assert.h" #include "xe_gt.h" #include "xe_gt_printk.h" #include "xe_platform_types.h" @@ -187,6 +188,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); } @@ -202,6 +207,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