From 3799dc5d778552e20bc5894d80df54b30fe764c8 Mon Sep 17 00:00:00 2001 From: Raag Jadav Date: Thu, 30 Jul 2026 16:36:34 +0530 Subject: [PATCH 1/5] drm/xe/ras: Fix boot-time ras error processing Currently, we xe_ras_process_errors() inside xe_ras_init() to handle boot time errors. But this can potentially result in declaring the device as wedged quite early in the driver load sequence, which is problematic due to the lack of registered drm device or required wedged cleanup hooks at this point. Call xe_ras_process_errors() only after the prerequisites are available. Fixes: d9732e498f5f ("drm/xe/xe_ras: Query errors from system controller on probe") Signed-off-by: Raag Jadav Reviewed-by: Rodrigo Vivi Tested-by: Mallesh Koujalagi Link: https://patch.msgid.link/20260730110635.925537-1-raag.jadav@intel.com Signed-off-by: Riana Tauro (cherry picked from commit 20bc4883c7c0e28c3ba6c76ccc279486c349dd3e) Signed-off-by: Rodrigo Vivi --- drivers/gpu/drm/xe/xe_device.c | 6 ++++++ drivers/gpu/drm/xe/xe_ras.c | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c index 7007b6113760..d25d02b24898 100644 --- a/drivers/gpu/drm/xe/xe_device.c +++ b/drivers/gpu/drm/xe/xe_device.c @@ -1141,6 +1141,12 @@ int xe_device_probe(struct xe_device *xe) if (err) goto err_unregister_display; + /* + * Process and log any errors detected by hardware. Possible results can + * include declaring the device as wedged, which must be done only after + * xe_device_wedged_fini() is registered. + */ + xe_ras_process_errors(xe); return devm_add_action_or_reset(xe->drm.dev, xe_device_sanitize, xe); err_unregister_display: diff --git a/drivers/gpu/drm/xe/xe_ras.c b/drivers/gpu/drm/xe/xe_ras.c index a31e06b8aa67..c8d40289b4fe 100644 --- a/drivers/gpu/drm/xe/xe_ras.c +++ b/drivers/gpu/drm/xe/xe_ras.c @@ -692,12 +692,6 @@ void xe_ras_init(struct xe_device *xe) if (IS_ENABLED(CONFIG_PCIEAER)) ras_usp_aer_init(xe); - /* - * During probe, process and log any errors detected by firmware while the driver was not - * loaded. Critical errors such as Punit and CSC are reported through Pcode init failure, - * causing the driver to enter survivability mode. - */ - xe_ras_process_errors(xe); ret = devm_device_add_group(xe->drm.dev, &gpu_health_group); if (ret) xe_err(xe, "Failed to create GPU health sysfs, err=%d\n", ret); From f3c0140332fdb8f343a384570f01b879794ddae8 Mon Sep 17 00:00:00 2001 From: Raag Jadav Date: Mon, 10 Aug 2026 18:11:01 +0530 Subject: [PATCH 2/5] drm/xe/drm_ras: Move has_drm_ras check to drm_ras layer has_drm_ras flag is meant to facilitate drm_ras feature. Move it to the correct layer where it belongs. Fixes: 63dfab5786ca ("drm/xe/xe_ras: Add drm_ras feature flag") Signed-off-by: Raag Jadav Reviewed-by: Riana Tauro Link: https://patch.msgid.link/20260810124101.105832-1-raag.jadav@intel.com Signed-off-by: Matt Roper (cherry picked from commit 9f15135fe2dd9cff3caccab2f6ff4df86804b3c2) Signed-off-by: Rodrigo Vivi --- drivers/gpu/drm/xe/xe_drm_ras.c | 3 +++ drivers/gpu/drm/xe/xe_ras.c | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_drm_ras.c b/drivers/gpu/drm/xe/xe_drm_ras.c index 7937d8ba0ed9..984fa67b9015 100644 --- a/drivers/gpu/drm/xe/xe_drm_ras.c +++ b/drivers/gpu/drm/xe/xe_drm_ras.c @@ -199,6 +199,9 @@ int xe_drm_ras_init(struct xe_device *xe) struct drm_ras_node *node; int err; + if (!xe->info.has_drm_ras) + return 0; + node = drmm_kcalloc(&xe->drm, DRM_XE_RAS_ERR_SEV_MAX, sizeof(*node), GFP_KERNEL); if (!node) return -ENOMEM; diff --git a/drivers/gpu/drm/xe/xe_ras.c b/drivers/gpu/drm/xe/xe_ras.c index c8d40289b4fe..d98ff9453f60 100644 --- a/drivers/gpu/drm/xe/xe_ras.c +++ b/drivers/gpu/drm/xe/xe_ras.c @@ -681,9 +681,6 @@ void xe_ras_init(struct xe_device *xe) { int ret; - if (!xe->info.has_drm_ras) - return; - xe_drm_ras_init(xe); if (!xe->info.has_sysctrl) From f8152179882a57e62a07dbf25ec95321c44e6b23 Mon Sep 17 00:00:00 2001 From: Raag Jadav Date: Mon, 10 Aug 2026 18:08:20 +0530 Subject: [PATCH 3/5] drm/xe: Fix xe_device_probe() failure Currently, xe_device_probe() jumps to err_unregister_display label in case of failure except for its last call, which directly returns the error without required cleanup handling. This results in stale drm device that isn't cleaned up on unwind. Fix it. [ 810.194180] sysfs: cannot create duplicate filename '/devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:01.0/0000:03:00.0/drm/renderD128' [ 810.194183] CPU: 9 UID: 0 PID: 5616 Comm: modprobe Kdump: loaded Tainted: G S U E 7.2.0-rc2-xe #382 PREEMPT(full) [ 810.194185] Tainted: [S]=CPU_OUT_OF_SPEC, [U]=USER, [E]=UNSIGNED_MODULE [ 810.194186] Hardware name: ASUS System Product Name/PRIME Z790-P WIFI, BIOS 1805 10/30/2024 [ 810.194186] Call Trace: [ 810.194187] [ 810.194188] dump_stack_lvl+0xe0/0x100 [ 810.194195] dump_stack+0x14/0x20 [ 810.194197] sysfs_warn_dup+0x5f/0x80 [ 810.194204] sysfs_create_dir_ns+0xbe/0xd0 [ 810.194210] kobject_add_internal+0xbc/0x2b0 [ 810.194215] kobject_add+0x7c/0xe0 [ 810.194220] ? get_device_parent+0xcf/0x1e0 [ 810.194227] device_add+0xe3/0x870 [ 810.194231] ? __pfx_drm_gem_name_info+0x10/0x10 [drm] [ 810.194280] drm_minor_register+0x73/0x130 [drm] [ 810.194322] drm_dev_register+0x76/0x2a0 [drm] Cc: stable@vger.kernel.org Fixes: da3799c97572 ("drm/xe: Use GuC to do GGTT invalidations for the GuC firmware") Signed-off-by: Raag Jadav Reviewed-by: Rodrigo Vivi Link: https://patch.msgid.link/20260810123821.105605-1-raag.jadav@intel.com Signed-off-by: Matt Roper (cherry picked from commit 5ce3042c67c539480882567137ff8d56118885d6) Signed-off-by: Rodrigo Vivi --- drivers/gpu/drm/xe/xe_device.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c index d25d02b24898..71ce153737ab 100644 --- a/drivers/gpu/drm/xe/xe_device.c +++ b/drivers/gpu/drm/xe/xe_device.c @@ -1147,7 +1147,12 @@ int xe_device_probe(struct xe_device *xe) * xe_device_wedged_fini() is registered. */ xe_ras_process_errors(xe); - return devm_add_action_or_reset(xe->drm.dev, xe_device_sanitize, xe); + + err = devm_add_action_or_reset(xe->drm.dev, xe_device_sanitize, xe); + if (err) + goto err_unregister_display; + + return 0; err_unregister_display: xe_display_unregister(xe); From 63fe9ce2f23e80107b74a0c34e8c3d987ae8e108 Mon Sep 17 00:00:00 2001 From: Vinay Belgaumkar Date: Wed, 5 Aug 2026 16:46:49 -0700 Subject: [PATCH 4/5] drm/xe: Fix a bug in pc_adjust_freq_bounds() In cases where min frequency was actually greater than BMG_MIN_FREQ, we were not using the updated min frequency as there was a missing call to pc_action_query_task_state() between the two settings of min frequency. Since we know what min_freq was last set, use that cached value while comparing to BMG_MIN_FREQ to fix this issue. v2: pc->freq_ready is not set until after pc_adjust_freq_bounds(). Stay with pc_action_query_task_state() instead. v3: Update commit message (Stuart) Fixes: bdde16c9ac5c ("drm/xe/bmg: Update Wa_14022085890") Signed-off-by: Balasubramani Vivekanandan Signed-off-by: Vinay Belgaumkar Reviewed-by: Stuart Summers Link: https://patch.msgid.link/20260805234649.2076384-1-vinay.belgaumkar@intel.com (cherry picked from commit a2c2d2b13a9ea9494d2d76b46273833111749507) Signed-off-by: Rodrigo Vivi --- drivers/gpu/drm/xe/xe_guc_pc.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_guc_pc.c b/drivers/gpu/drm/xe/xe_guc_pc.c index 59f2fa79ad42..7cf8f4858598 100644 --- a/drivers/gpu/drm/xe/xe_guc_pc.c +++ b/drivers/gpu/drm/xe/xe_guc_pc.c @@ -911,6 +911,7 @@ static bool pc_needs_min_freq_change(struct xe_guc_pc *pc) static int pc_adjust_freq_bounds(struct xe_guc_pc *pc) { int ret; + u32 min_freq; lockdep_assert_held(&pc->freq_lock); @@ -933,8 +934,14 @@ static int pc_adjust_freq_bounds(struct xe_guc_pc *pc) * Same thing happens for Server platforms where min is listed as * RPMax */ - if (pc_get_min_freq(pc) > pc->rp0_freq) + min_freq = pc_get_min_freq(pc); + if (min_freq > pc->rp0_freq) { ret = pc_set_min_freq(pc, pc->rp0_freq); + if (ret) + goto out; + + min_freq = pc->rp0_freq; + } /* * Setting GT RP min frequency to 1.2GHz by default for @@ -947,8 +954,8 @@ static int pc_adjust_freq_bounds(struct xe_guc_pc *pc) * we aren't expecting high power output across board * */ - if (pc_needs_min_freq_change(pc)) - ret = pc_set_min_freq(pc, max(BMG_MIN_FREQ, pc_get_min_freq(pc))); + if (pc_needs_min_freq_change(pc) && min_freq < BMG_MIN_FREQ) + ret = pc_set_min_freq(pc, BMG_MIN_FREQ); out: return ret; From 1c4d0c45d762539f174cf1d74b2cb21d18e71363 Mon Sep 17 00:00:00 2001 From: Ashutosh Dixit Date: Wed, 29 Jul 2026 16:06:44 -0700 Subject: [PATCH 5/5] drm/xe/mcr: Take vcs1/vecs1 into account for first media slice vcs1 and vecs1 may also be present on the first media slice, so take vcs1/vecs1 also into account when determining if the first media slice is absent. Bspec: 67103, 77977 Cc: Gustavo Sousa Cc: Matt Roper Signed-off-by: Ashutosh Dixit Reviewed-by: Matt Roper Link: https://patch.msgid.link/20260729230645.3052178-2-ashutosh.dixit@intel.com (cherry picked from commit 1dff677209f6ed48779f4ac2ba130a207540a435) Signed-off-by: Rodrigo Vivi --- drivers/gpu/drm/xe/xe_gt_mcr.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_gt_mcr.c b/drivers/gpu/drm/xe/xe_gt_mcr.c index a97b236dab7c..1949bf7d370a 100644 --- a/drivers/gpu/drm/xe/xe_gt_mcr.c +++ b/drivers/gpu/drm/xe/xe_gt_mcr.c @@ -443,11 +443,16 @@ static void init_steering_dss(struct xe_gt *gt) static void init_steering_oaddrm(struct xe_gt *gt) { + u64 hwe_mask = XE_HW_ENGINE_VCS0 | XE_HW_ENGINE_VECS0; + + /* TODO: Add 'VD per SCMI' and 'VE per SCMI' values into 'struct xe_media_desc' */ + if (MEDIA_VERx100(gt_to_xe(gt)) >= 3500) + hwe_mask |= XE_HW_ENGINE_VCS1 | XE_HW_ENGINE_VECS1; /* * First instance is only terminated if the entire first media slice - * is absent (i.e., no VCS0 or VECS0). + * is absent (i.e., no engines in hwe_mask). */ - if (gt->info.engine_mask & (XE_HW_ENGINE_VCS0 | XE_HW_ENGINE_VECS0)) + if (gt->info.engine_mask & hwe_mask) gt->steering[OADDRM].group_target = 0; else gt->steering[OADDRM].group_target = 1;