[v28,6/6] drm/xe/guc: Save manual engine capture into capture list

Kees Bakker kees at ijzerbout.nl
Wed Oct 9 19:22:24 UTC 2024


Op 04-10-2024 om 21:34 schreef Zhanjun Dong:
> Save manual engine capture into capture list.
> This removes duplicate register definitions across manual-capture vs
> guc-err-capture.
>
> Signed-off-by: Zhanjun Dong <zhanjun.dong at intel.com>
> Reviewed-by: Alan Previn <alan.previn.teres.alexis at intel.com>
> ---
>   drivers/gpu/drm/xe/xe_devcoredump.c     |   3 +-
>   drivers/gpu/drm/xe/xe_guc_capture.c     | 153 +++++++++++++-
>   drivers/gpu/drm/xe/xe_guc_capture.h     |   3 +-
>   drivers/gpu/drm/xe/xe_hw_engine.c       | 255 +-----------------------
>   drivers/gpu/drm/xe/xe_hw_engine.h       |   2 -
>   drivers/gpu/drm/xe/xe_hw_engine_types.h |  59 ------
>   6 files changed, 163 insertions(+), 312 deletions(-)
>
> [...]
> +static void
> +read_reg_to_node(struct xe_hw_engine *hwe, const struct __guc_mmio_reg_descr_group *list,
> +		 struct guc_mmio_reg *regs)
> +{
> +	int i;
> +
> +	if (!list || list->num_regs == 0)
> +		return;
> +
> +	if (!regs)
> +		return;
> +
> +	for (i = 0; i < list->num_regs; i++) {
> +		struct __guc_mmio_reg_descr desc = list->list[i];
> +		u32 value;
> +
> +		if (!list->list)
This test makes no sense at this point.
Notice that list->list[i] is used to get "desc". It would have crashed 
if list->list was NULL.
It could make sense before the for-loop, but you'll have to decide on that.
> +			return;
> +
> +		if (list->type == GUC_STATE_CAPTURE_TYPE_ENGINE_INSTANCE) {
> +			value = xe_hw_engine_mmio_read32(hwe, desc.reg);
> +		} else {
> +			if (list->type == GUC_STATE_CAPTURE_TYPE_ENGINE_CLASS &&
> +			    FIELD_GET(GUC_REGSET_STEERING_NEEDED, desc.flags)) {
> +				int group, instance;
> +
> +				group = FIELD_GET(GUC_REGSET_STEERING_GROUP, desc.flags);
> +				instance = FIELD_GET(GUC_REGSET_STEERING_INSTANCE, desc.flags);
> +				value = xe_gt_mcr_unicast_read(hwe->gt, XE_REG_MCR(desc.reg.addr),
> +							       group, instance);
> +			} else {
> +				value = xe_mmio_read32(&hwe->gt->mmio, desc.reg);
> +			}
> +		}
> +
> +		regs[i].value = value;
> +		regs[i].offset = desc.reg.addr;
> +		regs[i].flags = desc.flags;
> +		regs[i].mask = desc.mask;
> +	}
> +}
>
-- 
Kees


More information about the Intel-xe mailing list