drm/xe/rtp: Ensure locking/ref counting for OA whitelists

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: 828a8eaf37 ("drm/xe/oa: Add MMIO trigger support")
Cc: stable@vger.kernel.org # v6.12+
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Link: https://patch.msgid.link/20260615224227.34880-10-ashutosh.dixit@intel.com
(cherry picked from commit 645f1a2589bd4782e25490e5ecc05b7043c36cbf)
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
This commit is contained in:
Ashutosh Dixit 2026-06-15 15:42:27 -07:00 committed by Thomas Hellström
parent 63ddb3ad08
commit ef78e2a22f
2 changed files with 12 additions and 0 deletions

View File

@ -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;
};
/**

View File

@ -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(&gt->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(&gt->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);
}