[Intel-xe] [PATCH] drm/xe/reg_sr: Apply limit to register whitelisting
Gustavo Sousa
gustavo.sousa at intel.com
Thu May 25 23:24:06 UTC 2023
If RING_MAX_NONPRIV_SLOTS denotes the maximum number of whitelisting
slots, then it makes sense to refuse going above it.
Signed-off-by: Gustavo Sousa <gustavo.sousa at intel.com>
---
drivers/gpu/drm/xe/xe_reg_sr.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/gpu/drm/xe/xe_reg_sr.c b/drivers/gpu/drm/xe/xe_reg_sr.c
index 0312823101ad..b82f704179a0 100644
--- a/drivers/gpu/drm/xe/xe_reg_sr.c
+++ b/drivers/gpu/drm/xe/xe_reg_sr.c
@@ -231,6 +231,13 @@ void xe_reg_sr_apply_whitelist(struct xe_reg_sr *sr, u32 mmio_base,
p = drm_debug_printer(KBUILD_MODNAME);
xa_for_each(&sr->xa, reg, entry) {
+ if (slot == RING_MAX_NONPRIV_SLOTS) {
+ drm_err(&xe->drm,
+ "Maximum register whitelist slots (%d) reached, refusing to add more\n",
+ RING_MAX_NONPRIV_SLOTS);
+ break;
+ }
+
xe_reg_whitelist_print_entry(&p, 0, reg, entry);
xe_mmio_write32(gt, RING_FORCE_TO_NONPRIV(mmio_base, slot),
reg | entry->set_bits);
--
2.40.1
More information about the Intel-xe
mailing list