drm/xe: Convert IO_BUS errors to structured xe_log API
Subsystems (2)
v2 cover drm/xe: Convert IO_BUS errors to structured xe_log API
This series meant for converitng the logs struct of IO_BUS device hardware catergories with different components such as GT, HWWOM, REGS, PAT, GT, LMTT, VRAM.
Patch 1 adds the new component definitions. Patches 2-13 convert individual subsystems to use xe_log_err/xe_log_err_fatal/xe_log_info with the appropriate component tags:
- GGTT: GSM probe and configuration errors
- HWMON: PCode readback and registration failures
- MMIO/REGS: BAR mapping, save-restore, whitelist, and force-wake errors
- MEMIRQ: Page allocation and GuC setup failures
- PAT: Missing PAT table detection
- GT: Unknown GMDID version reporting
- LMTT: HW invalidation failures
- VRAM: BAR validation and visibility errors
Dnyaneshwar Bhadane (13):
drm/xe/log: Add VRAM, PAT, and HWMON DRIVER_HARDWARE components drm/xe/ggtt: Report GGTT errors using structured logging drm/xe/hwmon: Report errors using structured xe_log API drm/xe/mmio: Report BAR mapping errors using structured xe_log API drm/xe/memirq: Report errors using structured xe_log API drm/xe/reg_whitelist: Report whitelist overflow using structured
xe_log API
drm/xe/reg_sr: Report save-restore errors using structured xe_log API drm/xe/pat: Return error from xe_pat_init_early() on unknown platform drm/xe/pat: Report missing PAT table using structured xe_log API drm/xe/pci: Report unknown GMDID versions using structured xe_log API drm/xe/lmtt: Report invalidation errors using structured xe_log API drm/xe/vram: Report tile vs device VRAM visibility errors drm/xe/vram: Report VRAM errors using structured xe_log API
drivers/gpu/drm/xe/abi/xe_log_abi.h | 3 +++ drivers/gpu/drm/xe/xe_device.c | 4 +++- drivers/gpu/drm/xe/xe_ggtt.c | 9 ++++++--- drivers/gpu/drm/xe/xe_hwmon.c | 10 ++++++---- drivers/gpu/drm/xe/xe_lmtt.c | 10 ++++++---- drivers/gpu/drm/xe/xe_memirq.c | 7 ++++--- drivers/gpu/drm/xe/xe_mmio.c | 12 ++++++++---- drivers/gpu/drm/xe/xe_pat.c | 20 +++++++++----------- drivers/gpu/drm/xe/xe_pat.h | 2 +- drivers/gpu/drm/xe/xe_pci.c | 10 ++++++---- drivers/gpu/drm/xe/xe_reg_sr.c | 22 +++++++++++----------- drivers/gpu/drm/xe/xe_reg_whitelist.c | 7 ++++--- drivers/gpu/drm/xe/xe_vram.c | 20 +++++++++++++++----- 13 files changed, 82 insertions(+), 54 deletions(-)
Signature · 1 line
2.54.0
PATCH v2 1/13 drm/xe/log: Add VRAM, PAT, and HWMON DRIVER_HARDWARE components
Register new DRIVER_HARDWARE log components for hardware I/O subsystems that currently lack structured error reporting:
- VRAM (ID 6): Video RAM access and BAR visibility errors
- PAT (ID 7): Page Attribute Table programming errors
- HWMON (ID 8): Hardware monitor registration and sensor errors
All three use IO_BUS as their default SIGID since they interact with hardware through MMIO or PCode register paths.
--- drivers/gpu/drm/xe/abi/xe_log_abi.h | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/xe/abi/xe_log_abi.h +3 -0
@@ -150,6 +150,9 @@ enum xe_log_location_bits { define(DRIVER_HARDWARE, 3, GT, GT_TDR, "Graphics Technology") \ define(DRIVER_HARDWARE, 4, LMTT, IO_BUS, "LMEM Translation Table") \ define(DRIVER_HARDWARE, 5, MEMIRQ, IO_BUS, "Memory Based IRQ") \ + define(DRIVER_HARDWARE, 6, VRAM, IO_BUS, "Virtual RAM") \ + define(DRIVER_HARDWARE, 7, PAT, IO_BUS, "Page Attribute Table") \ +define (DRIVER_HARDWARE ,8 ,HWMON ,IO_BUS ,"Hardware Monitoring" ) \ /* */ \ define(DRIVER_FEATURE, 1, PF, SW, "SR-IOV Physical Function") \define (DRIVER_FEATURE ,2 ,VF ,SW ,"SR-IOV Virtual Function" ) \
Signature · 1 line
2.54.0
[email protected]
AI reviewRe: [PATCH v2 01/13] drm/xe/log: Add VRAM, PAT, and HWMON DRIVER_HARDWARE components
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] The VRAM log component is incorrectly named "Virtual RAM" instead of "Video RAM" in the macro…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The VRAM log component is incorrectly named "Virtual RAM" instead of "Video RAM" in the macro definition. --
commit 7e2394ed2d7e6aa2312536fe5e3e318f1713fb04
Author: Dnyaneshwar Bhadane <[email protected]>
drm/xe/log: Add VRAM, PAT, and HWMON DRIVER_HARDWARE components
This commit registers new DRIVER_HARDWARE log components for VRAM, PAT, and HWMON subsystems to enable structured error reporting. It assigns them IDs and string names for use in the ABI.
Quoted 4 lines
drivers/gpu/drm/xe/abi/xe_log_abi.h +0
-0
[ ... ]
drivers/gpu/drm/xe/abi/xe_log_abi.h enum xe_log_location_bits { · line 153
Quoted 5 lines
drivers/gpu/drm/xe/abi/xe_log_abi.h +1
-0@@ -150,6 +150,9 @@ enum xe_log_location_bits { define(DRIVER_HARDWARE, 3, GT, GT_TDR, "Graphics Technology") \ define(DRIVER_HARDWARE, 4, LMTT, IO_BUS, "LMEM Translation Table") \ define(DRIVER_HARDWARE, 5, MEMIRQ, IO_BUS, "Memory Based IRQ") \ +define (DRIVER_HARDWARE ,6 ,VRAM ,IO_BUS ,"Virtual RAM" ) \
[Severity: Low]
Is the string name for this component correct? VRAM typically stands for "Video RAM" rather than "Virtual RAM" in the context of hardware subsystems. The commit message describes it as "Video RAM access", but this ABI definition exposes it as "Virtual RAM" in structured error logs.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
PATCH v2 2/13 drm/xe/ggtt: Report GGTT errors using structured logging
In reply to Dnyaneshwar BhadaneReplace xe_tile_err() calls with xe_log_err_fatal() using the GGTT component tag in GGTT initialization error paths.
--- drivers/gpu/drm/xe/xe_ggtt.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/xe/xe_ggtt.c +6 -3
@@ -23,6 +23,7 @@#include "xe_gt.h" #include "xe_gt_printk.h" #include "xe_gt_types.h" +#include "xe_log.h" #include "xe_map.h" #include "xe_mmio.h" #include "xe_pat.h"
@@ -403,7 +404,8 @@ int xe_ggtt_init_early(struct xe_ggtt *ggtt)else gsm_size =probe_gsm_size (pdev);if (gsm_size ==0 ) { -xe_tile_err (ggtt->tile,"Hardware reported no preallocated GSM\n" ); +xe_log_err_fatal (ggtt->tile,GGTT , -ENOMEM , +"Hardware reported no preallocated GSM\n" );return -ENOMEM ; } ggtt_start = wopcm;
@@ -414,8 +416,9 @@ int xe_ggtt_init_early(struct xe_ggtt *ggtt)if (ggtt_start < wopcm || ggtt_start + ggtt_size >GUC_GGTT_TOP ) { -xe_tile_err (ggtt->tile,"Invalid GGTT configuration: %#llx-%#llx\n" , - ggtt_start, ggtt_start + ggtt_size -1 ); +xe_log_err_fatal (ggtt->tile,GGTT , -ERANGE , +"Invalid GGTT configuration: %#llx-%#llx\n" , + ggtt_start, ggtt_start + ggtt_size -1 );return -ERANGE ; } }
Signature · 1 line
2.54.0
PATCH v2 3/13 drm/xe/hwmon: Report errors using structured xe_log API
In reply to Dnyaneshwar BhadaneReplace drm_err() calls with xe_log_err() using the HWMON component tag to enable structured error reporting with SIGID for hardware monitor failures:
--- drivers/gpu/drm/xe/xe_hwmon.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/xe/xe_hwmon.c +6 -4
@@ -15,6 +15,7 @@#include "regs/xe_pcode_regs.h" #include "xe_device.h" #include "xe_hwmon.h" +#include "xe_log.h" #include "xe_mmio.h" #include "xe_pcode.h" #include "xe_pcode_api.h"
@@ -563,9 +564,9 @@ xe_hwmon_power_max_interval_show(struct device *dev, struct device_attribute *atif (hwmon->xe->info.has_mbx_power_limits) { ret =xe_hwmon_pcode_read_power_limit (hwmon, power_attr, channel, ®_val);if (ret) { -drm_err (&hwmon->xe->drm, -"power interval read fail, ch %d, attr %d, val 0x%08x, ret %d\n" , - channel, power_attr, reg_val, ret); +xe_log_err (hwmon->xe,HWMON , ret, +"power interval read fail, ch %d, attr %d, val 0x%08x\n" , + channel, power_attr, reg_val); reg_val =0 ; } }else {
@@ -1599,7 +1600,8 @@ int xe_hwmon_register(struct xe_device *xe) &hwmon_chip_info, hwmon_groups);if (IS_ERR (hwmon->hwmon_dev)) { -drm_err (&xe->drm,"Failed to register xe hwmon (%pe)\n" , hwmon->hwmon_dev); +xe_log_err (xe,HWMON ,PTR_ERR (hwmon->hwmon_dev), +"Failed to register xe hwmon\n" ); xe->hwmon =NULL ;return PTR_ERR (hwmon->hwmon_dev); }
Signature · 1 line
2.54.0
PATCH v2 4/13 drm/xe/mmio: Report BAR mapping errors using structured xe_log API
In reply to Dnyaneshwar BhadaneReplace xe_err() calls with xe_log_err() and xe_log_err_fatal() using the REGS component tag for MMIO BAR probe failures
--- drivers/gpu/drm/xe/xe_mmio.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/gpu/drm/xe/xe_mmio.c +8 -4
@@ -15,6 +15,7 @@#include "regs/xe_bars.h" #include "xe_device.h" #include "xe_gt_sriov_vf.h" +#include "xe_log.h" #include "xe_printk.h" #include "xe_sriov.h" #include "xe_tile_printk.h"
@@ -71,8 +72,8 @@ int xe_mmio_probe_tiles(struct xe_device *xe)return 0 ;if (xe->mmio.size < xe->info.tile_count * tile_mmio_size) { -xe_err (xe,"GTTMMADR_BAR is too small for %d tiles: %zu\n" , - xe->info.tile_count, xe->mmio.size); +xe_log_err_fatal (xe,REGS , -EIO ,"GTTMMADR_BAR is too small for %d tiles: %zu\n" , + xe->info.tile_count, xe->mmio.size);return -EIO ; }
@@ -105,13 +106,16 @@ int xe_mmio_probe_early(struct xe_device *xe) xe->mmio.regs =pcim_iomap (pdev,GTTMMADR_BAR ,0 );if (!xe->mmio.regs) { -xe_err (xe,"Failed to map GTTMMADR_BAR\n" ); +xe_log_err_fatal (xe,REGS , -EIO , +"Failed to map GTTMMADR_BAR\n" );return -EIO ; } xe->mmio.size =pci_resource_len (pdev,GTTMMADR_BAR );if (xe->mmio.size <SZ_16M ) { -xe_err (xe,"GTTMMADR_BAR is too small: %zu\n" , xe->mmio.size); +xe_log_err_fatal (xe,REGS , -EIO , +"GTTMMADR_BAR is too small: %zu\n" , + xe->mmio.size);return -EIO ; }
Signature · 1 line
2.54.0
PATCH v2 5/13 drm/xe/memirq: Report errors using structured xe_log API
In reply to Dnyaneshwar BhadaneReplace memirq_err() calls with xe_log_err() using the MEMIRQ component tag for memory-based IRQ failures
v2:
- No need to log ERR_PTR(err) explicitly (Mallesh)
- Using tile instead of xe for more local log location(sashiko bot)
--- drivers/gpu/drm/xe/xe_memirq.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/xe/xe_memirq.c +4 -3
@@ -15,6 +15,7 @@#include "xe_gt.h" #include "xe_guc.h" #include "xe_hw_engine.h" +#include "xe_log.h" #include "xe_memirq.h" #include "xe_tile_printk.h"
@@ -232,7 +233,7 @@ static int memirq_alloc_pages(struct xe_memirq *memirq)return 0 ; out: -memirq_err (memirq,"Failed to allocate memirq page (%pe)\n" ,ERR_PTR (err)); +xe_log_err (tile,MEMIRQ , err,"Failed to allocate memirq page\n" );return err; }
@@ -370,8 +371,8 @@ int xe_memirq_init_guc(struct xe_memirq *memirq, struct xe_guc *guc)return 0 ; failed: -memirq_err (memirq,"Failed to setup report pages in %s (%pe)\n" , -guc_name (guc),ERR_PTR (err)); +xe_log_err (memirq_to_tile (memirq),MEMIRQ , err, +"Failed to setup report pages in %s\n" ,guc_name (guc));return err; }
Signature · 1 line
2.54.0
[email protected]
AI reviewRe: [PATCH v2 05/13] drm/xe/memirq: Report errors using structured xe_log API
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] The `memirq_err` macro definition was left behind as dead code after all of its usages were…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The memirq_err macro definition was left behind as dead code after all of its usages were replaced. --
commit 391745f6a990d1f601917ad8a478f9eb84f04e45
Author: Dnyaneshwar Bhadane <[email protected]>
drm/xe/memirq: Report errors using structured xe_log API
Replace memirq_err() calls with xe_log_err() using the MEMIRQ component tag for memory-based IRQ failures
drivers/gpu/drm/xe/xe_memirq.c static int memirq_alloc_pages(struct xe_memirq *memirq) · line 238
Quoted 12 lines
drivers/gpu/drm/xe/xe_memirq.c +1
-1@@ -232,7 +233,7 @@ static int memirq_alloc_pages(struct xe_memirq *memirq)return 0 ; out: -memirq_err (memirq,"Failed to allocate memirq page (%pe)\n" ,ERR_PTR (err)); +xe_log_err (tile,MEMIRQ , err,"Failed to allocate memirq page\n" );return err; }
[Severity: Low]
Should the memirq_err() macro definition also be removed?
Since this patch replaced all of its usages, the macro definition at the top of drivers/gpu/drm/xe/xe_memirq.c is left behind as unused dead code:
#define memirq_err(m, _fmt, ...) memirq_printk(m, err, _fmt, ##__VA_ARGS__)
[ ... ]
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
PATCH v2 6/13 drm/xe/reg_whitelist: Report whitelist overflow using structured xe_log API
In reply to Dnyaneshwar BhadaneReplace xe_gt_err() with xe_log_err() using the REGS component tag when the maximum register whitelist slots are exhausted.
v2:
- Use -EOVERFLOW on max limit reached (Mallesh)
--- drivers/gpu/drm/xe/xe_reg_whitelist.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/xe/xe_reg_whitelist.c +4 -3
@@ -14,6 +14,7 @@#include "xe_gt.h" #include "xe_gt_types.h" #include "xe_gt_printk.h" +#include "xe_log.h" #include "xe_platform_types.h" #include "xe_reg_sr.h" #include "xe_rtp.h"
@@ -186,9 +187,9 @@ static int whitelist_apply_to_hwe(struct xe_hw_engine *hwe, struct xe_reg_sr *in };if (slot ==RING_MAX_NONPRIV_SLOTS ) { -xe_gt_err (hwe->gt, -"hwe %s: maximum register whitelist slots (%d) reached, refusing to add more\n" , - hwe->name,RING_MAX_NONPRIV_SLOTS ); +xe_log_err (hwe->gt,REGS , -EOVERFLOW , +"hwe %s: maximum register whitelist slots (%d) reached, refusing to add more\n" , + hwe->name,RING_MAX_NONPRIV_SLOTS );break ; }
Signature · 1 line
2.54.0
PATCH v2 7/13 drm/xe/reg_sr: Report save-restore errors using structured xe_log API
In reply to Dnyaneshwar BhadaneReplace xe_gt_notice() and xe_gt_err() calls with xe_log_info() and xe_log_err() using the REGS component tag for register save-restore operations:
- MCR register mismatch corrections
- Failed to add register to save-restore list
- Force-wake timeout during SR apply
v2:
- Drop error type from logging explicitly(Mallesh).
--- drivers/gpu/drm/xe/xe_reg_sr.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/gpu/drm/xe/xe_reg_sr.c +11 -11
@@ -21,6 +21,7 @@#include "xe_gt_printk.h" #include "xe_gt_types.h" #include "xe_hw_engine_types.h" +#include "xe_log.h" #include "xe_lrc.h" #include "xe_mmio.h" #include "xe_rtp_types.h"
@@ -87,15 +88,15 @@ static struct xe_reg sanitize_mcr(struct xe_reg_sr *sr,if (is_mcr && !reg.mcr) { reg.mcr =1 ; -xe_gt_notice (gt,"xe_reg_sr_entry using non-MCR register for address 0x%x, forcing MCR\n" , - reg.addr); +xe_log_info (gt,REGS ,"xe_reg_sr_entry using non-MCR register for address 0x%x, forcing MCR\n" , + reg.addr);reg_sr_inc_error (sr); }if (!is_mcr && reg.mcr) { reg.mcr =0 ; -xe_gt_notice (gt,"xe_reg_sr_entry using MCR register for address 0x%x, forcing non-MCR\n" , - reg.addr); +xe_log_info (gt,REGS ,"xe_reg_sr_entry using MCR register for address 0x%x, forcing non-MCR\n" , + reg.addr);reg_sr_inc_error (sr); }
@@ -143,12 +144,11 @@ int xe_reg_sr_add(struct xe_reg_sr *sr, fail_free:kfree (pentry); fail: -xe_gt_err (gt, -"discarding save-restore reg %04lx (clear: %08x, set: %08x, masked: %s, mcr: %s): ret=%d\n" , - idx, e->clr_bits, e->set_bits, -str_yes_no (e->reg.masked), -str_yes_no (e->reg.mcr), - ret); +xe_log_err (gt,REGS , ret, +"discarding save-restore reg %04lx (clear: %08x, set: %08x, masked: %s, mcr: %s)\n" , + idx, e->clr_bits, e->set_bits, +str_yes_no (e->reg.masked), +str_yes_no (e->reg.mcr));reg_sr_inc_error (sr);return ret;
@@ -219,7 +219,7 @@ void xe_reg_sr_apply_mmio(struct xe_reg_sr *sr, struct xe_gt *gt)CLASS (xe_force_wake, fw_ref)(gt_to_fw (gt),XE_FORCEWAKE_ALL );if (!xe_force_wake_ref_has_domain (fw_ref.domains,XE_FORCEWAKE_ALL )) { -xe_gt_err (gt,"Failed to apply, err=-ETIMEDOUT\n" ); +xe_log_err (gt,REGS , -ETIMEDOUT ,"Failed to apply\n" );return ; }
Signature · 1 line
2.54.0
PATCH v2 8/13 drm/xe/pat: Return error from xe_pat_init_early() on unknown platform
In reply to Dnyaneshwar Bhadanexe_pat_init_early() currently only logs an error when the platform's graphics version doesn't match any known PAT table, but continues probing with an uninitialized pat.ops. This can lead to a NULL pointer dereference later when pat.ops is used.
Change xe_pat_init_early() to return an int and propagate -ENODATA to xe_device_probe() so the driver fails to load cleanly instead of continuing in a broken state.
--- drivers/gpu/drm/xe/xe_device.c | 4 +++- drivers/gpu/drm/xe/xe_pat.c | 14 +++++--------- drivers/gpu/drm/xe/xe_pat.h | 2 +- 3 files changed, 9 insertions(+), 11 deletions(-)
drivers/gpu/drm/xe/xe_device.c +3 -1
@@ -960,7 +960,9 @@ int xe_device_probe(struct xe_device *xe)int err;u8 id; -xe_pat_init_early (xe); + err =xe_pat_init_early (xe); +if (err) +return err; err =xe_sriov_init (xe);if (err)
drivers/gpu/drm/xe/xe_pat.c +5 -9
@@ -590,7 +590,7 @@ static const struct xe_pat_ops xe3p_xpc_pat_ops = { .entry_dump = xe3p_xpc_pat_entry_dump, }; -void xe_pat_init_early (struct xe_device *xe) +int xe_pat_init_early (struct xe_device *xe) { xe->pat.idx[XE_CACHE_WB_COMPRESSION ] =XE_PAT_INVALID_IDX ; xe->pat.idx[XE_CACHE_NONE_COMPRESSION ] =XE_PAT_INVALID_IDX ;
@@ -678,22 +678,18 @@ void xe_pat_init_early(struct xe_device *xe) xe->pat.idx[XE_CACHE_WT ] =2 ; xe->pat.idx[XE_CACHE_WB ] =0 ; }else { -/* -* Going forward we expect to need new PAT settings for most -* new platforms; failure to provide a new table can easily -* lead to subtle, hard-to-debug problems. If none of the -* conditions above match the platform we're running on we'll -* raise an error rather than trying to silently inherit the -* most recent platform's behavior. -*/ drm_err (&xe->drm,"Missing PAT table for platform with graphics version %d.%02d!\n" ,GRAPHICS_VER (xe),GRAPHICS_VERx100 (xe) %100 ); +return -ENODATA ; + } +xe_assert (xe, xe->pat.ops);xe_assert (xe, xe->pat.ops->dump);xe_assert (xe, xe->pat.ops->program_graphics);xe_assert (xe,MEDIA_VER (xe) <13 || xe->pat.ops->program_media);xe_assert (xe,GRAPHICS_VER (xe) <20 || xe->pat.ops->entry_dump); +return 0 ; }void xe_pat_init (struct xe_gt *gt)
drivers/gpu/drm/xe/xe_pat.h +1 -1
@@ -43,7 +43,7 @@ struct xe_pat_table_entry {* xe_pat_init_early - SW initialization, setting up data based on device * @xe: xe device */ -void xe_pat_init_early (struct xe_device *xe); +int xe_pat_init_early (struct xe_device *xe);/** * xe_pat_init - Program HW PAT table
Signature · 1 line
2.54.0
PATCH v2 9/13 drm/xe/pat: Report missing PAT table using structured xe_log API
In reply to Dnyaneshwar BhadaneReplace drm_err() with xe_log_err() using the PAT component tag when a platform has no matching PAT table entry.
--- drivers/gpu/drm/xe/xe_pat.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_pat.c +4 -2
@@ -16,6 +16,7 @@#include "xe_force_wake.h" #include "xe_gt.h" #include "xe_gt_mcr.h" +#include "xe_log.h" #include "xe_mmio.h" #include "xe_sriov.h" #include "xe_wa.h"
@@ -678,8 +679,9 @@ int xe_pat_init_early(struct xe_device *xe) xe->pat.idx[XE_CACHE_WT ] =2 ; xe->pat.idx[XE_CACHE_WB ] =0 ; }else { -drm_err (&xe->drm,"Missing PAT table for platform with graphics version %d.%02d!\n" , -GRAPHICS_VER (xe),GRAPHICS_VERx100 (xe) %100 ); +xe_log_err (xe,PAT , -EINVAL , +"Missing PAT table for platform with graphics version %d.%02d!\n" , +GRAPHICS_VER (xe),GRAPHICS_VERx100 (xe) %100 );return -ENODATA ; }
Signature · 1 line
2.54.0
[email protected]
AI reviewRe: [PATCH v2 09/13] drm/xe/pat: Report missing PAT table using structured xe_log API
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] Inconsistent error code between structured log and function return value --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Inconsistent error code between structured log and function return value --
commit 3f9326bca2893681a5346e8107dec4ac43a4112b
Author: Dnyaneshwar Bhadane <[email protected]>
drm/xe/pat: Report missing PAT table using structured xe_log API
This commit replaces the standard drm_err() logging with the structured xe_log_err() API using the PAT component tag for platforms that do not have a matching PAT table entry.
Quoted 4 lines
drivers/gpu/drm/xe/xe_pat.c +0
-0
[ ... ]
drivers/gpu/drm/xe/xe_pat.c int xe_pat_init_early(struct xe_device *xe) · line 685
Quoted 10 lines
drivers/gpu/drm/xe/xe_pat.c +3
-2@@ -678,8 +679,9 @@ int xe_pat_init_early(struct xe_device *xe) xe->pat.idx[XE_CACHE_WT ] =2 ; xe->pat.idx[XE_CACHE_WB ] =0 ; }else { -drm_err (&xe->drm,"Missing PAT table for platform with graphics version %d.%02d!\n" , -GRAPHICS_VER (xe),GRAPHICS_VERx100 (xe) %100 ); +xe_log_err (xe,PAT , -EINVAL , +"Missing PAT table for platform with graphics version %d.%02d!\n" , +GRAPHICS_VER (xe),GRAPHICS_VERx100 (xe) %100 );return -ENODATA ;
[Severity: Low]
Does this code intentionally log -EINVAL but return -ENODATA? Reaching the end of the platform matching chain in xe_pat_init_early() logs one error code (-EINVAL) to the structured telemetry API but returns a different one (-ENODATA) to its caller. Would it be better to align these error codes to prevent confusion during debugging or automated log analysis?
Quoted 2 lines
drivers/gpu/drm/xe/xe_pat.c +0
-0}
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=9
PATCH v2 10/13 drm/xe/pci: Report unknown GMDID versions using structured xe_log API
In reply to Dnyaneshwar BhadaneReplace drm_err() with xe_log_err() using the GT component tag when hardware reports unrecognized graphics or media IP versions during GMDID handling.
--- drivers/gpu/drm/xe/xe_pci.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/xe/xe_pci.c +6 -4
@@ -718,8 +718,9 @@ static int handle_gmdid(struct xe_device *xe, *graphics_ip =find_graphics_ip (ver);if (!*graphics_ip) { -drm_err (&xe->drm,"Hardware reports unknown graphics version %u.%02u\n" , - ver /100 , ver %100 ); +xe_log_err (xe,REGS , -EINVAL , +"Hardware reports unknown graphics version %u.%02u\n" , + ver /100 , ver %100 ); } ret =read_gmdid (xe,GMDID_MEDIA , &ver, media_revid);
@@ -732,8 +733,9 @@ static int handle_gmdid(struct xe_device *xe, *media_ip =find_media_ip (ver);if (!*media_ip) { -drm_err (&xe->drm,"Hardware reports unknown media version %u.%02u\n" , - ver /100 , ver %100 ); +xe_log_err (xe,REGS , -EINVAL , +"Hardware reports unknown media version %u.%02u\n" , + ver /100 , ver %100 ); }return 0 ;
Signature · 1 line
2.54.0
[email protected]
AI reviewRe: [PATCH v2 10/13] drm/xe/pci: Report unknown GMDID versions using structured xe_log API
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The patch uses the 'REGS' component tag instead of the 'GT' tag claimed in the commit message. --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The patch uses the 'REGS' component tag instead of the 'GT' tag claimed in the commit message. --
commit 5fd6d40222829ad569de8cdf73c334a89531ce68
Author: Dnyaneshwar Bhadane <[email protected]>
drm/xe/pci: Report unknown GMDID versions using structured xe_log API
This commit updates the GMDID handling code to replace drm_err() with the structured xe_log_err() function when hardware reports unrecognized graphics or media IP versions.
drivers/gpu/drm/xe/xe_pci.c static int handle_gmdid(struct xe_device *xe, · line 723
Quoted 12 lines
drivers/gpu/drm/xe/xe_pci.c +3
-2@@ -718,8 +718,9 @@ static int handle_gmdid(struct xe_device *xe, *graphics_ip =find_graphics_ip (ver);if (!*graphics_ip) { -drm_err (&xe->drm,"Hardware reports unknown graphics version %u.%02u\n" , - ver /100 , ver %100 ); +xe_log_err (xe,REGS , -EINVAL , +"Hardware reports unknown graphics version %u.%02u\n" , + ver /100 , ver %100 );
[Severity: Medium]
The commit message states this replaces drm_err() with xe_log_err() "using the GT component tag". However, handle_gmdid() uses the REGS tag here. Should this use the GT tag as described in the commit message, or is REGS the intended tag for this log?
drivers/gpu/drm/xe/xe_pci.c static int handle_gmdid(struct xe_device *xe, · line 738
Quoted 12 lines
drivers/gpu/drm/xe/xe_pci.c +3
-2} ret =read_gmdid (xe,GMDID_MEDIA , &ver, media_revid);@@ -732,8 +733,9 @@ static int handle_gmdid(struct xe_device *xe, *media_ip =find_media_ip (ver);if (!*media_ip) { -drm_err (&xe->drm,"Hardware reports unknown media version %u.%02u\n" , - ver /100 , ver %100 ); +xe_log_err (xe,REGS , -EINVAL , +"Hardware reports unknown media version %u.%02u\n" , + ver /100 , ver %100 );
[Severity: Medium]
Similarly, this uses the REGS tag for the unknown media version error. Does this also need to be updated to use the GT tag to match the commit description?
Quoted 3 lines
drivers/gpu/drm/xe/xe_pci.c +0
-0}return 0 ;
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=10
PATCH v2 11/13 drm/xe/lmtt: Report invalidation errors using structured xe_log API
In reply to Dnyaneshwar BhadaneReplace xe_tile_sriov_err() with xe_log_err() using the LMTT component tag for LMTT and MERT invalidation failures, preserving the SR-IOV prefix in the log message.
v2:
- Drop logging error type in log (Mallesh)
--- drivers/gpu/drm/xe/xe_lmtt.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/xe/xe_lmtt.c +6 -4
@@ -14,6 +14,7 @@#include "xe_bo.h" #include "xe_tlb_inval.h" #include "xe_lmtt.h" +#include "xe_log.h" #include "xe_map.h" #include "xe_mert.h" #include "xe_mmio.h"
@@ -302,14 +303,15 @@ void xe_lmtt_invalidate_hw(struct xe_lmtt *lmtt) err =lmtt_invalidate_hw (lmtt);if (err) -xe_tile_sriov_err (tile,"LMTT invalidation failed (%pe)" , -ERR_PTR (err)); +xe_log_err (tile,LMTT , err,"%s invalidation failed." , +xe_sriov_printk_prefix (xe));if (xe_device_has_mert (xe) &&xe_tile_is_root (tile)) { err =xe_mert_invalidate_lmtt (xe);if (err) -xe_tile_sriov_err (tile,"MERT LMTT invalidation failed (%pe)" , -ERR_PTR (err)); +xe_log_err (tile,LMTT , err, +"%s MERT invalidation failed.\n" , +xe_sriov_printk_prefix (xe)); } }
Signature · 1 line
2.54.0
PATCH v2 12/13 drm/xe/vram: Report tile vs device VRAM visibility errors
In reply to Dnyaneshwar BhadaneDerive the owning tile of a struct xe_vram_region inside vram_region_init() from vram->id, so the "no CPU visible VRAM" error can distinguish a per-tile region from the device-wide region without changing the function's signature.
--- drivers/gpu/drm/xe/xe_vram.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_vram.c +3 -1
@@ -244,6 +244,7 @@ static int vram_region_init(struct xe_device *xe, struct xe_vram_region *vram, struct xe_vram_region *lmem_bar, u64 offset, u64 usable_size, u64 region_size, resource_size_t remain_io_size) { + struct xe_tile *tile = vram == xe->mem.vram ? NULL : &xe->tiles[vram->id];/* Check if VRAM region is already initialized */ if (vram->mapping)return 0 ;
@@ -253,7 +254,8 @@ static int vram_region_init(struct xe_device *xe, struct xe_vram_region *vram, vram->io_size =min_t (u64, usable_size, remain_io_size);if (!vram->io_size) { -drm_err (&xe->drm,"Tile without any CPU visible VRAM. Aborting.\n" ); +drm_err (&xe->drm,"%s without any CPU visible VRAM. Aborting.\n" , + tile ?"Tile" :"Device" );return -ENODEV ; }
Signature · 1 line
2.54.0
PATCH v2 13/13 drm/xe/vram: Report VRAM errors using structured xe_log API
In reply to Dnyaneshwar BhadaneReplace drm_err()/drm_info() with xe_log_err_fatal()/xe_log_info() using the VRAM component tag. The "no CPU visible VRAM" error uses tile or device as the log location depending on the caller context.
--- drivers/gpu/drm/xe/xe_vram.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/gpu/drm/xe/xe_vram.c +14 -6
@@ -17,6 +17,7 @@#include "xe_device.h" #include "xe_force_wake.h" #include "xe_gt_mcr.h" +#include "xe_log.h" #include "xe_map.h" #include "xe_migrate.h" #include "xe_mmio.h"
@@ -46,7 +47,8 @@ static int determine_lmem_bar_size(struct xe_device *xe, struct xe_vram_region *struct pci_dev *pdev =to_pci_dev (xe->drm.dev);if (!resource_is_valid (pdev,LMEM_BAR )) { -drm_err (&xe->drm,"pci resource is not valid\n" ); +xe_log_err_fatal (xe,VRAM , -ENXIO , +"pci resource is not valid\n" );return -ENXIO ; }
@@ -254,8 +256,13 @@ static int vram_region_init(struct xe_device *xe, struct xe_vram_region *vram, vram->io_size =min_t (u64, usable_size, remain_io_size);if (!vram->io_size) { -drm_err (&xe->drm,"%s without any CPU visible VRAM. Aborting.\n" , - tile ?"Tile" :"Device" ); +if (tile) { +xe_log_err_fatal (tile,VRAM , -ENODEV , +"Tile without any CPU visible VRAM. Aborting.\n" ); + }else { +xe_log_err_fatal (xe,VRAM , -ENODEV , +"Device without any CPU visible VRAM. Aborting.\n" ); + }return -ENODEV ; }
@@ -320,7 +327,7 @@ int xe_vram_probe(struct xe_device *xe) err =determine_lmem_bar_size (xe, &lmem_bar);if (err)return err; -drm_info (&xe->drm,"VISIBLE VRAM: %pa, %pa\n" , &lmem_bar.io_start, &lmem_bar.io_size); +xe_log_info (xe,VRAM ,"VISIBLE VRAM: %pa, %pa\n" , &lmem_bar.io_start, &lmem_bar.io_size); remain_io_size = lmem_bar.io_size;
@@ -342,8 +349,9 @@ int xe_vram_probe(struct xe_device *xe)return err;if (total_size > lmem_bar.io_size) { -drm_info (&xe->drm,"VRAM: %pa is larger than resource %pa\n" , - &total_size, &lmem_bar.io_size); +xe_log_info (xe,VRAM , +"Total size %pa is larger than resource %pa\n" , + &total_size, &lmem_bar.io_size); } remain_io_size -=min_t (u64, tile->mem.vram->actual_physical_size, remain_io_size);
Signature · 1 line
2.54.0