Hi all, Today's linux-next merge of the drm tree got conflicts in: drivers/gpu/drm/xe/xe_hw_error.c drivers/gpu/drm/xe/xe_pm.c between commits: a890a885b982f ("drm/xe/hw_error: Guard csc_hw_error_work() with runtime PM") fc0ba46fd8278 ("drm/xe: Access GT MMIO after pcode init") a17c5ed0dc715 ("drm/xe/pm: Apply tile workarounds after PCODE initialization") from the origin tree and commits: 323047eeee980 ("drm/xe: Separate drm-ras netlink data from device and firmware RAS state") fc8d229d76102 ("drm/xe/hw_error: Guard csc_hw_error_work() with runtime PM") 638d116d755ed ("drm/xe: Access GT MMIO after pcode init") 1f6ac7c86aa52 ("drm/xe: Memset g2g buffer on resume") 6569aa6628799 ("drm/xe/xe_late_bind_fw: Refactor pm flow") 641ffb2132839 ("drm/xe/pm: Apply tile workarounds after PCODE initialization") be082ef8157b7 ("drm/xe/pm: skip BO eviction on iGPU for non-hibernation sleep") 3541c71284fa8 ("drm/xe/hw_error: Reuse CSC worker for generic error handling") 14bbd417a6e0f ("drm/xe/hw_error: Initialize hw_error_work per tile") b6bd6c613fd5e ("drm/xe: Add support for wa_14028434957") ff03d9510426e ("drm/xe/pm: Introduce xe_device_suspend/resume()") from the drm tree. I fixed it up (see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts. diff --combined drivers/gpu/drm/xe/xe_hw_error.c index f726179c22e38,86b29f2828374..0000000000000 --- a/drivers/gpu/drm/xe/xe_hw_error.c +++ b/drivers/gpu/drm/xe/xe_hw_error.c @@@ -5,6 -5,8 +5,8 @@@ #include + #include + #include "regs/xe_gsc_regs.h" #include "regs/xe_hw_error_regs.h" #include "regs/xe_irq_regs.h" @@@ -15,7 -17,11 +17,11 @@@ #include "xe_hw_error.h" #include "xe_mmio.h" #include "xe_pm.h" + #include "xe_ras.h" #include "xe_survivability_mode.h" + #include "xe_wa.h" + #include "xe_wedge.h" + #define GT_HW_ERROR_MAX_ERR_BITS 16 #define HEC_UNCORR_FW_ERR_BITS 4 @@@ -166,12 -172,29 +172,29 @@@ static_assert(ARRAY_SIZE(pvc_master_loc pvc_master_local_fatal_err_reg : \ pvc_master_local_nonfatal_err_reg) - static void csc_hw_error_work(struct work_struct *work) + static void hw_error_work(struct work_struct *work) { - struct xe_tile *tile = container_of(work, typeof(*tile), csc_hw_error_work); + struct xe_tile *tile = container_of(work, typeof(*tile), hw_error_work); struct xe_device *xe = tile_to_xe(tile); + /* Skip hw error processing if device is already wedged */ + if (xe_wedged(xe)) + return; + guard(xe_pm_runtime)(xe); + + if (xe->info.has_sysctrl && XE_DEVICE_WA(xe, 14028434957)) { + /* + * Skip handling if an uncorrectable internal error is reported as + * reset is imminent + */ + if (xe_ras_is_aer_internal_error(xe)) + return; + + xe_ras_process_errors(xe); + return; + } + xe_survivability_mode_runtime_enable(xe); } @@@ -204,7 -227,7 +227,7 @@@ static void csc_hw_error_handler(struc hec_uncorrected_fw_errors[err_bit], severity_str, err_bit); - schedule_work(&tile->csc_hw_error_work); + schedule_work(&tile->hw_error_work); } } @@@ -242,7 -265,7 +265,7 @@@ static void log_soc_error(struct xe_til { const char *severity_str = error_severity[severity]; struct xe_device *xe = tile_to_xe(tile); - struct xe_drm_ras *ras = &xe->ras; + struct xe_drm_ras *ras = &xe->ras.nl_data; struct xe_drm_ras_counter *info = ras->info[severity]; const char *name; @@@ -262,7 -285,7 +285,7 @@@ static void gt_hw_error_handler(struct { const enum drm_xe_ras_error_severity severity = hw_err_to_severity(hw_err); struct xe_device *xe = tile_to_xe(tile); - struct xe_drm_ras *ras = &xe->ras; + struct xe_drm_ras *ras = &xe->ras.nl_data; struct xe_drm_ras_counter *info = ras->info[severity]; struct xe_mmio *mmio = &tile->mmio; unsigned long err_stat = 0; @@@ -424,7 -447,7 +447,7 @@@ static void hw_error_source_handler(str const enum drm_xe_ras_error_severity severity = hw_err_to_severity(hw_err); const char *severity_str = error_severity[severity]; struct xe_device *xe = tile_to_xe(tile); - struct xe_drm_ras *ras = &xe->ras; + struct xe_drm_ras *ras = &xe->ras.nl_data; struct xe_drm_ras_counter *info = ras->info[severity]; unsigned long flags, err_src; u32 err_bit; @@@ -433,12 -456,12 +456,12 @@@ return; /* - * Hardware errors are reported through System Controller on the platforms that - * support it, and never routed as direct IRQ to SGUnit. So we should never be - * here for those platforms. + * Non-fatal errors are routed as a direct IRQ on platforms that support + * system controller. */ if (xe->info.has_sysctrl) { - drm_err_ratelimited(&xe->drm, HW_ERR "Invalid error routing\n"); + drm_err_ratelimited(&xe->drm, HW_ERR "Non-fatal %s reported\n", severity_str); + schedule_work(&tile->hw_error_work); return; } @@@ -513,7 -536,7 +536,7 @@@ void xe_hw_error_irq_handler(struct xe_ enum hardware_error hw_err; if (xe_fault_csc_hw_error()) - schedule_work(&tile->csc_hw_error_work); + schedule_work(&tile->hw_error_work); for (hw_err = 0; hw_err < HARDWARE_ERROR_MAX; hw_err++) { if (master_ctl & ERROR_IRQ(hw_err)) @@@ -537,6 -560,25 +560,25 @@@ static void process_hw_errors(struct xe } } + /** + * xe_hw_error_work_disable - Disable hw error work + * @arg: xe device instance + * + * This function disables work for hardware error handling for all tiles. + */ + void xe_hw_error_work_disable(void *arg) + { + struct xe_device *xe = arg; + struct xe_tile *tile; + u8 id; + + if (!IS_DGFX(xe) || IS_SRIOV_VF(xe)) + return; + + for_each_tile(tile, xe, id) + disable_work_sync(&tile->hw_error_work); + } + /** * xe_hw_error_init - Initialize hw errors * @xe: xe device instance @@@ -546,12 -588,15 +588,15 @@@ */ void xe_hw_error_init(struct xe_device *xe) { - struct xe_tile *tile = xe_device_get_root_tile(xe); + struct xe_tile *tile; + u8 id; if (!IS_DGFX(xe) || IS_SRIOV_VF(xe)) return; - INIT_WORK(&tile->csc_hw_error_work, csc_hw_error_work); + for_each_tile(tile, xe, id) + INIT_WORK(&tile->hw_error_work, hw_error_work); process_hw_errors(xe); + devm_add_action_or_reset(xe->drm.dev, xe_hw_error_work_disable, xe); } diff --combined drivers/gpu/drm/xe/xe_pm.c index d95f0d128ed49,f73f68bd449b8..0000000000000 --- a/drivers/gpu/drm/xe/xe_pm.c +++ b/drivers/gpu/drm/xe/xe_pm.c @@@ -167,59 -167,38 +167,38 @@@ static void xe_rpm_lockmap_release(cons } /** - * xe_pm_suspend - Helper for System suspend, i.e. S0->S3 / S0->S2idle + * xe_pm_needs_bo_evict() - Check if bo eviction is needed + * @xe: The xe device. + * @hibernate: Hibernation event + * + * Return: %true if bo eviction is needed, %false otherwise. + */ + bool xe_pm_needs_bo_evict(struct xe_device *xe, bool hibernate) + { + return IS_DGFX(xe) || hibernate; + } + + /** + * xe_pm_suspend - Helper for System suspend, i.e. S0->S3 / S0->S2idle / S0->S4 * @xe: xe device instance + * @hibernate: true if preparing for S4 hibernation, false for < S4 suspend * * Return: 0 on success */ - int xe_pm_suspend(struct xe_device *xe) + int xe_pm_suspend(struct xe_device *xe, bool hibernate) { - struct xe_gt *gt; - u8 id; int err; drm_dbg(&xe->drm, "Suspending device\n"); xe_pm_block_begin_signalling(); trace_xe_pm_suspend(xe, __builtin_return_address(0)); - err = xe_pxp_pm_suspend(xe->pxp); + err = xe_device_suspend(xe, hibernate, false); if (err) - goto err; + drm_dbg(&xe->drm, "Device suspend failed %d\n", err); + else + drm_dbg(&xe->drm, "Device suspended\n"); - xe_late_bind_wait_for_worker_completion(&xe->late_bind); - - for_each_gt(gt, xe, id) - xe_gt_suspend_prepare(gt); - - xe_display_pm_suspend(xe); - - /* FIXME: Super racey... */ - err = xe_bo_evict_all(xe); - if (err) - goto err_display; - - for_each_gt(gt, xe, id) { - err = xe_gt_suspend(gt); - if (err) - goto err_display; - } - - xe_irq_suspend(xe); - - xe_display_pm_suspend_late(xe); - - xe_i2c_pm_suspend(xe); - - drm_dbg(&xe->drm, "Device suspended\n"); - xe_pm_block_end_signalling(); - - return 0; - - err_display: - xe_display_pm_resume(xe); - xe_pxp_pm_resume(xe->pxp); - err: - drm_dbg(&xe->drm, "Device suspend failed %d\n", err); xe_pm_block_end_signalling(); return err; } @@@ -232,71 -211,18 +211,18 @@@ */ int xe_pm_resume(struct xe_device *xe) { - struct xe_tile *tile; - struct xe_gt *gt; - u8 id; int err; xe_pm_block_begin_signalling(); drm_dbg(&xe->drm, "Resuming device\n"); trace_xe_pm_resume(xe, __builtin_return_address(0)); - err = xe_pcode_ready(xe, true); + err = xe_device_resume(xe, false); if (err) - return err; + drm_dbg(&xe->drm, "Device resume failed %d\n", err); + else + drm_dbg(&xe->drm, "Device resumed\n"); - for_each_tile(tile, xe, id) - xe_wa_apply_tile_workarounds(tile); - - for_each_gt(gt, xe, id) - xe_gt_idle_disable_c6(gt); - - xe_display_pm_resume_early(xe); - - /* - * This only restores pinned memory which is the memory required for the - * GT(s) to resume. - */ - err = xe_bo_restore_early(xe); - if (err) - goto err; - - xe_i2c_pm_resume(xe, true); - - xe_sysctrl_pm_resume(xe); - - xe_irq_resume(xe); - - for_each_gt(gt, xe, id) { - err = xe_gt_resume(gt); - if (err) - break; - } - - /* - * Try to bring up display before bailing from GT resume failure, - * so we don't leave the user clueless with a blank screen. - */ - xe_display_pm_resume(xe); - if (err) - goto err; - - err = xe_bo_restore_late(xe); - if (err) - goto err; - - xe_pxp_pm_resume(xe->pxp); - - if (IS_VF_CCS_READY(xe)) - xe_sriov_vf_ccs_register_context(xe); - - xe_late_bind_fw_load(&xe->late_bind); - - drm_dbg(&xe->drm, "Device resumed\n"); - xe_pm_block_end_signalling(); - return 0; - err: - drm_dbg(&xe->drm, "Device resume failed %d\n", err); xe_pm_block_end_signalling(); return err; } @@@ -461,6 -387,9 +387,9 @@@ static int xe_pm_notifier_callback(stru struct xe_validation_ctx ctx; reinit_completion(&xe->pm_block); + if (!xe_pm_needs_bo_evict(xe, action == PM_HIBERNATION_PREPARE)) + break; + xe_pm_block_begin_signalling(); xe_pm_runtime_get(xe); (void)xe_validation_ctx_init(&ctx, &xe->val, NULL, @@@ -485,6 -414,9 +414,9 @@@ case PM_POST_SUSPEND: complete_all(&xe->pm_block); xe_pm_wake_rebind_workers(xe); + if (!xe_pm_needs_bo_evict(xe, action == PM_POST_HIBERNATION)) + break; + xe_bo_notifier_unprepare_all_pinned(xe); xe_pm_runtime_put(xe); break; @@@ -707,7 -639,7 +639,7 @@@ int xe_pm_runtime_resume(struct xe_devi xe_wa_apply_tile_workarounds(tile); for_each_gt(gt, xe, id) - xe_gt_idle_disable_c6(gt); + xe_gt_resume_early(gt); xe_display_pm_resume_early(xe); @@@ -755,7 -687,7 +687,7 @@@ xe_sriov_vf_ccs_register_context(xe); if (xe->d3cold.allowed) - xe_late_bind_fw_load(&xe->late_bind); + xe_late_bind_pm_resume(&xe->late_bind); out: xe_rpm_lockmap_release(xe);