mesa/src/intel/tools/error2hangdump_xe_lib.c
Carlos Santa c8a08c5375 intel/tools: Handle new replay properties in the Xe KMD error dump file
The changes as part of the Contexts state now include:

**** Contexts ****
[HWCTX].replay_offset: 0x0
[HWCTX].replay_length: 0xd000

and the changes as part of the VM state now include:

**** VM state ****
VM.uapi_flags: 0x1
[40000].length: 0x2000
[40000].properties: read_write|bo|mem_region=0x1|pat_index=2|cpu_caching=1
[40000].data: &-)\3!!E9mzzzzzzzzzz

In order to be able to replay a GPU hang from a devcore dump file
new properties have been added describing the offset and the length
of the affected hw context as well as a global VM flag and
several VMA property types: memory region, bo caching, pat index,
memory permission and memory type.

Signed-off-by: Carlos Santa <carlos.santa@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34829>
2026-01-07 19:16:25 +00:00

51 lines
1.2 KiB
C

/*
* Copyright 2025 Intel Corporation
* SPDX-License-Identifier: MIT
*/
#include "error2hangdump_lib.h"
#include "error2hangdump_xe_lib.h"
#include "common/intel_hang_dump.h"
#include "error_decode_xe_lib.h"
void
write_xe_vm_flags(FILE *f,
uint32_t vm_flags)
{
struct intel_hang_dump_block_vm_flags header = {
.base = {
.type = INTEL_HANG_DUMP_BLOCK_TYPE_VM_FLAGS,
},
.vm_flags = vm_flags,
};
fwrite(&header, sizeof(header), 1, f);
}
void
write_xe_buffer(FILE *f,
uint64_t offset,
const void *data,
uint64_t size,
const struct xe_vma_properties *props,
const char *name)
{
struct intel_hang_dump_block_bo header = {
.base = {
.type = INTEL_HANG_DUMP_BLOCK_TYPE_BO,
},
.props = {
.mem_type = props->mem_type,
.mem_permission = props->mem_permission,
.mem_region = props->mem_region,
.pat_index = props->pat_index,
.cpu_caching = props->cpu_caching,
},
.offset = offset,
.size = size,
};
snprintf(header.name, sizeof(header.name), "%s", name);
fwrite(&header, sizeof(header), 1, f);
fwrite(data, size, 1, f);
}