Lines Matching full:domain
34 struct xe_force_wake_domain *domain = &fw->domains[id]; in init_domain() local
36 domain->id = id; in init_domain()
37 domain->reg_ctl = reg; in init_domain()
38 domain->reg_ack = ack; in init_domain()
39 domain->val = FORCEWAKE_MT(FORCEWAKE_KERNEL); in init_domain()
40 domain->mask = FORCEWAKE_MT_MASK(FORCEWAKE_KERNEL); in init_domain()
96 static void __domain_ctl(struct xe_gt *gt, struct xe_force_wake_domain *domain, bool wake) in __domain_ctl() argument
101 xe_mmio_write32(>->mmio, domain->reg_ctl, domain->mask | (wake ? domain->val : 0)); in __domain_ctl()
104 static int __domain_wait(struct xe_gt *gt, struct xe_force_wake_domain *domain, bool wake) in __domain_wait() argument
112 ret = xe_mmio_wait32(>->mmio, domain->reg_ack, domain->val, wake ? domain->val : 0, in __domain_wait()
116 xe_gt_err(gt, "Force wake domain %d failed to ack %s (%pe) reg[%#x] = %#x\n", in __domain_wait()
117 domain->id, str_wake_sleep(wake), ERR_PTR(ret), in __domain_wait()
118 domain->reg_ack.addr, value); in __domain_wait()
121 "Force wake domain %d: %s. MMIO unreliable (forcewake register returns 0xFFFFFFFF)!\n", in __domain_wait()
122 domain->id, str_wake_sleep(wake)); in __domain_wait()
129 static void domain_wake(struct xe_gt *gt, struct xe_force_wake_domain *domain) in domain_wake() argument
131 __domain_ctl(gt, domain, true); in domain_wake()
135 struct xe_force_wake_domain *domain) in domain_wake_wait() argument
137 return __domain_wait(gt, domain, true); in domain_wake_wait()
140 static void domain_sleep(struct xe_gt *gt, struct xe_force_wake_domain *domain) in domain_sleep() argument
142 __domain_ctl(gt, domain, false); in domain_sleep()
146 struct xe_force_wake_domain *domain) in domain_sleep_wait() argument
148 return __domain_wait(gt, domain, false); in domain_sleep_wait()
158 * xe_force_wake_get() : Increase the domain refcount
163 * If requested domain is XE_FORCEWAKE_ALL then only applicable/initialized
165 * to check returned ref if it includes any specific domain by using
176 struct xe_force_wake_domain *domain; in xe_force_wake_get() local
187 for_each_fw_domain_masked(domain, ref_rqst, fw, tmp) { in xe_force_wake_get()
188 if (!domain->ref++) { in xe_force_wake_get()
189 awake_rqst |= BIT(domain->id); in xe_force_wake_get()
190 domain_wake(gt, domain); in xe_force_wake_get()
192 ref_incr |= BIT(domain->id); in xe_force_wake_get()
194 for_each_fw_domain_masked(domain, awake_rqst, fw, tmp) { in xe_force_wake_get()
195 if (domain_wake_wait(gt, domain) == 0) { in xe_force_wake_get()
196 fw->awake_domains |= BIT(domain->id); in xe_force_wake_get()
198 awake_failed |= BIT(domain->id); in xe_force_wake_get()
199 --domain->ref; in xe_force_wake_get()
205 xe_gt_WARN(gt, awake_failed, "Forcewake domain%s %#x failed to acknowledge awake request\n", in xe_force_wake_get()
215 * xe_force_wake_put - Decrement the refcount and put domain to sleep if refcount becomes 0
220 * refcount for any of the specified domain reaches 0, it puts the domain to sleep
221 * and waits for acknowledgment for domain to sleep within 50 milisec timeout.
222 * Warns in case of timeout of ack from domain.
227 struct xe_force_wake_domain *domain; in xe_force_wake_put() local
243 for_each_fw_domain_masked(domain, fw_ref, fw, tmp) { in xe_force_wake_put()
244 xe_gt_assert(gt, domain->ref); in xe_force_wake_put()
246 if (!--domain->ref) { in xe_force_wake_put()
247 sleep |= BIT(domain->id); in xe_force_wake_put()
248 domain_sleep(gt, domain); in xe_force_wake_put()
251 for_each_fw_domain_masked(domain, sleep, fw, tmp) { in xe_force_wake_put()
252 if (domain_sleep_wait(gt, domain) == 0) in xe_force_wake_put()
253 fw->awake_domains &= ~BIT(domain->id); in xe_force_wake_put()
255 ack_fail |= BIT(domain->id); in xe_force_wake_put()
259 xe_gt_WARN(gt, ack_fail, "Forcewake domain%s %#x failed to acknowledge sleep request\n", in xe_force_wake_put()