Lines Matching refs:sr
33 struct xe_reg_sr *sr = arg; in reg_sr_fini() local
35 xa_destroy(&sr->xa); in reg_sr_fini()
36 kfree(sr->pool.arr); in reg_sr_fini()
37 memset(&sr->pool, 0, sizeof(sr->pool)); in reg_sr_fini()
40 int xe_reg_sr_init(struct xe_reg_sr *sr, const char *name, struct xe_device *xe) in xe_reg_sr_init() argument
42 xa_init(&sr->xa); in xe_reg_sr_init()
43 memset(&sr->pool, 0, sizeof(sr->pool)); in xe_reg_sr_init()
44 sr->pool.grow_step = XE_REG_SR_GROW_STEP_DEFAULT; in xe_reg_sr_init()
45 sr->name = name; in xe_reg_sr_init()
47 return drmm_add_action_or_reset(&xe->drm, reg_sr_fini, sr); in xe_reg_sr_init()
51 static struct xe_reg_sr_entry *alloc_entry(struct xe_reg_sr *sr) in alloc_entry() argument
53 if (sr->pool.used == sr->pool.allocated) { in alloc_entry()
56 arr = krealloc_array(sr->pool.arr, in alloc_entry()
57 ALIGN(sr->pool.allocated + 1, sr->pool.grow_step), in alloc_entry()
62 sr->pool.arr = arr; in alloc_entry()
63 sr->pool.allocated += sr->pool.grow_step; in alloc_entry()
66 return &sr->pool.arr[sr->pool.used++]; in alloc_entry()
86 static void reg_sr_inc_error(struct xe_reg_sr *sr) in reg_sr_inc_error() argument
89 sr->errors++; in reg_sr_inc_error()
93 int xe_reg_sr_add(struct xe_reg_sr *sr, in xe_reg_sr_add() argument
98 struct xe_reg_sr_entry *pentry = xa_load(&sr->xa, idx); in xe_reg_sr_add()
114 pentry = alloc_entry(sr); in xe_reg_sr_add()
121 ret = xa_err(xa_store(&sr->xa, idx, pentry, GFP_KERNEL)); in xe_reg_sr_add()
134 reg_sr_inc_error(sr); in xe_reg_sr_add()
186 void xe_reg_sr_apply_mmio(struct xe_reg_sr *sr, struct xe_gt *gt) in xe_reg_sr_apply_mmio() argument
192 if (xa_empty(&sr->xa)) in xe_reg_sr_apply_mmio()
195 xe_gt_dbg(gt, "Applying %s save-restore MMIOs\n", sr->name); in xe_reg_sr_apply_mmio()
201 xa_for_each(&sr->xa, reg, entry) in xe_reg_sr_apply_mmio()
215 struct xe_reg_sr *sr = &hwe->reg_whitelist; in xe_reg_sr_apply_whitelist() local
225 if (xa_empty(&sr->xa)) in xe_reg_sr_apply_whitelist()
228 drm_dbg(&xe->drm, "Whitelisting %s registers\n", sr->name); in xe_reg_sr_apply_whitelist()
235 xa_for_each(&sr->xa, reg, entry) { in xe_reg_sr_apply_whitelist()
270 void xe_reg_sr_dump(struct xe_reg_sr *sr, struct drm_printer *p) in xe_reg_sr_dump() argument
275 if (!sr->name || xa_empty(&sr->xa)) in xe_reg_sr_dump()
278 drm_printf(p, "%s\n", sr->name); in xe_reg_sr_dump()
279 xa_for_each(&sr->xa, reg, entry) in xe_reg_sr_dump()