diff options
author | Dikshita Agarwal <dikshita@codeaurora.org> | 2020-12-15 19:08:36 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2021-01-27 16:19:24 +0100 |
commit | 0ca0ca9805055bb0efc16890f9d6433c65bd07cc (patch) | |
tree | 13e4f6e78938a157ee0588fa4709acdc8e29d5df /drivers/media | |
parent | 0f9774dddf6ce17b134582147d54221548ff06fc (diff) | |
download | linux-stable-0ca0ca9805055bb0efc16890f9d6433c65bd07cc.tar.gz linux-stable-0ca0ca9805055bb0efc16890f9d6433c65bd07cc.tar.bz2 linux-stable-0ca0ca9805055bb0efc16890f9d6433c65bd07cc.zip |
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 <dikshita@codeaurora.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/platform/qcom/venus/core.c | 30 | ||||
-rw-r--r-- | drivers/media/platform/qcom/venus/core.h | 2 | ||||
-rw-r--r-- | drivers/media/platform/qcom/venus/firmware.c | 3 |
3 files changed, 35 insertions, 0 deletions
diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 6bcd5659ffcc..1471c7f9c89d 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -7,6 +7,7 @@ #include <linux/interconnect.h> #include <linux/ioctl.h> #include <linux/delay.h> +#include <linux/devcoredump.h> #include <linux/list.h> #include <linux/module.h> #include <linux/of_device.h> @@ -22,6 +23,33 @@ #include "firmware.h" #include "pm_helpers.h" +static void venus_coredump(struct venus_core *core) +{ + struct device *dev; + phys_addr_t mem_phys; + size_t mem_size; + void *mem_va; + void *data; + + dev = core->dev; + mem_phys = core->fw.mem_phys; + mem_size = core->fw.mem_size; + + mem_va = memremap(mem_phys, mem_size, MEMREMAP_WC); + if (!mem_va) + return; + + data = vmalloc(mem_size); + if (!data) { + memunmap(mem_va); + return; + } + + memcpy(data, mem_va, mem_size); + memunmap(mem_va); + dev_coredumpv(dev, data, mem_size, GFP_KERNEL); +} + static void venus_event_notify(struct venus_core *core, u32 event) { struct venus_inst *inst; @@ -67,6 +95,8 @@ static void venus_sys_error_handler(struct work_struct *work) venus_shutdown(core); + venus_coredump(core); + pm_runtime_put_sync(core->dev); while (core->pmdomains[0] && pm_runtime_active(core->pmdomains[0])) diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index b984d508ed71..45da0307a1b8 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -144,6 +144,8 @@ struct venus_core { struct device *dev; struct iommu_domain *iommu_domain; size_t mapped_mem_size; + phys_addr_t mem_phys; + size_t mem_size; } fw; struct mutex lock; struct list_head instances; diff --git a/drivers/media/platform/qcom/venus/firmware.c b/drivers/media/platform/qcom/venus/firmware.c index d03e2dd5808c..89defc21ea81 100644 --- a/drivers/media/platform/qcom/venus/firmware.c +++ b/drivers/media/platform/qcom/venus/firmware.c @@ -201,6 +201,9 @@ int venus_boot(struct venus_core *core) return -EINVAL; } + core->fw.mem_size = mem_size; + core->fw.mem_phys = mem_phys; + if (core->use_tz) ret = qcom_scm_pas_auth_and_reset(VENUS_PAS_ID); else |