static inline void fw_domain_wait_ack(const struct intel_uncore_forcewake_domain *d) { if (wait_for_atomic((__raw_i915_read32(d->i915, d->reg_ack) & FORCEWAKE_KERNEL), FORCEWAKE_ACK_TIMEOUT_MS)) DRM_ERROR("%s: timed out waiting for forcewake ack request.\n", intel_uncore_forcewake_domain_to_str(d->id)); }
for_each_engine(engine, i915, id) { i915_reg_t mmio = _MMIO(engine->mmio_base + r->offset); u32 __iomem *reg = uncore->regs + engine->mmio_base + r->offset; enum forcewake_domains fw_domains; u32 val; if (!engine->default_state) continue; fw_domains = intel_uncore_forcewake_for_reg(uncore, mmio, FW_REG_READ); if (!fw_domains) continue; for_each_fw_domain_masked(domain, fw_domains, uncore, tmp) { if (!domain->wake_count) continue; pr_err("fw_domain %s still active, aborting test!\n", intel_uncore_forcewake_domain_to_str(domain->id)); err = -EINVAL; goto out_rpm; } intel_uncore_forcewake_get(uncore, fw_domains); val = readl(reg); intel_uncore_forcewake_put(uncore, fw_domains); /* Flush the forcewake release (delayed onto a timer) */ for_each_fw_domain_masked(domain, fw_domains, uncore, tmp) { smp_store_mb(domain->active, false); if (hrtimer_cancel(&domain->timer)) intel_uncore_fw_release_timer(&domain->timer); preempt_disable(); err = wait_ack_clear(domain, FORCEWAKE_KERNEL); preempt_enable(); if (err) { pr_err("Failed to clear fw_domain %s\n", intel_uncore_forcewake_domain_to_str(domain->id)); goto out_rpm; } }