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()
102 static void __domain_ctl(struct xe_gt *gt, struct xe_force_wake_domain *domain, bool wake) in __domain_ctl() argument
107 xe_mmio_write32(>->mmio, domain->reg_ctl, domain->mask | (wake ? domain->val : 0)); in __domain_ctl()
110 static int __domain_wait(struct xe_gt *gt, struct xe_force_wake_domain *domain, bool wake) in __domain_wait() argument
118 ret = xe_mmio_wait32(>->mmio, domain->reg_ack, domain->val, wake ? domain->val : 0, in __domain_wait()
122 xe_gt_err(gt, "Force wake domain %d failed to ack %s (%pe) reg[%#x] = %#x\n", in __domain_wait()
123 domain->id, str_wake_sleep(wake), ERR_PTR(ret), in __domain_wait()
124 domain->reg_ack.addr, value); in __domain_wait()
127 "Force wake domain %d: %s. MMIO unreliable (forcewake register returns 0xFFFFFFFF)!\n", in __domain_wait()
128 domain->id, str_wake_sleep(wake)); in __domain_wait()
135 static void domain_wake(struct xe_gt *gt, struct xe_force_wake_domain *domain) in domain_wake() argument
137 __domain_ctl(gt, domain, true); in domain_wake()
141 struct xe_force_wake_domain *domain) in domain_wake_wait() argument
143 return __domain_wait(gt, domain, true); in domain_wake_wait()
146 static void domain_sleep(struct xe_gt *gt, struct xe_force_wake_domain *domain) in domain_sleep() argument
148 __domain_ctl(gt, domain, false); in domain_sleep()
152 struct xe_force_wake_domain *domain) in domain_sleep_wait() argument
154 return __domain_wait(gt, domain, false); in domain_sleep_wait()
164 * xe_force_wake_get() : Increase the domain refcount
169 * If requested domain is XE_FORCEWAKE_ALL then only applicable/initialized
171 * to check returned ref if it includes any specific domain by using
182 struct xe_force_wake_domain *domain; in xe_force_wake_get() local
193 for_each_fw_domain_masked(domain, ref_rqst, fw, tmp) { in xe_force_wake_get()
194 if (!domain->ref++) { in xe_force_wake_get()
195 awake_rqst |= BIT(domain->id); in xe_force_wake_get()
196 domain_wake(gt, domain); in xe_force_wake_get()
198 ref_incr |= BIT(domain->id); in xe_force_wake_get()
200 for_each_fw_domain_masked(domain, awake_rqst, fw, tmp) { in xe_force_wake_get()
201 if (domain_wake_wait(gt, domain) == 0) { in xe_force_wake_get()
202 fw->awake_domains |= BIT(domain->id); in xe_force_wake_get()
204 awake_failed |= BIT(domain->id); in xe_force_wake_get()
205 --domain->ref; in xe_force_wake_get()
211 xe_gt_WARN(gt, awake_failed, "Forcewake domain%s %#x failed to acknowledge awake request\n", in xe_force_wake_get()
221 * xe_force_wake_put - Decrement the refcount and put domain to sleep if refcount becomes 0
226 * refcount for any of the specified domain reaches 0, it puts the domain to sleep
227 * and waits for acknowledgment for domain to sleep within 50 milisec timeout.
228 * Warns in case of timeout of ack from domain.
233 struct xe_force_wake_domain *domain; in xe_force_wake_put() local
249 for_each_fw_domain_masked(domain, fw_ref, fw, tmp) { in xe_force_wake_put()
250 xe_gt_assert(gt, domain->ref); in xe_force_wake_put()
252 if (!--domain->ref) { in xe_force_wake_put()
253 sleep |= BIT(domain->id); in xe_force_wake_put()
254 domain_sleep(gt, domain); in xe_force_wake_put()
257 for_each_fw_domain_masked(domain, sleep, fw, tmp) { in xe_force_wake_put()
258 if (domain_sleep_wait(gt, domain) == 0) in xe_force_wake_put()
259 fw->awake_domains &= ~BIT(domain->id); in xe_force_wake_put()
261 ack_fail |= BIT(domain->id); in xe_force_wake_put()
265 xe_gt_WARN(gt, ack_fail, "Forcewake domain%s %#x failed to acknowledge sleep request\n", in xe_force_wake_put()