drm/xe/guc: Add GuC based register capture for error capture
Subsystems (2)
v5 cover drm/xe/guc: Add GuC based register capture for error capture
Port GuC based register capture for error capture from i915 to Xe.
There are 3 parts inside:
. Prepare for capture registers
There is a bo create at guc ads init time, that is very early and engine map is not ready, make it hard to calculate the capture buffer size, new function created for worst case size caluation. Other than that, this part basically follows the i915 design.
. Process capture notification message
Basically follows i915 design
. Sysfs command process.
Xe switched to devcoredump, adopted command line process with captured node list.
Changes from prior revs:
v5:- Split dss helper code code as standalone patch.
Remove old platform registers definition. Split register map table to 32 and 64bit each.
v4:- Move register map table to xe_hw_engine.c v3:- Remove condition compilation in code v2:- Split into multiple chunks
Zhanjun Dong (8):
drm/xe/guc: Add kconfig for GuC based register capture drm/xe/guc: Update GuC ADS size for error capture drm/xe/guc: Add XE_LP steered register lists drm/xe/guc: Add capture size check in GuC log buffer drm/xe/guc: Check sizing of guc_capture output drm/xe/guc: Extract GuC error capture lists on G2H notification drm/xe/guc: Pre-allocate output nodes for extraction drm/xe/guc: Plumb GuC-capture into dev coredump
drivers/gpu/drm/xe/Kconfig | 11 + drivers/gpu/drm/xe/Makefile | 1 + drivers/gpu/drm/xe/abi/guc_actions_abi.h | 7 + drivers/gpu/drm/xe/regs/xe_gt_regs.h | 5 + drivers/gpu/drm/xe/xe_gt_printk.h | 3 + drivers/gpu/drm/xe/xe_guc.c | 6 + drivers/gpu/drm/xe/xe_guc_ads.c | 229 +++- drivers/gpu/drm/xe/xe_guc_ads_types.h | 2 + drivers/gpu/drm/xe/xe_guc_capture.c | 1332 ++++++++++++++++++++++ drivers/gpu/drm/xe/xe_guc_capture.h | 21 + drivers/gpu/drm/xe/xe_guc_capture_fwif.h | 221 ++++ drivers/gpu/drm/xe/xe_guc_ct.c | 2 + drivers/gpu/drm/xe/xe_guc_fwif.h | 68 ++ drivers/gpu/drm/xe/xe_guc_log.c | 179 +++ drivers/gpu/drm/xe/xe_guc_log.h | 15 + drivers/gpu/drm/xe/xe_guc_log_types.h | 26 + drivers/gpu/drm/xe/xe_guc_submit.c | 21 +- drivers/gpu/drm/xe/xe_guc_submit.h | 3 + drivers/gpu/drm/xe/xe_guc_types.h | 2 + drivers/gpu/drm/xe/xe_hw_engine.c | 257 ++++- drivers/gpu/drm/xe/xe_hw_engine.h | 4 + drivers/gpu/drm/xe/xe_hw_engine_types.h | 96 +- 22 files changed, 2396 insertions(+), 115 deletions(-) create mode 100644 drivers/gpu/drm/xe/xe_guc_capture.c create mode 100644 drivers/gpu/drm/xe/xe_guc_capture.h create mode 100644 drivers/gpu/drm/xe/xe_guc_capture_fwif.h
base-commit: 26c94721565996b1990ccb2a64b05947e1f201b5
Signature · 1 line
2.34.1
PATCH v5 1/8 drm/xe/guc: Add kconfig for GuC based register capture
Add kconfig for GuC based register capture. This feature support of GuC to report error-state-capture, using a list of MMIO registers the driver registers and GuC will dump, log and notify right before a GuC triggered engine-reset event.
This feature could be disabled to save memory.
--- drivers/gpu/drm/xe/Kconfig | 11 +++++++ drivers/gpu/drm/xe/Makefile | 1 + drivers/gpu/drm/xe/xe_guc.c | 5 ++++ drivers/gpu/drm/xe/xe_guc_capture.c | 46 +++++++++++++++++++++++++++++ drivers/gpu/drm/xe/xe_guc_capture.h | 15 ++++++++++ 5 files changed, 78 insertions(+) create mode 100644 drivers/gpu/drm/xe/xe_guc_capture.c create mode 100644 drivers/gpu/drm/xe/xe_guc_capture.h
drivers/gpu/drm/xe/Kconfig +11 -0
@@ -83,6 +83,17 @@ config DRM_XE_FORCE_PROBE Use "!*" to block the probe of the driver for all known devices. +config DRM_XE_CAPTURE_ERROR + bool "Enable capturing GPU state following a hang" + depends on DRM_XE + default y + help + This option enables capturing the GPU state when a hang is detected. + This information is vital for triaging hangs and assists in debugging. + Please report any hang to your Intel representative to help with triaging. + + If in doubt, say "Y". + menu "drm/Xe Debugging" depends on DRM_XE depends on EXPERT
drivers/gpu/drm/xe/Makefile +1 -0
@@ -92,6 +92,7 @@ xe-y += xe_bb.o \ xe_gt_topology.o \ xe_guc.o \ xe_guc_ads.o \ + xe_guc_capture.o \ xe_guc_ct.o \ xe_guc_db_mgr.o \ xe_guc_debugfs.o \
drivers/gpu/drm/xe/xe_guc.c +5 -0
@@ -17,6 +17,7 @@#include "xe_force_wake.h" #include "xe_gt.h" #include "xe_guc_ads.h" +#include "xe_guc_capture.h" #include "xe_guc_ct.h" #include "xe_guc_hwconfig.h" #include "xe_guc_log.h"
@@ -290,6 +291,10 @@ int xe_guc_init(struct xe_guc *guc)if (ret) goto out; + ret =xe_guc_capture_init (guc); +if (ret) + goto out; + ret =xe_guc_ads_init (&guc->ads);if (ret) goto out;
drivers/gpu/drm/xe/xe_guc_capture.c new file +46 -0
46 lines not on this page · raw message
drivers/gpu/drm/xe/xe_guc_capture.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2021-2021 Intel Corporation +*/ + +#ifndef _XE_GUC_CAPTURE_H +#define _XE_GUC_CAPTURE_H + +#include <linux/types.h> + +struct xe_guc ; + +int xe_guc_capture_init (struct xe_guc *guc); + +#endif /* _XE_GUC_CAPTURE_H */
Signature · 1 line
2.34.1
PATCH v5 2/8 drm/xe/guc: Update GuC ADS size for error capture
In reply to Zhanjun DongUpdate GuC ADS size allocation to include space for the lists of error state capture register descriptors.
Then, populate GuC ADS with the lists of registers we want GuC to report back to host on engine reset events. This list should include global, engine-class and engine-instance registers for every engine-class type on the current hardware.
Ensure we allocate a persistent store for the register lists that are populated into ADS so that we don't need to allocate memory during GT resets when GuC is reloaded and ADS population happens again.
--- drivers/gpu/drm/xe/xe_guc_ads.c | 229 +++++++++++++++++++- drivers/gpu/drm/xe/xe_guc_ads_types.h | 2 + drivers/gpu/drm/xe/xe_guc_capture.c | 265 +++++++++++++++++++++++ drivers/gpu/drm/xe/xe_guc_capture.h | 5 + drivers/gpu/drm/xe/xe_guc_capture_fwif.h | 177 +++++++++++++++ drivers/gpu/drm/xe/xe_guc_fwif.h | 20 ++ drivers/gpu/drm/xe/xe_guc_types.h | 2 + 7 files changed, 689 insertions(+), 11 deletions(-) create mode 100644 drivers/gpu/drm/xe/xe_guc_capture_fwif.h
drivers/gpu/drm/xe/xe_guc_ads.c +218 -11
@@ -14,6 +14,8 @@#include "xe_gt.h" #include "xe_gt_ccs_mode.h" #include "xe_guc.h" +#include "xe_guc_capture.h" +#include "xe_guc_capture_fwif.h" #include "xe_hw_engine.h" #include "xe_lrc.h" #include "xe_map.h"
@@ -117,6 +119,8 @@ struct __guc_ads_blob {#define info_map_read (xe_, map_, field_) \ xe_map_rd_field(xe_, map_, 0, struct guc_gt_system_info, field_) +static int guc_capture_prep_lists (struct xe_guc_ads *ads); +static size_t guc_ads_regset_size (struct xe_guc_ads *ads) {struct xe_device *xe =ads_to_xe (ads);
@@ -133,8 +137,7 @@ static size_t guc_ads_golden_lrc_size(struct xe_guc_ads *ads)static size_t guc_ads_capture_size (struct xe_guc_ads *ads) { -/* FIXME: Allocate a proper capture list */ -return PAGE_ALIGN (PAGE_SIZE ); +return PAGE_ALIGN (ads->capture_size); }static size_t guc_ads_um_queues_size (struct xe_guc_ads *ads)
@@ -260,6 +263,45 @@ static size_t calculate_golden_lrc_size(struct xe_guc_ads *ads)return total_size; } +#if IS_ENABLED (CONFIG_DRM_XE_CAPTURE_ERROR ) + +static size_t calculate_capture_worst_size (struct xe_guc_ads *ads) +{ +struct xe_guc *guc =ads_to_guc (ads); +size_t total_size, class_size, instance_size, global_size; +int i, j; + +/* Early calcuate the capture size, to reserve capture size before guc init finished, +* as engine mask is not ready, the calculate here is the worst case size +*/ + total_size =PAGE_SIZE ;/* Pad a page in front for empty lists */ +for (i =0 ; i <GUC_CAPTURE_LIST_INDEX_MAX ; i++) { +for (j =0 ; j <GUC_LAST_ENGINE_CLASS ; j++) { + class_size =0 ; + instance_size =0 ; +xe_guc_capture_getlistsize (guc, i,GUC_CAPTURE_LIST_TYPE_ENGINE_CLASS , + j, &class_size); +xe_guc_capture_getlistsize (guc, i,GUC_CAPTURE_LIST_TYPE_ENGINE_INSTANCE , + j, &instance_size); + total_size += class_size + instance_size; + } + global_size =0 ; +xe_guc_capture_getlistsize (guc, i,GUC_CAPTURE_LIST_TYPE_GLOBAL ,0 , &global_size); + total_size +=PAGE_ALIGN (global_size); + } + +return total_size; +} + +#else /* IS_ENABLED(CONFIG_DRM_XE_CAPTURE_ERROR) */ + +static size_t calculate_capture_worst_size (struct xe_guc_ads *ads) +{ +return 0 ; +} + +#endif /* IS_ENABLED(CONFIG_DRM_XE_CAPTURE_ERROR) */ +#define MAX_GOLDEN_LRC_SIZE (SZ_4K * 64)int xe_guc_ads_init (struct xe_guc_ads *ads)
@@ -270,6 +312,7 @@ int xe_guc_ads_init(struct xe_guc_ads *ads)struct xe_bo *bo; ads->golden_lrc_size =calculate_golden_lrc_size (ads); + ads->capture_size =calculate_capture_worst_size (ads); ads->regset_size =calculate_regset_size (gt); bo = xe_managed_bo_create_pin_map(xe, tile, guc_ads_size(ads) + MAX_GOLDEN_LRC_SIZE,
@@ -301,9 +344,11 @@ int xe_guc_ads_init_post_hwconfig(struct xe_guc_ads *ads)xe_gt_assert (gt, ads->bo); ads->golden_lrc_size =calculate_golden_lrc_size (ads); + ads->capture_size =0 ;/* Clear capture_size before run guc_capture_prep_lists */ + ads->capture_size =guc_capture_prep_lists (ads); ads->regset_size =calculate_regset_size (gt); -xe_gt_assert (gt, ads->golden_lrc_size + +xe_gt_assert (gt, ads->golden_lrc_size + ads->capture_size + (ads->regset_size - prev_regset_size) <=MAX_GOLDEN_LRC_SIZE );
@@ -393,22 +438,184 @@ static void guc_mapping_table_init(struct xe_gt *gt, } } -static void guc_capture_list_init (struct xe_guc_ads *ads) +#if IS_ENABLED (CONFIG_DRM_XE_CAPTURE_ERROR ) +static u32 guc_get_capture_engine_mask (struct xe_gt *gt,struct iosys_map *info_map, +u32 capture_class) { +struct xe_device *xe =gt_to_xe (gt); +u32 mask; + +switch (capture_class) { +case GUC_CAPTURE_LIST_CLASS_RENDER_COMPUTE : + mask =info_map_read (xe, info_map, engine_enabled_masks[GUC_RENDER_CLASS ]); + mask |=info_map_read (xe, info_map, engine_enabled_masks[GUC_COMPUTE_CLASS ]); +break ; + +case GUC_CAPTURE_LIST_CLASS_VIDEO : + mask =info_map_read (xe, info_map, engine_enabled_masks[GUC_VIDEO_CLASS ]); +break ; + +case GUC_CAPTURE_LIST_CLASS_VIDEOENHANCE : + mask =info_map_read (xe, info_map, engine_enabled_masks[GUC_VIDEOENHANCE_CLASS ]); +break ; + +case GUC_CAPTURE_LIST_CLASS_BLITTER : + mask =info_map_read (xe, info_map, engine_enabled_masks[GUC_BLITTER_CLASS ]); +break ; + +case GUC_CAPTURE_LIST_CLASS_GSC_OTHER : + mask =info_map_read (xe, info_map, engine_enabled_masks[GUC_GSC_OTHER_CLASS ]); +break ; + +default : + mask =0 ; + } + +return mask; +} + +static int guc_capture_prep_lists (struct xe_guc_ads *ads) +{ +struct xe_guc *guc =ads_to_guc (ads); +struct xe_gt *gt =ads_to_gt (ads); +u32 ads_ggtt, capture_offset, null_ggtt, total_size =0 ; +struct iosys_map info_map; +bool ads_is_mapped; +size_t size =0 ; +void *ptr;int i, j; -u32 addr =xe_bo_ggtt_addr (ads->bo) +guc_ads_capture_offset (ads); -/* FIXME: Populate a proper capture list */ + ads_is_mapped = ads->capture_size !=0 ; +if (ads_is_mapped) { + capture_offset =guc_ads_capture_offset (ads); + ads_ggtt =xe_bo_ggtt_addr (ads->bo); + info_map =IOSYS_MAP_INIT_OFFSET (ads_to_map (ads), + offsetof(struct __guc_ads_blob , system_info)); + }else { +/* Bail with worst case size calculations */ + total_size =calculate_capture_worst_size (ads); +return total_size; + } + +/* first, set aside the first page for a capture_list with zero descriptors */ + total_size =PAGE_SIZE ; +if (!xe_guc_capture_getnullheader (guc, &ptr, &size)) +xe_map_memcpy_to (ads_to_xe (ads),ads_to_map (ads), capture_offset, ptr, size); + + null_ggtt = ads_ggtt + capture_offset; + capture_offset +=PAGE_SIZE ; + +/* Populate capture list : at this point adps is already allocated and mapped to worst case +* size +*/ for (i =0 ; i <GUC_CAPTURE_LIST_INDEX_MAX ; i++) { -for (j =0 ; j <GUC_MAX_ENGINE_CLASSES ; j++) { -ads_blob_write (ads, ads.capture_instance[i][j], addr); -ads_blob_write (ads, ads.capture_class[i][j], addr); +bool write_empty_list; + +for (j =0 ; j <GUC_LAST_ENGINE_CLASS ; j++) { +u32 engine_mask =guc_get_capture_engine_mask (gt, &info_map, j); +/* null list if we dont have said engine or list */ +if (!engine_mask) { +ads_blob_write (ads, ads.capture_class[i][j], null_ggtt); +ads_blob_write (ads, ads.capture_instance[i][j], null_ggtt); +continue ; + } +/********************************************************/ +/*** engine exists: start with engine-class registers ***/ +/********************************************************/ + write_empty_list = true;/* starting assumption is an empty list */ + size =0 ; +if (!xe_guc_capture_getlistsize (guc, i, +GUC_CAPTURE_LIST_TYPE_ENGINE_CLASS , + j, &size)) { +if (total_size + size > ads->capture_size) +xe_gt_dbg (gt,"Capture size overflow :%lu vs %d\n" , + total_size + size, ads->capture_size); +else if (!xe_guc_capture_getlist (guc, i, +GUC_CAPTURE_LIST_TYPE_ENGINE_CLASS , + j, &ptr)) +/* everything checked out, populate! */ + write_empty_list = false; + } +if (!write_empty_list) { +ads_blob_write (ads, ads.capture_class[i][j], + ads_ggtt + capture_offset); +xe_map_memcpy_to (ads_to_xe (ads),ads_to_map (ads), capture_offset, + ptr, size); + total_size += size; + capture_offset += size; + }else { +ads_blob_write (ads, ads.capture_class[i][j], null_ggtt); + } + +/********************************************************/ +/*** engine exists: next, engine-instance registers ***/ +/********************************************************/ + write_empty_list = true;/* starting assumption is an empty list */ + size =0 ; +if (!xe_guc_capture_getlistsize (guc, i, +GUC_CAPTURE_LIST_TYPE_ENGINE_INSTANCE , + j, &size)) { +if (total_size + size > ads->capture_size) +xe_gt_dbg (gt,"Capture size overflow :%lu vs %d\n" , + total_size + size, ads->capture_size); +else if (!xe_guc_capture_getlist (guc, i, +GUC_CAPTURE_LIST_TYPE_ENGINE_INSTANCE , + j, &ptr)) +/* everything checked out, populate! */ + write_empty_list = false; + } + +if (!write_empty_list) { +ads_blob_write (ads, ads.capture_instance[i][j], + ads_ggtt + capture_offset); +xe_map_memcpy_to (ads_to_xe (ads),ads_to_map (ads), capture_offset, + ptr, size); + total_size += size; + capture_offset += size; + }else { +ads_blob_write (ads, ads.capture_instance[i][j], null_ggtt); + } } -ads_blob_write (ads, ads.capture_global[i], addr); +/********************************************************/ +/*** global registers is last in our PF/VF loops ***/ +/********************************************************/ + write_empty_list = true;/* starting assumption is an empty list */ + size =0 ; +if (!xe_guc_capture_getlistsize (guc, i,GUC_CAPTURE_LIST_TYPE_GLOBAL ,0 , &size)) { +if (total_size + size > ads->capture_size) +xe_gt_dbg (gt,"Capture size overflow :%lu vs %d\n" , + total_size + size, ads->capture_size); +else if (!xe_guc_capture_getlist (guc, i,GUC_CAPTURE_LIST_TYPE_GLOBAL ,0 , + &ptr)) + write_empty_list = false;/* everything checked out, populate! */ + } +if (!write_empty_list) { +ads_blob_write (ads, ads.capture_global[i], ads_ggtt + capture_offset); +xe_map_memcpy_to (ads_to_xe (ads),ads_to_map (ads), capture_offset, ptr, + size); + total_size += size; + capture_offset += size; + }else { +ads_blob_write (ads, ads.capture_global[i], null_ggtt); + } } + +if (ads->capture_size !=PAGE_ALIGN (total_size)) +xe_gt_info (gt,"ADS capture alloc size changed from %d to %d\n" , + ads->capture_size,PAGE_ALIGN (total_size)); +return PAGE_ALIGN (total_size); } +#else /* IS_ENABLED(CONFIG_DRM_XE_CAPTURE_ERROR) */ + +static int guc_capture_prep_lists (struct xe_guc_ads *ads) +{ +return 0 ; +} + +#endif /* IS_ENABLED(CONFIG_DRM_XE_CAPTURE_ERROR) */ + static void guc_mmio_regset_write_one(struct xe_guc_ads *ads, struct iosys_map *regset_map, struct xe_reg reg,
@@ -595,7 +802,7 @@ void xe_guc_ads_populate(struct xe_guc_ads *ads)guc_mmio_reg_state_init (ads);guc_prep_golden_lrc_null (ads);guc_mapping_table_init (gt, &info_map); -guc_capture_list_init (ads); +guc_capture_prep_lists (ads);guc_doorbell_init (ads);if (xe->info.has_usm) {
drivers/gpu/drm/xe/xe_guc_ads_types.h +2 -0
@@ -20,6 +20,8 @@ struct xe_guc_ads {size_t golden_lrc_size;/** @regset_size: size of register set passed to GuC for save/restore */ u32 regset_size; +/** @capture_size: size of register set passed to GuC for capture */ + u32 capture_size; };#endif
drivers/gpu/drm/xe/xe_guc_capture.c +265 -0
279 lines not on this page · raw message
drivers/gpu/drm/xe/xe_guc_capture.h +5 -0
@@ -7,9 +7,14 @@#define _XE_GUC_CAPTURE_H#include <linux/types.h> +#include "xe_exec_queue_types.h" struct xe_guc ; +void xe_guc_capture_process (struct xe_guc *guc); +int xe_guc_capture_getlist (struct xe_guc *guc,u32 owner,u32 type,u32 classid,void **outptr); +int xe_guc_capture_getlistsize (struct xe_guc *guc,u32 owner,u32 type,u32 classid,size_t *size); +int xe_guc_capture_getnullheader (struct xe_guc *guc,void **outptr,size_t *size);int xe_guc_capture_init (struct xe_guc *guc);#endif /* _XE_GUC_CAPTURE_H */
drivers/gpu/drm/xe/xe_guc_capture_fwif.h new file +177 -0
177 lines not on this page · raw message
drivers/gpu/drm/xe/xe_guc_fwif.h +20 -0
@@ -9,6 +9,7 @@#include <linux/bits.h> #include "abi/guc_klvs_abi.h" +#include "xe_hw_engine_types.h" #define G2H_LEN_DW_SCHED_CONTEXT_MODE_SET 4#define G2H_LEN_DW_DEREGISTER_CONTEXT 3
@@ -164,6 +165,8 @@ struct guc_mmio_reg {#define GUC_REGSET_MASKED BIT(0)#define GUC_REGSET_MASKED_WITH_VALUE BIT(2)#define GUC_REGSET_RESTORE_ONLY BIT(3) +#define GUC_REGSET_STEERING_GROUP GENMASK(15, 12) +#define GUC_REGSET_STEERING_INSTANCE GENMASK(23, 20) } __packed;/* GuC register sets */
@@ -192,6 +195,23 @@ enum { GUC_CAPTURE_LIST_INDEX_MAX = 2, }; +/*Register-types of GuC capture register lists */ +enum guc_capture_type { +GUC_CAPTURE_LIST_TYPE_GLOBAL =0 , +GUC_CAPTURE_LIST_TYPE_ENGINE_CLASS , +GUC_CAPTURE_LIST_TYPE_ENGINE_INSTANCE , +GUC_CAPTURE_LIST_TYPE_MAX , +}; + +/* Class indecies for capture_class and capture_instance arrays */ +enum { +GUC_CAPTURE_LIST_CLASS_RENDER_COMPUTE =0 , +GUC_CAPTURE_LIST_CLASS_VIDEO =1 , +GUC_CAPTURE_LIST_CLASS_VIDEOENHANCE =2 , +GUC_CAPTURE_LIST_CLASS_BLITTER =3 , +GUC_CAPTURE_LIST_CLASS_GSC_OTHER =4 , +}; +/* GuC Additional Data Struct */ struct guc_ads {struct guc_mmio_reg_set reg_state_list[GUC_MAX_ENGINE_CLASSES ][GUC_MAX_INSTANCES_PER_CLASS ];
drivers/gpu/drm/xe/xe_guc_types.h +2 -0
@@ -43,6 +43,8 @@ struct xe_guc {struct xe_guc_ads ads;/** @ct: GuC ct */ struct xe_guc_ct ct; +/** @capture: the error-state-capture module's data and objects */ +struct xe_guc_state_capture *capture;/** @pc: GuC Power Conservation */ struct xe_guc_pc pc;/** @dbm: GuC Doorbell Manager */
Signature · 1 line
2.34.1
PATCH v5 3/8 drm/xe/guc: Add XE_LP steered register lists
In reply to Zhanjun DongAdd the ability for runtime allocation and freeing of steered register list extentions that depend on the detected HW config fuses.
Add referenced registers defines and list of registers.
--- drivers/gpu/drm/xe/regs/xe_gt_regs.h | 5 + drivers/gpu/drm/xe/xe_guc_capture.c | 208 ++++++++++++++++++++++++++- 2 files changed, 211 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/regs/xe_gt_regs.h +5 -0
@@ -94,6 +94,8 @@#define FF_MODE2_TDS_TIMER_MASK REG_GENMASK(23, 16)#define FF_MODE2_TDS_TIMER_128 REG_FIELD_PREP(FF_MODE2_TDS_TIMER_MASK, 4) +#define XEHPG_INSTDONE_GEOM_SVG XE_REG_MCR(0x666c) +#define CACHE_MODE_1 XE_REG(0x7004, XE_REG_OPTION_MASKED)#define MSAA_OPTIMIZATION_REDUC_DISABLE REG_BIT(11)
@@ -323,6 +325,9 @@#define INVALIDATION_BROADCAST_MODE_DIS REG_BIT(12)#define GLOBAL_INVALIDATION_MODE REG_BIT(2) +#define SAMPLER_INSTDONE XE_REG_MCR(0xe160) +#define ROW_INSTDONE XE_REG_MCR(0xe164) +#define HALF_SLICE_CHICKEN5 XE_REG_MCR(0xe188, XE_REG_OPTION_MASKED)#define DISABLE_SAMPLE_G_PERFORMANCE REG_BIT(0)
drivers/gpu/drm/xe/xe_guc_capture.c +206 -2
223 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v5 4/8 drm/xe/guc: Add capture size check in GuC log buffer
In reply to Zhanjun DongThe capture-nodes is included in GuC log buffer, add the size check for capture region in the whole GuC log buffer.
--- drivers/gpu/drm/xe/xe_gt_printk.h | 3 + drivers/gpu/drm/xe/xe_guc_fwif.h | 48 +++++++ drivers/gpu/drm/xe/xe_guc_log.c | 179 ++++++++++++++++++++++++++ drivers/gpu/drm/xe/xe_guc_log.h | 15 +++ drivers/gpu/drm/xe/xe_guc_log_types.h | 26 ++++ 5 files changed, 271 insertions(+)
drivers/gpu/drm/xe/xe_gt_printk.h +3 -0
@@ -22,6 +22,9 @@#define xe_gt_notice (_gt, _fmt, ...) \ xe_gt_printk((_gt), notice, _fmt, ##__VA_ARGS__) +#define xe_gt_notice_ratelimited (_gt, _fmt, ...) \ + xe_gt_printk((_gt), err_ratelimited, _fmt, ##__VA_ARGS__) +#define xe_gt_info (_gt, _fmt, ...) \ xe_gt_printk((_gt), info, _fmt, ##__VA_ARGS__)
drivers/gpu/drm/xe/xe_guc_fwif.h +48 -0
54 lines not on this page · raw message
drivers/gpu/drm/xe/xe_guc_log.c +179 -0
191 lines not on this page · raw message
drivers/gpu/drm/xe/xe_guc_log.h +15 -0
@@ -7,6 +7,7 @@#define _XE_GUC_LOG_H_#include "xe_guc_log_types.h" +#include "xe_guc_types.h" struct drm_printer ;
@@ -36,6 +37,11 @@ struct drm_printer;#define GUC_VERBOSITY_TO_LOG_LEVEL (x) ((x) + 2)#define GUC_LOG_LEVEL_MAX GUC_VERBOSITY_TO_LOG_LEVEL(GUC_LOG_VERBOSITY_MAX) +static inline struct xe_guc *log_to_guc (struct xe_guc_log *log) +{ + return container_of(log, struct xe_guc, log); +} +int xe_guc_log_init (struct xe_guc_log *log);void xe_guc_log_print (struct xe_guc_log *log,struct drm_printer *p);
@@ -45,4 +51,13 @@ xe_guc_log_get_level(struct xe_guc_log *log) return log->level; } +u32 xe_guc_log_section_size_capture (struct xe_guc_log *log); + +bool xe_guc_check_log_buf_overflow (struct xe_guc_log *log, +enum guc_log_buffer_type type, +unsigned int full_cnt); +unsigned int xe_guc_get_log_buffer_size (struct xe_guc_log *log, +enum guc_log_buffer_type type); +size_t xe_guc_get_log_buffer_offset (struct xe_guc_log *log, +enum guc_log_buffer_type type);#endif
drivers/gpu/drm/xe/xe_guc_log_types.h +26 -0
@@ -6,7 +6,17 @@#ifndef _XE_GUC_LOG_TYPES_H_#define _XE_GUC_LOG_TYPES_H_ +#include <linux/mutex.h> #include <linux/types.h> +#include <linux/workqueue.h> +#include "xe_guc_fwif.h" + +enum { +GUC_LOG_SECTIONS_CRASH , +GUC_LOG_SECTIONS_DEBUG , +GUC_LOG_SECTIONS_CAPTURE , +GUC_LOG_SECTIONS_LIMIT +};struct xe_bo ;
@@ -18,6 +28,22 @@ struct xe_guc_log {u32 level;/** @bo: XE BO for GuC log */ struct xe_bo *bo; + +/* Allocation settings */ +struct { +s32 bytes;/* Size in bytes */ +s32 units;/* GuC API units - 1MB or 4KB */ +s32 count;/* Number of API units */ +u32 flag;/* GuC API units flag */ + } sizes[GUC_LOG_SECTIONS_LIMIT ]; +bool sizes_initialised; + +/* logging related stats */ +struct { +u32 sampled_overflow; +u32 overflow; +u32 flush; + } stats[GUC_MAX_LOG_BUFFER]; };#endif
Signature · 1 line
2.34.1
PATCH v5 5/8 drm/xe/guc: Check sizing of guc_capture output
In reply to Zhanjun DongAdd capture output size check function to provide a reasonable minimum size for error capture region before allocating the shared buffer.
Add guc capture data structure definition.
--- drivers/gpu/drm/xe/xe_guc_capture.c | 76 ++++++++++++++++++++++++ drivers/gpu/drm/xe/xe_guc_capture_fwif.h | 45 ++++++++++++++ 2 files changed, 121 insertions(+)
drivers/gpu/drm/xe/xe_guc_capture.c +76 -0
@@ -491,6 +491,81 @@ xe_guc_capture_getnullheader(struct xe_guc *guc, void **outptr, size_t *size)return 0 ; } +static int +guc_capture_output_min_size_est (struct xe_guc *guc) +{ +struct xe_gt *gt =guc_to_gt (guc); +struct xe_hw_engine *hwe; +enum xe_hw_engine_id id; + +int worst_min_size =0 ; +size_t tmp =0 ; + +if (!guc->capture) +return -ENODEV ; + +/* +* If every single engine-instance suffered a failure in quick succession but +* were all unrelated, then a burst of multiple error-capture events would dump +* registers for every one engine instance, one at a time. In this case, GuC +* would even dump the global-registers repeatedly. +* +* For each engine instance, there would be 1 x guc_state_capture_group_t output +* followed by 3 x guc_state_capture_t lists. The latter is how the register +* dumps are split across different register types (where the '3' are global vs class +* vs instance). +*/ +for_each_hw_engine (hwe, gt, id) { + worst_min_size +=sizeof (struct guc_state_capture_group_header_t ) + + (3 *sizeof (struct guc_state_capture_header_t )); + +if (!guc_capture_getlistsize (guc,0 ,GUC_CAPTURE_LIST_TYPE_GLOBAL ,0 , &tmp, true)) + worst_min_size += tmp; + +if (!guc_capture_getlistsize (guc,0 ,GUC_CAPTURE_LIST_TYPE_ENGINE_CLASS , + hwe->class, &tmp, true)) { + worst_min_size += tmp; + } +if (!guc_capture_getlistsize (guc,0 ,GUC_CAPTURE_LIST_TYPE_ENGINE_INSTANCE , + hwe->class, &tmp, true)) { + worst_min_size += tmp; + } + } + +return worst_min_size; +} + +/* +* Add on a 3x multiplier to allow for multiple back-to-back captures occurring +* before the i915 can read the data out and process it +*/ +#define GUC_CAPTURE_OVERBUFFER_MULTIPLIER 3 + +static void check_guc_capture_size (struct xe_guc *guc) +{ +int min_size =guc_capture_output_min_size_est (guc); +int spare_size = min_size *GUC_CAPTURE_OVERBUFFER_MULTIPLIER ; +u32 buffer_size =xe_guc_log_section_size_capture (&guc->log); + +/* +* NOTE: min_size is much smaller than the capture region allocation (DG2: <80K vs 1MB) +* Additionally, its based on space needed to fit all engines getting reset at once +* within the same G2H handler task slot. This is very unlikely. However, if GuC really +* does run out of space for whatever reason, we will see an separate warning message +* when processing the G2H event capture-notification, search for: +* xe_guc_STATE_CAPTURE_EVENT_STATUS_NOSPACE. +*/ +if (min_size <0 ) +xe_gt_warn (guc_to_gt (guc),"Failed to calculate error state capture buffer minimum size: %d!\n" , + min_size); +else if (min_size > buffer_size) +xe_gt_warn (guc_to_gt (guc),"Error state capture buffer maybe small: %d < %d\n" , + buffer_size, min_size); +else if (spare_size > buffer_size) +xe_gt_dbg (guc_to_gt (guc),"Error state capture buffer lacks spare size: %d < %d (min = %d)\n" , + buffer_size, spare_size, min_size); +} +int xe_guc_capture_init (struct xe_guc *guc) { guc->capture =kzalloc (sizeof (*guc->capture),GFP_KERNEL );
@@ -502,6 +577,7 @@ int xe_guc_capture_init(struct xe_guc *guc)INIT_LIST_HEAD (&guc->capture->outlist);INIT_LIST_HEAD (&guc->capture->cachelist); +check_guc_capture_size (guc);return 0 ; }
drivers/gpu/drm/xe/xe_guc_capture_fwif.h +45 -0
51 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v5 6/8 drm/xe/guc: Extract GuC error capture lists on G2H notification
In reply to Zhanjun DongUpon the G2H Notify-Err-Capture event, parse through the GuC Log Buffer (error-capture-subregion) and generate one or more capture-nodes. A single node represents a single "engine- instance-capture-dump" and contains at least 3 register lists:
global, engine-class and engine-instance. An internal link list is maintained to store one or more nodes.
Because the link-list node generation happen before the call to devcoredump, duplicate global and engine-class register lists for each engine-instance register dump if we find dependent-engine resets in a engine-capture-group.
--- drivers/gpu/drm/xe/abi/guc_actions_abi.h | 7 + drivers/gpu/drm/xe/xe_guc_capture.c | 576 +++++++++++++++++++++++ drivers/gpu/drm/xe/xe_guc_ct.c | 2 + drivers/gpu/drm/xe/xe_guc_submit.c | 21 +- drivers/gpu/drm/xe/xe_guc_submit.h | 3 + 5 files changed, 608 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/abi/guc_actions_abi.h +7 -0
@@ -182,6 +182,13 @@ enum xe_guc_sleep_state_status {#define GUC_LOG_CONTROL_VERBOSITY_MASK (0xF << GUC_LOG_CONTROL_VERBOSITY_SHIFT)#define GUC_LOG_CONTROL_DEFAULT_LOGGING (1 << 8) +enum intel_guc_state_capture_event_status { +XE_GUC_STATE_CAPTURE_EVENT_STATUS_SUCCESS =0x0 , +XE_GUC_STATE_CAPTURE_EVENT_STATUS_NOSPACE =0x1 , +}; + +#define XE_GUC_STATE_CAPTURE_EVENT_STATUS_MASK 0x000000FF +#define XE_GUC_TLB_INVAL_TYPE_SHIFT 0#define XE_GUC_TLB_INVAL_MODE_SHIFT 8/* Flush PPC or SMRO caches along with TLB invalidation request */
drivers/gpu/drm/xe/xe_guc_capture.c +576 -0
588 lines not on this page · raw message
drivers/gpu/drm/xe/xe_guc_ct.c +2 -0
@@ -1035,6 +1035,8 @@ static int process_g2h_msg(struct xe_guc_ct *ct, u32 *msg, u32 len)/* Selftest only at the moment */ break ;case XE_GUC_ACTION_STATE_CAPTURE_NOTIFICATION : + ret =xe_guc_error_capture_handler (guc, payload, adj_len); +break ;case XE_GUC_ACTION_NOTIFY_FLUSH_LOG_BUFFER_TO_FILE :/* FIXME: Handle this */ break ;
drivers/gpu/drm/xe/xe_guc_submit.c +20 -1
@@ -25,6 +25,7 @@#include "xe_gt.h" #include "xe_gt_printk.h" #include "xe_guc.h" +#include "xe_guc_capture.h" #include "xe_guc_ct.h" #include "xe_guc_exec_queue_types.h" #include "xe_guc_submit_types.h"
@@ -759,7 +760,7 @@ static void guc_exec_queue_free_job(struct drm_sched_job *drm_job)xe_sched_job_put (job); } -static int guc_read_stopped (struct xe_guc *guc) +int guc_read_stopped (struct xe_guc *guc) {return atomic_read (&guc->submission_state.stopped); }
@@ -1682,6 +1683,24 @@ int xe_guc_exec_queue_reset_handler(struct xe_guc *guc, u32 *msg, u32 len)return 0 ; } +int xe_guc_error_capture_handler (struct xe_guc *guc,u32 *msg,u32 len) +{ +u32 status; + +if (unlikely (len !=1 )) { +xe_gt_dbg (guc_to_gt (guc),"Invalid length %u" , len); +return -EPROTO ; + } + + status = msg[0 ] &XE_GUC_STATE_CAPTURE_EVENT_STATUS_MASK ; +if (status ==XE_GUC_STATE_CAPTURE_EVENT_STATUS_NOSPACE ) +xe_gt_warn (guc_to_gt (guc),"G2H-Error capture no space" ); + +xe_guc_capture_process (guc); + +return 0 ; +} +int xe_guc_exec_queue_memory_cat_error_handler (struct xe_guc *guc,u32 *msg,u32 len) {
drivers/gpu/drm/xe/xe_guc_submit.h +3 -0
@@ -19,12 +19,15 @@ void xe_guc_submit_reset_wait(struct xe_guc *guc);int xe_guc_submit_stop (struct xe_guc *guc);int xe_guc_submit_start (struct xe_guc *guc); +int guc_read_stopped (struct xe_guc *guc); +int xe_guc_sched_done_handler (struct xe_guc *guc,u32 *msg,u32 len);int xe_guc_deregister_done_handler (struct xe_guc *guc,u32 *msg,u32 len);int xe_guc_exec_queue_reset_handler (struct xe_guc *guc,u32 *msg,u32 len);int xe_guc_exec_queue_memory_cat_error_handler (struct xe_guc *guc,u32 *msg,u32 len);int xe_guc_exec_queue_reset_failure_handler (struct xe_guc *guc,u32 *msg,u32 len); +int xe_guc_error_capture_handler (struct xe_guc *guc,u32 *msg,u32 len);struct xe_guc_submit_exec_queue_snapshot *xe_guc_exec_queue_snapshot_capture (struct xe_sched_job *job);
Signature · 1 line
2.34.1
PATCH v5 7/8 drm/xe/guc: Pre-allocate output nodes for extraction
In reply to Zhanjun DongPre-allocate a fixed number of empty nodes up front (at the time of ADS registration) that we can consume from or return to an internal cached list of nodes.
--- drivers/gpu/drm/xe/xe_guc.c | 1 + drivers/gpu/drm/xe/xe_guc_capture.c | 161 ++++++++++++++++++++++++++++ drivers/gpu/drm/xe/xe_guc_capture.h | 1 + 3 files changed, 163 insertions(+)
drivers/gpu/drm/xe/xe_guc.c +1 -0
@@ -253,6 +253,7 @@ static void guc_fini(struct drm_device *drm, void *arg)xe_force_wake_get (gt_to_fw (guc_to_gt (guc)),XE_FORCEWAKE_ALL );xe_guc_pc_fini (&guc->pc); +xe_guc_capture_destroy (guc);xe_uc_fini_hw (&guc_to_gt (guc)->uc);xe_force_wake_put (gt_to_fw (guc_to_gt (guc)),XE_FORCEWAKE_ALL ); }
drivers/gpu/drm/xe/xe_guc_capture.c +161 -0
203 lines not on this page · raw message
drivers/gpu/drm/xe/xe_guc_capture.h +1 -0
@@ -15,6 +15,7 @@ void xe_guc_capture_process(struct xe_guc *guc);int xe_guc_capture_getlist (struct xe_guc *guc,u32 owner,u32 type,u32 classid,void **outptr);int xe_guc_capture_getlistsize (struct xe_guc *guc,u32 owner,u32 type,u32 classid,size_t *size);int xe_guc_capture_getnullheader (struct xe_guc *guc,void **outptr,size_t *size); +void xe_guc_capture_destroy (struct xe_guc *guc);int xe_guc_capture_init (struct xe_guc *guc);#endif /* _XE_GUC_CAPTURE_H */
Signature · 1 line
2.34.1
PATCH v5 8/8 drm/xe/guc: Plumb GuC-capture into dev coredump
In reply to Zhanjun DongAdd xe_hw_engine_snapshot_from_capture to take snapshot from capture node list.
Add data struct to map register to a snapshot field, although all field is mapped now, which means the offset could be optimized out, while in the future, depends on system configuration, the field might not be consecutive, keep the offset is reserved for future.
--- drivers/gpu/drm/xe/xe_guc_capture.c | 46 ++-- drivers/gpu/drm/xe/xe_guc_capture_fwif.h | 1 - drivers/gpu/drm/xe/xe_hw_engine.c | 257 +++++++++++++++++------ drivers/gpu/drm/xe/xe_hw_engine.h | 4 + drivers/gpu/drm/xe/xe_hw_engine_types.h | 96 +++++---- 5 files changed, 279 insertions(+), 125 deletions(-)
drivers/gpu/drm/xe/xe_guc_capture.c +25 -21
@@ -38,28 +38,33 @@* from the engine-mmio-base */ #define COMMON_XELP_BASE_GLOBAL \ - { FORCEWAKE_GT, 0, 0, "FORCEWAKE" } + { FORCEWAKE_GT, 0, 0}#define COMMON_BASE_ENGINE_INSTANCE \ - { RING_ESR(0), 0, 0, "ESR" }, \ - { RING_EMR(0), 0, 0, "EMR" }, \ - { RING_EIR(0), 0, 0, "EIR" }, \ - { RING_EXECLIST_STATUS_HI(0), 0, 0, "RING_EXECLIST_STATUS_HI" }, \ - { RING_EXECLIST_STATUS_LO(0), 0, 0, "RING_EXECLIST_STATUS_LO" }, \ - { RING_DMA_FADD(0), 0, 0, "RING_DMA_FADD_LDW" }, \ - { RING_DMA_FADD_UDW(0), 0, 0, "RING_DMA_FADD_UDW" }, \ - { RING_IPEHR(0), 0, 0, "IPEHR" }, \ - { RING_BBADDR(0), 0, 0, "RING_BBADDR_LOW32" }, \ - { RING_BBADDR_UDW(0), 0, 0, "RING_BBADDR_UP32" }, \ - { RING_ACTHD(0), 0, 0, "ACTHD_LDW" }, \ - { RING_ACTHD_UDW(0), 0, 0, "ACTHD_UDW" }, \ - { RING_START(0), 0, 0, "START" }, \ - { RING_HEAD(0), 0, 0, "HEAD" }, \ - { RING_TAIL(0), 0, 0, "TAIL" }, \ - { RING_CTL(0), 0, 0, "CTL" }, \ - { RING_MI_MODE(0), 0, 0, "MODE" }, \ - { RING_HWS_PGA(0), 0, 0, "HWS" }, \ - { RING_MODE(0), 0, 0, "GFX_MODE" } + { RING_ESR(0), 0, 0}, \ + { RING_EMR(0), 0, 0}, \ + { RING_EIR(0), 0, 0}, \ + { RING_IMR(0), 0, 0}, \ + { RING_IPEHR(0), 0, 0}, \ + { RING_START(0), 0, 0}, \ + { RING_HEAD(0), 0, 0}, \ + { RING_TAIL(0), 0, 0}, \ + { RING_CTL(0), 0, 0}, \ + { RING_MI_MODE(0), 0, 0}, \ + { RING_HWSTAM(0), 0, 0}, \ + { RING_HWS_PGA(0), 0, 0}, \ + { RING_EXECLIST_STATUS_HI(0), 0, 0}, \ + { RING_EXECLIST_STATUS_LO(0), 0, 0}, \ + { RING_EXECLIST_SQ_CONTENTS_HI(0), 0, 0}, \ + { RING_EXECLIST_SQ_CONTENTS_LO(0), 0, 0}, \ + { RING_DMA_FADD(0), 0, 0}, \ + { RING_DMA_FADD_UDW(0), 0, 0}, \ + { RING_BBADDR(0), 0, 0}, \ + { RING_BBADDR_UDW(0), 0, 0}, \ + { RING_ACTHD(0), 0, 0}, \ + { RING_ACTHD_UDW(0), 0, 0}, \ + { RING_MODE(0), 0, 0}, \ + { RCU_MODE, 0, 0}/* XE_LP Global */ static const struct __guc_mmio_reg_descr xe_lp_global_regs[] = {
@@ -218,7 +223,6 @@ static void __fill_ext_reg(struct __guc_mmio_reg_descr *ext, ext->reg =XE_REG (extlist->reg.__reg.addr); ext->flags =FIELD_PREP (GUC_REGSET_STEERING_GROUP , slice_id); ext->flags |=FIELD_PREP (GUC_REGSET_STEERING_INSTANCE , subslice_id); - ext->regname = extlist->name; } static int
drivers/gpu/drm/xe/xe_guc_capture_fwif.h +0 -1
@@ -86,7 +86,6 @@ struct __guc_mmio_reg_descr {struct xe_reg reg;u32 flags;u32 mask; -const char *regname; };struct __guc_mmio_reg_descr_group {
drivers/gpu/drm/xe/xe_hw_engine.c +194 -63
300 lines not on this page · raw message
drivers/gpu/drm/xe/xe_hw_engine.h +4 -0
@@ -62,6 +62,10 @@ void xe_hw_engine_print(struct xe_hw_engine *hwe, struct drm_printer *p);void xe_hw_engine_setup_default_lrc_state (struct xe_hw_engine *hwe);bool xe_hw_engine_is_reserved (struct xe_hw_engine *hwe); +void xe_hw_engine_snapshot_from_engine (struct xe_hw_engine *hwe, +struct xe_hw_engine_snapshot *snapshot); +void xe_hw_engine_snapshot_from_capture (struct xe_hw_engine *hwe, +struct xe_hw_engine_snapshot *snapshot);static inline bool xe_hw_engine_is_valid (struct xe_hw_engine *hwe) {return hwe->name;
drivers/gpu/drm/xe/xe_hw_engine_types.h +56 -40
108 lines not on this page · raw message
Signature · 1 line
2.34.1
Patchwork
CI✓ CI.Patch_applied: success for drm/xe/guc: Add GuC based register capture for error capture (rev4)
In reply to Zhanjun Dong== Series Details ==
== Series Details ==
Series: drm/xe/guc: Add GuC based register capture for error capture (rev4)
URL : https://patchwork.freedesktop.org/series/128077/
State : success
== Summary ==
=== Applying kernel patches on branch 'drm-tip' with base: ===
Base commit: 0ec00b509 drm-tip: 2024y-02m-08d-21h-28m-02s UTC integration manifest === git am output follows ===
Applying: drm/xe/guc: Add kconfig for GuC based register capture
Applying: drm/xe/guc: Update GuC ADS size for error capture
Applying: drm/xe/guc: Add XE_LP steered register lists
Applying: drm/xe/guc: Add capture size check in GuC log buffer
Applying: drm/xe/guc: Check sizing of guc_capture output
Applying: drm/xe/guc: Extract GuC error capture lists on G2H notification
Applying: drm/xe/guc: Pre-allocate output nodes for extraction
Applying: drm/xe/guc: Plumb GuC-capture into dev coredump
Patchwork
CI✗ CI.checkpatch: warning for drm/xe/guc: Add GuC based register capture for error capture (rev4)
In reply to Zhanjun Dong== Series Details ==
== Series Details ==
Series: drm/xe/guc: Add GuC based register capture for error capture (rev4)
URL : https://patchwork.freedesktop.org/series/128077/
State : warning
== Summary ==
+ KERNEL=/kernel
+ git clone https://gitlab.freedesktop.org/drm/maintainer-tools mt Cloning into 'mt'...
warning: redirecting to https://gitlab.freedesktop.org/drm/maintainer-tools.git/
+ git -C mt rev-list -n1 origin/master 35591fb8b4d5305b37ce31483f85ac0956eaa536
+ cd /kernel
+ git config --global --add safe.directory /kernel
+ git log -n1
commit 5a10332b6250f6f1a7a2cff95a1e68fce71ee1c0
Author: Zhanjun Dong <[email protected]> Date: Thu Feb 8 13:19:18 2024 -0800
drm/xe/guc: Plumb GuC-capture into dev coredump
Add xe_hw_engine_snapshot_from_capture to take snapshot from capture node list.
Add data struct to map register to a snapshot field, although all field is mapped now, which means the offset could be optimized out, while in the future, depends on system configuration, the field might not be consecutive, keep the offset is reserved for future.
+ /mt/dim checkpatch 0ec00b509299847612a1179af76bb458ba763531 drm-intelb34fc934e drm/xe/guc: Add kconfig for GuC based register capture
Traceback (most recent call last):
File "scripts/spdxcheck.py", line 6, in <module>
from ply import lex, yacc
ModuleNotFoundError: No module named 'ply'
Traceback (most recent call last):
File "scripts/spdxcheck.py", line 6, in <module>
from ply import lex, yacc
ModuleNotFoundError: No module named 'ply'
-:72: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #72:
new file mode 100644
total: 0 errors, 1 warnings, 0 checks, 102 lines checked 9f98d9162 drm/xe/guc: Update GuC ADS size for error capture Traceback (most recent call last):
File "scripts/spdxcheck.py", line 6, in <module>
from ply import lex, yacc
ModuleNotFoundError: No module named 'ply'
-:251: WARNING:LONG_LINE: line length of 103 exceeds 100 columns #251: FILE: drivers/gpu/drm/xe/xe_guc_ads.c:562:
+ GUC_CAPTURE_LIST_TYPE_ENGINE_INSTANCE,
-:369: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'ar' - possible side-effects? #369: FILE: drivers/gpu/drm/xe/xe_guc_capture.c:54:
+#define get_item_with_default(ar, index) (ar[(index) >= ARRAY_SIZE(ar) ? ARRAY_SIZE(ar) - 1 : \
+ (index)])
-:369: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'index' - possible side-effects? #369: FILE: drivers/gpu/drm/xe/xe_guc_capture.c:54:
+#define get_item_with_default(ar, index) (ar[(index) >= ARRAY_SIZE(ar) ? ARRAY_SIZE(ar) - 1 : \
+ (index)])
-:554: WARNING:OOM_MESSAGE: Possible unnecessary 'out of memory' message #554: FILE: drivers/gpu/drm/xe/xe_guc_capture.c:239:
+ if (!caplist) {
+ xe_gt_dbg(guc_to_gt(guc), "Failed to alloc cached register capture list");
-:594: WARNING:OOM_MESSAGE: Possible unnecessary 'out of memory' message #594: FILE: drivers/gpu/drm/xe/xe_guc_capture.c:279:
+ if (!null_header) {
+ xe_gt_dbg(guc_to_gt(guc), "Failed to alloc cached register capture null list");
-:639: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #639:
new file mode 100644
total: 0 errors, 4 warnings, 2 checks, 812 lines checkedff02cb163 drm/xe/guc: Add XE_LP steered register lists
-:52: ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses #52: FILE: drivers/gpu/drm/xe/xe_guc_capture.c:43:
+#define COMMON_BASE_ENGINE_INSTANCE \
+ { RING_ESR(0), 0, 0, "ESR" }, \
+ { RING_EMR(0), 0, 0, "EMR" }, \
+ { RING_EIR(0), 0, 0, "EIR" }, \
+ { RING_EXECLIST_STATUS_HI(0), 0, 0, "RING_EXECLIST_STATUS_HI" }, \
+ { RING_EXECLIST_STATUS_LO(0), 0, 0, "RING_EXECLIST_STATUS_LO" }, \
+ { RING_DMA_FADD(0), 0, 0, "RING_DMA_FADD_LDW" }, \
+ { RING_DMA_FADD_UDW(0), 0, 0, "RING_DMA_FADD_UDW" }, \
+ { RING_IPEHR(0), 0, 0, "IPEHR" }, \
+ { RING_BBADDR(0), 0, 0, "RING_BBADDR_LOW32" }, \
+ { RING_BBADDR_UDW(0), 0, 0, "RING_BBADDR_UP32" }, \
+ { RING_ACTHD(0), 0, 0, "ACTHD_LDW" }, \
+ { RING_ACTHD_UDW(0), 0, 0, "ACTHD_UDW" }, \
+ { RING_START(0), 0, 0, "START" }, \
+ { RING_HEAD(0), 0, 0, "HEAD" }, \
+ { RING_TAIL(0), 0, 0, "TAIL" }, \
+ { RING_CTL(0), 0, 0, "CTL" }, \
+ { RING_MI_MODE(0), 0, 0, "MODE" }, \
+ { RING_HWS_PGA(0), 0, 0, "HWS" }, \
+ { RING_MODE(0), 0, 0, "GFX_MODE" }-:112: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'regslist' - possible side-effects? #112: FILE: drivers/gpu/drm/xe/xe_guc_capture.c:103:
+#define MAKE_REGLIST(regslist, regsowner, regstype, class) \
+ { \
+ regslist, \
+ ARRAY_SIZE(regslist), \
+ TO_GCAP_DEF_OWNER(regsowner), \
+ TO_GCAP_DEF_TYPE(regstype), \
+ class, \
+ NULL, \
+ }
total: 1 errors, 0 warnings, 1 checks, 240 lines checked c05326a02 drm/xe/guc: Add capture size check in GuC log buffer 853c675d2 drm/xe/guc: Check sizing of guc_capture output d72e8f6c4 drm/xe/guc: Extract GuC error capture lists on G2H notification 5ae639402 drm/xe/guc: Pre-allocate output nodes for extraction 5a10332b6 drm/xe/guc: Plumb GuC-capture into dev coredump
Patchwork
CI✗ CI.KUnit: failure for drm/xe/guc: Add GuC based register capture for error capture (rev4)
In reply to Zhanjun Dong== Series Details ==
== Series Details ==
Series: drm/xe/guc: Add GuC based register capture for error capture (rev4)
URL : https://patchwork.freedesktop.org/series/128077/
State : failure
== Summary ==
+ trap cleanup EXIT
+ /kernel/tools/testing/kunit/kunit.py run --kunitconfig /kernel/drivers/gpu/drm/xe/.kunitconfig ERROR:root:../arch/x86/um/user-offsets.c:17:6: warning: no previous prototype for ‘foo’ [-Wmissing-prototypes] 17 | void foo(void)
| ^~~
In file included from ../arch/um/kernel/asm-offsets.c:1:../arch/x86/um/shared/sysdep/kernel-offsets.h:9:6: warning: no previous prototype for ‘foo’ [-Wmissing-prototypes]
9 | void foo(void)
| ^~~../arch/x86/um/fault.c:18:5: warning: no previous prototype for ‘arch_fixup’ [-Wmissing-prototypes]
18 | int arch_fixup(unsigned long address, struct uml_pt_regs *regs)
| ^~~~~~~~~~
../arch/x86/um/bugs_64.c:9:6: warning: no previous prototype for ‘arch_check_bugs’ [-Wmissing-prototypes]
9 | void arch_check_bugs(void)
| ^~~~~~~~~~~~~~~../arch/x86/um/bugs_64.c:13:6: warning: no previous prototype for ‘arch_examine_signal’ [-Wmissing-prototypes]
13 | void arch_examine_signal(int sig, struct uml_pt_regs *regs)
| ^~~~~~~~~~~~~~~~~~~
../arch/x86/um/os-Linux/mcontext.c:7:6: warning: no previous prototype for ‘get_regs_from_mc’ [-Wmissing-prototypes]
7 | void get_regs_from_mc(struct uml_pt_regs *regs, mcontext_t *mc)
| ^~~~~~~~~~~~~~~~../arch/x86/um/os-Linux/registers.c:146:15: warning: no previous prototype for ‘get_thread_reg’ [-Wmissing-prototypes]
146 | unsigned long get_thread_reg(int reg, jmp_buf *buf)
| ^~~~~~~~~~~~~~
../arch/x86/um/vdso/um_vdso.c:16:5: warning: no previous prototype for ‘__vdso_clock_gettime’ [-Wmissing-prototypes]
16 | int __vdso_clock_gettime(clockid_t clock, struct __kernel_old_timespec *ts)
| ^~~~~~~~~~~~~~~~~~~~
../arch/x86/um/vdso/um_vdso.c:30:5: warning: no previous prototype for ‘__vdso_gettimeofday’ [-Wmissing-prototypes]
30 | int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz)
| ^~~~~~~~~~~~~~~~~~~
../arch/x86/um/vdso/um_vdso.c:44:21: warning: no previous prototype for ‘__vdso_time’ [-Wmissing-prototypes]
44 | __kernel_old_time_t __vdso_time(__kernel_old_time_t *t)
| ^~~~~~~~~~~
../arch/x86/um/vdso/um_vdso.c:57:1: warning: no previous prototype for ‘__vdso_getcpu’ [-Wmissing-prototypes]
57 | __vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused)
| ^~~~~~~~~~~~~
../arch/um/os-Linux/skas/process.c:107:6: warning: no previous prototype for ‘wait_stub_done’ [-Wmissing-prototypes]
107 | void wait_stub_done(int pid)
| ^~~~~~~~~~~~~~
../arch/um/os-Linux/skas/process.c:683:6: warning: no previous prototype for ‘__switch_mm’ [-Wmissing-prototypes]
683 | void __switch_mm(struct mm_id *mm_idp)
| ^~~~~~~~~~~
../arch/x86/um/ptrace_64.c:111:5: warning: no previous prototype for ‘poke_user’ [-Wmissing-prototypes]
111 | int poke_user(struct task_struct *child, long addr, long data)
| ^~~~~~~~~
../arch/x86/um/ptrace_64.c:171:5: warning: no previous prototype for ‘peek_user’ [-Wmissing-prototypes]
171 | int peek_user(struct task_struct *child, long addr, long data)
| ^~~~~~~~~
../arch/um/kernel/skas/mmu.c:17:5: warning: no previous prototype for ‘init_new_context’ [-Wmissing-prototypes]
17 | int init_new_context(struct task_struct *task, struct mm_struct *mm)
| ^~~~~~~~~~~~~~~~
../arch/um/kernel/skas/mmu.c:60:6: warning: no previous prototype for ‘destroy_context’ [-Wmissing-prototypes]
60 | void destroy_context(struct mm_struct *mm)
| ^~~~~~~~~~~~~~~
../arch/um/os-Linux/main.c:187:7: warning: no previous prototype for ‘__wrap_malloc’ [-Wmissing-prototypes]
187 | void *__wrap_malloc(int size)
| ^~~~~~~~~~~~~
../arch/um/os-Linux/main.c:208:7: warning: no previous prototype for ‘__wrap_calloc’ [-Wmissing-prototypes]
208 | void *__wrap_calloc(int n, int size)
| ^~~~~~~~~~~~~
../arch/um/os-Linux/main.c:222:6: warning: no previous prototype for ‘__wrap_free’ [-Wmissing-prototypes]
222 | void __wrap_free(void *ptr)
| ^~~~~~~~~~~
../arch/um/os-Linux/mem.c:28:6: warning: no previous prototype for ‘kasan_map_memory’ [-Wmissing-prototypes]
28 | void kasan_map_memory(void *start, size_t len)
| ^~~~~~~~~~~~~~~~
../arch/um/os-Linux/mem.c:212:13: warning: no previous prototype for ‘check_tmpexec’ [-Wmissing-prototypes]
212 | void __init check_tmpexec(void)
| ^~~~~~~~~~~~~
../arch/um/kernel/skas/process.c:36:12: warning: no previous prototype for ‘start_uml’ [-Wmissing-prototypes]
36 | int __init start_uml(void)
| ^~~~~~~~~
../arch/um/os-Linux/signal.c:75:6: warning: no previous prototype for ‘sig_handler’ [-Wmissing-prototypes]
75 | void sig_handler(int sig, struct siginfo *si, mcontext_t *mc)
| ^~~~~~~~~~~
../arch/um/os-Linux/signal.c:111:6: warning: no previous prototype for ‘timer_alarm_handler’ [-Wmissing-prototypes]
111 | void timer_alarm_handler(int sig, struct siginfo *unused_si, mcontext_t *mc)
| ^~~~~~~~~~~~~~~~~~~
../arch/x86/um/signal.c:560:6: warning: no previous prototype for ‘sys_rt_sigreturn’ [-Wmissing-prototypes]
560 | long sys_rt_sigreturn(void)
| ^~~~~~~~~~~~~~~~
../arch/um/os-Linux/start_up.c:301:12: warning: no previous prototype for ‘parse_iomem’ [-Wmissing-prototypes]
301 | int __init parse_iomem(char *str, int *add)
| ^~~~~~~~~~~
../arch/um/kernel/mem.c:202:8: warning: no previous prototype for ‘pgd_alloc’ [-Wmissing-prototypes]
202 | pgd_t *pgd_alloc(struct mm_struct *mm)
| ^~~~~~~~~
../arch/um/kernel/mem.c:215:7: warning: no previous prototype for ‘uml_kmalloc’ [-Wmissing-prototypes]
215 | void *uml_kmalloc(int size, int flags)
| ^~~~~~~~~~~
../arch/um/kernel/process.c:51:5: warning: no previous prototype for ‘pid_to_processor_id’ [-Wmissing-prototypes]
51 | int pid_to_processor_id(int pid)
| ^~~~~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:87:7: warning: no previous prototype for ‘__switch_to’ [-Wmissing-prototypes]
87 | void *__switch_to(struct task_struct *from, struct task_struct *to)
| ^~~~~~~~~~~
../arch/um/kernel/process.c:140:6: warning: no previous prototype for ‘fork_handler’ [-Wmissing-prototypes]
140 | void fork_handler(void)
| ^~~~~~~~~~~~
../arch/um/kernel/process.c:217:6: warning: no previous prototype for ‘arch_cpu_idle’ [-Wmissing-prototypes]
217 | void arch_cpu_idle(void)
| ^~~~~~~~~~~~~
../arch/um/kernel/process.c:253:5: warning: no previous prototype for ‘copy_to_user_proc’ [-Wmissing-prototypes]
253 | int copy_to_user_proc(void __user *to, void *from, int size)
| ^~~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:263:5: warning: no previous prototype for ‘clear_user_proc’ [-Wmissing-prototypes]
263 | int clear_user_proc(void __user *buf, int size)
| ^~~~~~~~~~~~~~~
../arch/um/kernel/process.c:271:6: warning: no previous prototype for ‘set_using_sysemu’ [-Wmissing-prototypes]
271 | void set_using_sysemu(int value)
| ^~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:278:5: warning: no previous prototype for ‘get_using_sysemu’ [-Wmissing-prototypes]
278 | int get_using_sysemu(void)
| ^~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:316:12: warning: no previous prototype for ‘make_proc_sysemu’ [-Wmissing-prototypes]
316 | int __init make_proc_sysemu(void)
| ^~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:348:15: warning: no previous prototype for ‘arch_align_stack’ [-Wmissing-prototypes]
348 | unsigned long arch_align_stack(unsigned long sp)
| ^~~~~~~~~~~~~~~~
../arch/um/kernel/reboot.c:45:6: warning: no previous prototype for ‘machine_restart’ [-Wmissing-prototypes]
45 | void machine_restart(char * __unused)
| ^~~~~~~~~~~~~~~
../arch/um/kernel/reboot.c:51:6: warning: no previous prototype for ‘machine_power_off’ [-Wmissing-prototypes]
51 | void machine_power_off(void)
| ^~~~~~~~~~~~~~~~~
../arch/um/kernel/reboot.c:57:6: warning: no previous prototype for ‘machine_halt’ [-Wmissing-prototypes]
57 | void machine_halt(void)
| ^~~~~~~~~~~~
../arch/x86/um/syscalls_64.c:48:6: warning: no previous prototype for ‘arch_switch_to’ [-Wmissing-prototypes]
48 | void arch_switch_to(struct task_struct *to)
| ^~~~~~~~~~~~~~
../arch/um/kernel/tlb.c:579:6: warning: no previous prototype for ‘flush_tlb_mm_range’ [-Wmissing-prototypes]
579 | void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start,
| ^~~~~~~~~~~~~~~~~~
../arch/um/kernel/tlb.c:594:6: warning: no previous prototype for ‘force_flush_all’ [-Wmissing-prototypes]
594 | void force_flush_all(void)
| ^~~~~~~~~~~~~~~
../arch/um/kernel/kmsg_dump.c:60:12: warning: no previous prototype for ‘kmsg_dumper_stdout_init’ [-Wmissing-prototypes]
60 | int __init kmsg_dumper_stdout_init(void)
| ^~~~~~~~~~~~~~~~~~~~~~~
../arch/um/kernel/um_arch.c:408:19: warning: no previous prototype for ‘read_initrd’ [-Wmissing-prototypes]
408 | int __init __weak read_initrd(void)
| ^~~~~~~~~~~
../arch/um/kernel/um_arch.c:461:7: warning: no previous prototype for ‘text_poke’ [-Wmissing-prototypes]
461 | void *text_poke(void *addr, const void *opcode, size_t len)
| ^~~~~~~~~
../arch/um/kernel/um_arch.c:473:6: warning: no previous prototype for ‘text_poke_sync’ [-Wmissing-prototypes]
473 | void text_poke_sync(void)
| ^~~~~~~~~~~~~~
../drivers/gpu/drm/xe/xe_guc_capture.c: In function ‘guc_capture_alloc_steered_lists’:
../drivers/gpu/drm/xe/xe_guc_capture.c:287:2: error: implicit declaration of function ‘for_each_dss_steering’ [-Werror=implicit-function-declaration]
287 | for_each_dss_steering(iter, gt, slice, subslice) {
| ^~~~~~~~~~~~~~~~~~~~~
../drivers/gpu/drm/xe/xe_guc_capture.c:287:50: error: expected ‘;’ before ‘{’ token
287 | for_each_dss_steering(iter, gt, slice, subslice) {
| ^~
| ;../drivers/gpu/drm/xe/xe_guc_capture.c:254:31: warning: variable ‘extarray’ set but not used [-Wunused-but-set-variable]
254 | struct __guc_mmio_reg_descr *extarray;
| ^~~~~~~~../drivers/gpu/drm/xe/xe_guc_capture.c:251:29: warning: unused variable ‘i’ [-Wunused-variable]
251 | int slice, subslice, iter, i, num_steer_regs, num_tot_regs = 0;
| ^
At top level:../drivers/gpu/drm/xe/xe_guc_capture.c:219:13: warning: ‘__fill_ext_reg’ defined but not used [-Wunused-function]
219 | static void __fill_ext_reg(struct __guc_mmio_reg_descr *ext,
| ^~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[7]: *** [../scripts/Makefile.build:243: drivers/gpu/drm/xe/xe_guc_capture.o] Error 1 make[7]: *** Waiting for unfinished jobs....
make[6]: *** [../scripts/Makefile.build:481: drivers/gpu/drm/xe] Error 2 make[6]: *** Waiting for unfinished jobs....../lib/iomap.c:156:5: warning: no previous prototype for ‘ioread64_lo_hi’ [-Wmissing-prototypes]
156 | u64 ioread64_lo_hi(const void __iomem *addr)
| ^~~~~~~~~~~~~~
../lib/iomap.c:163:5: warning: no previous prototype for ‘ioread64_hi_lo’ [-Wmissing-prototypes]
163 | u64 ioread64_hi_lo(const void __iomem *addr)
| ^~~~~~~~~~~~~~
../lib/iomap.c:170:5: warning: no previous prototype for ‘ioread64be_lo_hi’ [-Wmissing-prototypes]
170 | u64 ioread64be_lo_hi(const void __iomem *addr)
| ^~~~~~~~~~~~~~~~
../lib/iomap.c:178:5: warning: no previous prototype for ‘ioread64be_hi_lo’ [-Wmissing-prototypes]
178 | u64 ioread64be_hi_lo(const void __iomem *addr)
| ^~~~~~~~~~~~~~~~
../lib/iomap.c:264:6: warning: no previous prototype for ‘iowrite64_lo_hi’ [-Wmissing-prototypes]
264 | void iowrite64_lo_hi(u64 val, void __iomem *addr)
| ^~~~~~~~~~~~~~~
../lib/iomap.c:272:6: warning: no previous prototype for ‘iowrite64_hi_lo’ [-Wmissing-prototypes]
272 | void iowrite64_hi_lo(u64 val, void __iomem *addr)
| ^~~~~~~~~~~~~~~
../lib/iomap.c:280:6: warning: no previous prototype for ‘iowrite64be_lo_hi’ [-Wmissing-prototypes]
280 | void iowrite64be_lo_hi(u64 val, void __iomem *addr)
| ^~~~~~~~~~~~~~~~~
../lib/iomap.c:288:6: warning: no previous prototype for ‘iowrite64be_hi_lo’ [-Wmissing-prototypes]
288 | void iowrite64be_hi_lo(u64 val, void __iomem *addr)
| ^~~~~~~~~~~~~~~~~make[5]: *** [../scripts/Makefile.build:481: drivers/gpu/drm] Error 2 make[4]: *** [../scripts/Makefile.build:481: drivers/gpu] Error 2 make[3]: *** [../scripts/Makefile.build:481: drivers] Error 2 make[3]: *** Waiting for unfinished jobs....
make[2]: *** [/kernel/Makefile:1921: .] Error 2
make[1]: *** [/kernel/Makefile:240: __sub-make] Error 2
make: *** [Makefile:240: __sub-make] Error 2
[00:07:36] Configuring KUnit Kernel ...
Generating .config ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig [00:07:40] Building KUnit Kernel ... Populating config with: $ make ARCH=um O=.kunit olddefconfig Building with: $ make ARCH=um O=.kunit --jobs=48 + cleanup ++ stat -c %u:%g /kernel + chown -R 1003:1003 /kernel