Commit 4c0be90e authored by Himal Prasad Ghimiray's avatar Himal Prasad Ghimiray Committed by Rodrigo Vivi

drm/xe: Fix the warning conditions

The maximum timeout display uses in xe_pcode_request is 3 msec, add the
warning in cases the function is misused with higher timeouts.

Add a warning if pcode_try_request is not passed the timeout parameter
greater than 0.

Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: default avatarHimal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Reviewed-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240508152216.3263109-3-himal.prasad.ghimiray@intel.comSigned-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent c81858eb
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <drm/drm_managed.h> #include <drm/drm_managed.h>
#include "xe_assert.h"
#include "xe_device.h" #include "xe_device.h"
#include "xe_gt.h" #include "xe_gt.h"
#include "xe_mmio.h" #include "xe_mmio.h"
...@@ -124,6 +125,8 @@ static int pcode_try_request(struct xe_gt *gt, u32 mbox, ...@@ -124,6 +125,8 @@ static int pcode_try_request(struct xe_gt *gt, u32 mbox,
{ {
int slept, wait = 10; int slept, wait = 10;
xe_gt_assert(gt, timeout_us > 0);
for (slept = 0; slept < timeout_us; slept += wait) { for (slept = 0; slept < timeout_us; slept += wait) {
if (locked) if (locked)
*status = pcode_mailbox_rw(gt, mbox, &request, NULL, 1, true, *status = pcode_mailbox_rw(gt, mbox, &request, NULL, 1, true,
...@@ -169,6 +172,8 @@ int xe_pcode_request(struct xe_gt *gt, u32 mbox, u32 request, ...@@ -169,6 +172,8 @@ int xe_pcode_request(struct xe_gt *gt, u32 mbox, u32 request,
u32 status; u32 status;
int ret; int ret;
xe_gt_assert(gt, timeout_base_ms <= 3);
mutex_lock(&gt->pcode.lock); mutex_lock(&gt->pcode.lock);
ret = pcode_try_request(gt, mbox, request, reply_mask, reply, &status, ret = pcode_try_request(gt, mbox, request, reply_mask, reply, &status,
...@@ -188,7 +193,6 @@ int xe_pcode_request(struct xe_gt *gt, u32 mbox, u32 request, ...@@ -188,7 +193,6 @@ int xe_pcode_request(struct xe_gt *gt, u32 mbox, u32 request,
*/ */
drm_err(&gt_to_xe(gt)->drm, drm_err(&gt_to_xe(gt)->drm,
"PCODE timeout, retrying with preemption disabled\n"); "PCODE timeout, retrying with preemption disabled\n");
drm_WARN_ON_ONCE(&gt_to_xe(gt)->drm, timeout_base_ms > 1);
preempt_disable(); preempt_disable();
ret = pcode_try_request(gt, mbox, request, reply_mask, reply, &status, ret = pcode_try_request(gt, mbox, request, reply_mask, reply, &status,
true, 50 * 1000, true); true, 50 * 1000, true);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment