drm/xe: Include additional info on failed force-wake operation

For debug purposes it might be useful to look at the values of the
force-wake ack registers in case wake/sleep operations failures.

Move xe_gt_notice() from the caller to the helper function, where
we have the latest value of force-wake ack register available.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240611163537.1944-4-michal.wajdeczko@intel.com
This commit is contained in:
Michal Wajdeczko 2024-06-11 18:35:35 +02:00
parent d960c58010
commit f80437eb25

View File

@ -97,9 +97,17 @@ static void domain_wake(struct xe_gt *gt, struct xe_force_wake_domain *domain)
static int domain_wake_wait(struct xe_gt *gt, static int domain_wake_wait(struct xe_gt *gt,
struct xe_force_wake_domain *domain) struct xe_force_wake_domain *domain)
{ {
return xe_mmio_wait32(gt, domain->reg_ack, domain->val, domain->val, u32 value;
XE_FORCE_WAKE_ACK_TIMEOUT_MS * USEC_PER_MSEC, int ret;
NULL, true);
ret = xe_mmio_wait32(gt, domain->reg_ack, domain->val, domain->val,
XE_FORCE_WAKE_ACK_TIMEOUT_MS * USEC_PER_MSEC,
&value, true);
if (ret)
xe_gt_notice(gt, "Force wake domain %d failed to ack wake (%pe) reg[%#x] = %#x\n",
domain->id, ERR_PTR(ret), domain->reg_ack.addr, value);
return ret;
} }
static void domain_sleep(struct xe_gt *gt, struct xe_force_wake_domain *domain) static void domain_sleep(struct xe_gt *gt, struct xe_force_wake_domain *domain)
@ -110,9 +118,17 @@ static void domain_sleep(struct xe_gt *gt, struct xe_force_wake_domain *domain)
static int domain_sleep_wait(struct xe_gt *gt, static int domain_sleep_wait(struct xe_gt *gt,
struct xe_force_wake_domain *domain) struct xe_force_wake_domain *domain)
{ {
return xe_mmio_wait32(gt, domain->reg_ack, domain->val, 0, u32 value;
XE_FORCE_WAKE_ACK_TIMEOUT_MS * USEC_PER_MSEC, int ret;
NULL, true);
ret = xe_mmio_wait32(gt, domain->reg_ack, domain->val, 0,
XE_FORCE_WAKE_ACK_TIMEOUT_MS * USEC_PER_MSEC,
&value, true);
if (ret)
xe_gt_notice(gt, "Force wake domain %d failed to ack sleep (%pe) reg[%#x] = %#x\n",
domain->id, ERR_PTR(ret), domain->reg_ack.addr, value);
return ret;
} }
#define for_each_fw_domain_masked(domain__, mask__, fw__, tmp__) \ #define for_each_fw_domain_masked(domain__, mask__, fw__, tmp__) \
@ -128,7 +144,7 @@ int xe_force_wake_get(struct xe_force_wake *fw,
struct xe_force_wake_domain *domain; struct xe_force_wake_domain *domain;
enum xe_force_wake_domains tmp, woken = 0; enum xe_force_wake_domains tmp, woken = 0;
unsigned long flags; unsigned long flags;
int ret, ret2 = 0; int ret = 0;
spin_lock_irqsave(&fw->lock, flags); spin_lock_irqsave(&fw->lock, flags);
for_each_fw_domain_masked(domain, domains, fw, tmp) { for_each_fw_domain_masked(domain, domains, fw, tmp) {
@ -138,16 +154,12 @@ int xe_force_wake_get(struct xe_force_wake *fw,
} }
} }
for_each_fw_domain_masked(domain, woken, fw, tmp) { for_each_fw_domain_masked(domain, woken, fw, tmp) {
ret = domain_wake_wait(gt, domain); ret |= domain_wake_wait(gt, domain);
ret2 |= ret;
if (ret)
xe_gt_notice(gt, "Force wake domain (%d) failed to ack wake, ret=%d\n",
domain->id, ret);
} }
fw->awake_domains |= woken; fw->awake_domains |= woken;
spin_unlock_irqrestore(&fw->lock, flags); spin_unlock_irqrestore(&fw->lock, flags);
return ret2; return ret;
} }
int xe_force_wake_put(struct xe_force_wake *fw, int xe_force_wake_put(struct xe_force_wake *fw,
@ -157,7 +169,7 @@ int xe_force_wake_put(struct xe_force_wake *fw,
struct xe_force_wake_domain *domain; struct xe_force_wake_domain *domain;
enum xe_force_wake_domains tmp, sleep = 0; enum xe_force_wake_domains tmp, sleep = 0;
unsigned long flags; unsigned long flags;
int ret, ret2 = 0; int ret = 0;
spin_lock_irqsave(&fw->lock, flags); spin_lock_irqsave(&fw->lock, flags);
for_each_fw_domain_masked(domain, domains, fw, tmp) { for_each_fw_domain_masked(domain, domains, fw, tmp) {
@ -167,14 +179,10 @@ int xe_force_wake_put(struct xe_force_wake *fw,
} }
} }
for_each_fw_domain_masked(domain, sleep, fw, tmp) { for_each_fw_domain_masked(domain, sleep, fw, tmp) {
ret = domain_sleep_wait(gt, domain); ret |= domain_sleep_wait(gt, domain);
ret2 |= ret;
if (ret)
xe_gt_notice(gt, "Force wake domain (%d) failed to ack sleep, ret=%d\n",
domain->id, ret);
} }
fw->awake_domains &= ~sleep; fw->awake_domains &= ~sleep;
spin_unlock_irqrestore(&fw->lock, flags); spin_unlock_irqrestore(&fw->lock, flags);
return ret2; return ret;
} }