video: driver: dump queues for system error

Add support to dump all queues(cmd, msg, dbg) as part
of handle_system_error using devcoredump framework.

Change-Id: Ia1b011a29e6bc657eb002dbba09deab62dc0b2b2
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
This commit is contained in:
Govindaraj Rajagopal
2021-06-15 18:23:15 +05:30
vanhempi 3730e55b29
commit 659ec59888
4 muutettua tiedostoa jossa 29 lisäystä ja 10 poistoa

Näytä tiedosto

@@ -633,6 +633,7 @@ struct hfi_queue_header {
#define ALIGNED_QUEUE_SIZE ALIGN(QUEUE_SIZE, SZ_4K) #define ALIGNED_QUEUE_SIZE ALIGN(QUEUE_SIZE, SZ_4K)
#define SHARED_QSIZE ALIGN(ALIGNED_SFR_SIZE + ALIGNED_QUEUE_SIZE + \ #define SHARED_QSIZE ALIGN(ALIGNED_SFR_SIZE + ALIGNED_QUEUE_SIZE + \
ALIGNED_QDSS_SIZE, SZ_1M) ALIGNED_QDSS_SIZE, SZ_1M)
#define TOTAL_QSIZE (SHARED_QSIZE - ALIGNED_SFR_SIZE - ALIGNED_QDSS_SIZE)
struct buf_count { struct buf_count {
u32 etb; u32 etb;

Näytä tiedosto

@@ -21,5 +21,6 @@ int handle_session_response_work(struct msm_vidc_inst *inst,
struct response_work *work); struct response_work *work);
int handle_system_error(struct msm_vidc_core *core, int handle_system_error(struct msm_vidc_core *core,
struct hfi_packet *pkt); struct hfi_packet *pkt);
void fw_coredump(struct msm_vidc_core *core);
#endif // __VENUS_HFI_RESPONSE_H__ #endif // __VENUS_HFI_RESPONSE_H__

Näytä tiedosto

@@ -2356,16 +2356,14 @@ static int __interface_queues_init(struct msm_vidc_core *core)
struct msm_vidc_alloc alloc; struct msm_vidc_alloc alloc;
struct msm_vidc_map map; struct msm_vidc_map map;
int offset = 0; int offset = 0;
u32 q_size;
u32 i; u32 i;
d_vpr_h("%s()\n", __func__); d_vpr_h("%s()\n", __func__);
q_size = SHARED_QSIZE - ALIGNED_SFR_SIZE - ALIGNED_QDSS_SIZE;
memset(&alloc, 0, sizeof(alloc)); memset(&alloc, 0, sizeof(alloc));
alloc.type = MSM_VIDC_BUF_QUEUE; alloc.type = MSM_VIDC_BUF_QUEUE;
alloc.region = MSM_VIDC_NON_SECURE; alloc.region = MSM_VIDC_NON_SECURE;
alloc.size = q_size; alloc.size = TOTAL_QSIZE;
alloc.secure = false; alloc.secure = false;
alloc.map_kernel = true; alloc.map_kernel = true;
rc = msm_vidc_memory_alloc(core, &alloc); rc = msm_vidc_memory_alloc(core, &alloc);
@@ -2879,8 +2877,15 @@ int venus_hfi_core_deinit(struct msm_vidc_core *core)
__resume(core); __resume(core);
__flush_debug_queue(core, core->packet, core->packet_size); __flush_debug_queue(core, core->packet, core->packet_size);
__disable_subcaches(core); __disable_subcaches(core);
__interface_queues_deinit(core);
__unload_fw(core); __unload_fw(core);
/**
* coredump need to be called after firmware unload, coredump also
* copying queues memory. So need to be called before queues deinit.
*/
if (msm_vidc_fw_dump)
fw_coredump(core);
__interface_queues_deinit(core);
return 0; return 0;
} }

Näytä tiedosto

@@ -375,15 +375,23 @@ static int handle_session_error(struct msm_vidc_inst *inst,
return rc; return rc;
} }
static void fw_coredump(struct platform_device *pdev) void fw_coredump(struct msm_vidc_core *core)
{ {
int rc = 0; int rc = 0;
struct platform_device *pdev;
struct device_node *node = NULL; struct device_node *node = NULL;
struct resource res = {0}; struct resource res = {0};
phys_addr_t mem_phys = 0; phys_addr_t mem_phys = 0;
size_t res_size = 0; size_t res_size = 0;
void *mem_va = NULL; void *mem_va = NULL;
void *data = NULL; char *data = NULL;
u64 total_size;
if (!core) {
d_vpr_e("%s: invalid params\n", __func__);
return;
}
pdev = core->pdev;
node = of_parse_phandle(pdev->dev.of_node, "memory-region", 0); node = of_parse_phandle(pdev->dev.of_node, "memory-region", 0);
if (!node) { if (!node) {
@@ -407,16 +415,22 @@ static void fw_coredump(struct platform_device *pdev)
d_vpr_e("%s: unable to remap firmware memory\n", __func__); d_vpr_e("%s: unable to remap firmware memory\n", __func__);
return; return;
} }
total_size = res_size + TOTAL_QSIZE;
data = vmalloc(res_size); data = vmalloc(total_size);
if (!data) { if (!data) {
memunmap(mem_va); memunmap(mem_va);
return; return;
} }
/* copy firmware dump */
memcpy(data, mem_va, res_size); memcpy(data, mem_va, res_size);
memunmap(mem_va); memunmap(mem_va);
dev_coredumpv(&pdev->dev, data, res_size, GFP_KERNEL);
/* copy queues(cmd, msg, dbg) dump(along with headers) */
memcpy(data + res_size, (char *)core->iface_q_table.align_virtual_addr, TOTAL_QSIZE);
dev_coredumpv(&pdev->dev, data, total_size, GFP_KERNEL);
} }
int handle_system_error(struct msm_vidc_core *core, int handle_system_error(struct msm_vidc_core *core,
@@ -427,8 +441,6 @@ int handle_system_error(struct msm_vidc_core *core,
print_sfr_message(core); print_sfr_message(core);
venus_hfi_noc_error_info(core); venus_hfi_noc_error_info(core);
msm_vidc_core_deinit(core, true); msm_vidc_core_deinit(core, true);
if (msm_vidc_fw_dump)
fw_coredump(core->pdev);
return 0; return 0;
} }