mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 04:34:03 +02:00
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
This commit is contained in:
parent
f8e6874f46
commit
645f1a2589
|
|
@ -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;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user