Skip to content

Commit 0ca0ca9

Browse files
Dikshita Agarwalmchehab
authored andcommitted
media: venus: core: add support to dump FW region
Add support to dump video FW region during FW crash using devcoredump helpers. Signed-off-by: Dikshita Agarwal <[email protected]> Reviewed-by: Stephen Boyd <[email protected]> Signed-off-by: Stanimir Varbanov <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 0f9774d commit 0ca0ca9

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

drivers/media/platform/qcom/venus/core.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <linux/interconnect.h>
88
#include <linux/ioctl.h>
99
#include <linux/delay.h>
10+
#include <linux/devcoredump.h>
1011
#include <linux/list.h>
1112
#include <linux/module.h>
1213
#include <linux/of_device.h>
@@ -22,6 +23,33 @@
2223
#include "firmware.h"
2324
#include "pm_helpers.h"
2425

26+
static void venus_coredump(struct venus_core *core)
27+
{
28+
struct device *dev;
29+
phys_addr_t mem_phys;
30+
size_t mem_size;
31+
void *mem_va;
32+
void *data;
33+
34+
dev = core->dev;
35+
mem_phys = core->fw.mem_phys;
36+
mem_size = core->fw.mem_size;
37+
38+
mem_va = memremap(mem_phys, mem_size, MEMREMAP_WC);
39+
if (!mem_va)
40+
return;
41+
42+
data = vmalloc(mem_size);
43+
if (!data) {
44+
memunmap(mem_va);
45+
return;
46+
}
47+
48+
memcpy(data, mem_va, mem_size);
49+
memunmap(mem_va);
50+
dev_coredumpv(dev, data, mem_size, GFP_KERNEL);
51+
}
52+
2553
static void venus_event_notify(struct venus_core *core, u32 event)
2654
{
2755
struct venus_inst *inst;
@@ -67,6 +95,8 @@ static void venus_sys_error_handler(struct work_struct *work)
6795

6896
venus_shutdown(core);
6997

98+
venus_coredump(core);
99+
70100
pm_runtime_put_sync(core->dev);
71101

72102
while (core->pmdomains[0] && pm_runtime_active(core->pmdomains[0]))

drivers/media/platform/qcom/venus/core.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ struct venus_core {
144144
struct device *dev;
145145
struct iommu_domain *iommu_domain;
146146
size_t mapped_mem_size;
147+
phys_addr_t mem_phys;
148+
size_t mem_size;
147149
} fw;
148150
struct mutex lock;
149151
struct list_head instances;

drivers/media/platform/qcom/venus/firmware.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,9 @@ int venus_boot(struct venus_core *core)
201201
return -EINVAL;
202202
}
203203

204+
core->fw.mem_size = mem_size;
205+
core->fw.mem_phys = mem_phys;
206+
204207
if (core->use_tz)
205208
ret = qcom_scm_pas_auth_and_reset(VENUS_PAS_ID);
206209
else

0 commit comments

Comments
 (0)