Skip to content

Commit 4597777

Browse files
committed
drm/xe/vf: Don't try to trigger a full GT reset if VF
VFs don't have access to the GDRST(0x941c) register that driver uses to reset a GT. Attempt to trigger a reset using debugfs: $ cat /sys/kernel/debug/dri/0000:00:02.1/gt0/force_reset or due to a hang condition detected by the driver leads to: [ ] xe 0000:00:02.1: [drm] GT0: trying reset from force_reset [xe] [ ] xe 0000:00:02.1: [drm] GT0: reset queued [ ] xe 0000:00:02.1: [drm] GT0: reset started [ ] ------------[ cut here ]------------ [ ] xe 0000:00:02.1: [drm] GT0: VF is trying to write 0x1 to an inaccessible register 0x941c+0x0 [ ] WARNING: CPU: 3 PID: 3069 at drivers/gpu/drm/xe/xe_gt_sriov_vf.c:996 xe_gt_sriov_vf_write32+0xc6/0x580 [xe] [ ] RIP: 0010:xe_gt_sriov_vf_write32+0xc6/0x580 [xe] [ ] Call Trace: [ ] <TASK> [ ] ? show_regs+0x6c/0x80 [ ] ? __warn+0x93/0x1c0 [ ] ? xe_gt_sriov_vf_write32+0xc6/0x580 [xe] [ ] ? report_bug+0x182/0x1b0 [ ] ? handle_bug+0x6e/0xb0 [ ] ? exc_invalid_op+0x18/0x80 [ ] ? asm_exc_invalid_op+0x1b/0x20 [ ] ? xe_gt_sriov_vf_write32+0xc6/0x580 [xe] [ ] ? xe_gt_sriov_vf_write32+0xc6/0x580 [xe] [ ] ? xe_gt_tlb_invalidation_reset+0xef/0x110 [xe] [ ] ? __mutex_unlock_slowpath+0x41/0x2e0 [ ] xe_mmio_write32+0x64/0x150 [xe] [ ] do_gt_reset+0x2f/0xa0 [xe] [ ] gt_reset_worker+0x14e/0x1e0 [xe] [ ] process_one_work+0x21c/0x740 [ ] worker_thread+0x1db/0x3c0 Fix that by sending H2G VF_RESET(0x5507) action instead. Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/4078 Signed-off-by: Michal Wajdeczko <[email protected]> Reviewed-by: Lucas De Marchi <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 78d5d1e commit 4597777

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

drivers/gpu/drm/xe/xe_gt.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "xe_gt_pagefault.h"
3333
#include "xe_gt_printk.h"
3434
#include "xe_gt_sriov_pf.h"
35+
#include "xe_gt_sriov_vf.h"
3536
#include "xe_gt_sysfs.h"
3637
#include "xe_gt_tlb_invalidation.h"
3738
#include "xe_gt_topology.h"
@@ -679,6 +680,9 @@ static int do_gt_reset(struct xe_gt *gt)
679680
{
680681
int err;
681682

683+
if (IS_SRIOV_VF(gt_to_xe(gt)))
684+
return xe_gt_sriov_vf_reset(gt);
685+
682686
xe_gsc_wa_14015076503(gt, true);
683687

684688
xe_mmio_write32(&gt->mmio, GDRST, GRDOM_FULL);

drivers/gpu/drm/xe/xe_gt_sriov_vf.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,22 @@ static int vf_reset_guc_state(struct xe_gt *gt)
5858
return err;
5959
}
6060

61+
/**
62+
* xe_gt_sriov_vf_reset - Reset GuC VF internal state.
63+
* @gt: the &xe_gt
64+
*
65+
* It requires functional `GuC MMIO based communication`_.
66+
*
67+
* Return: 0 on success or a negative error code on failure.
68+
*/
69+
int xe_gt_sriov_vf_reset(struct xe_gt *gt)
70+
{
71+
if (!xe_device_uc_enabled(gt_to_xe(gt)))
72+
return -ENODEV;
73+
74+
return vf_reset_guc_state(gt);
75+
}
76+
6177
static int guc_action_match_version(struct xe_guc *guc,
6278
u32 wanted_branch, u32 wanted_major, u32 wanted_minor,
6379
u32 *branch, u32 *major, u32 *minor, u32 *patch)

drivers/gpu/drm/xe/xe_gt_sriov_vf.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ struct drm_printer;
1212
struct xe_gt;
1313
struct xe_reg;
1414

15+
int xe_gt_sriov_vf_reset(struct xe_gt *gt);
1516
int xe_gt_sriov_vf_bootstrap(struct xe_gt *gt);
1617
int xe_gt_sriov_vf_query_config(struct xe_gt *gt);
1718
int xe_gt_sriov_vf_connect(struct xe_gt *gt);

0 commit comments

Comments
 (0)