[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <160697990547.2717324.13284456705336253152@swboyd.mtv.corp.google.com>
Date: Wed, 02 Dec 2020 23:18:25 -0800
From: Stephen Boyd <swboyd@...omium.org>
To: Dikshita Agarwal <dikshita@...eaurora.org>,
linux-media@...r.kernel.org, stanimir.varbanov@...aro.org
Cc: linux-kernel@...r.kernel.org, linux-arm-msm@...r.kernel.org,
vgarodia@...eaurora.org, Dikshita Agarwal <dikshita@...eaurora.org>
Subject: Re: [PATCH] venus: core: add support to dump FW region
Quoting Dikshita Agarwal (2020-11-29 21:36:12)
> diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
> index 6103aaf..01a0cfe 100644
> --- a/drivers/media/platform/qcom/venus/core.c
> +++ b/drivers/media/platform/qcom/venus/core.c
> @@ -22,6 +24,48 @@
> #include "firmware.h"
> #include "pm_helpers.h"
>
> +static int subsystem_dump(struct venus_core *core)
> +{
> + struct device_node *node;
> + struct device *dev;
> + struct resource r;
> + void *mem_va;
> + size_t mem_size;
> + void *data;
> + int ret;
> +
> + dev = core->dev;
> + node = of_parse_phandle(dev->of_node, "memory-region", 0);
Any chance this could be done at probe time and saved away as some sort
of pointer?
> + if (!node)
> + return -EINVAL;
> +
> + ret = of_address_to_resource(node, 0, &r);
of_node_put(node);
> + if (ret)
> + goto err_put_node;
And then just return ret;
> +
> + mem_size = resource_size(&r);
> +
> + mem_va = memremap(r.start, mem_size, MEMREMAP_WC);
> + if (!mem_va) {
> + ret = -ENOMEM;
> + goto err_put_node;
And return -ENOMEM;
> + }
> +
> + data = vmalloc(mem_size);
> + if (!data) {
> + ret = -EINVAL;
> + goto err_unmap;
> + }
> +
> + memcpy(data, mem_va, mem_size);
> +
> + dev_coredumpv(dev, data, mem_size, GFP_KERNEL);
> +err_unmap:
> + memunmap(mem_va);
> +err_put_node:
> + of_node_put(node);
> + return ret;
> +}
> static void venus_event_notify(struct venus_core *core, u32 event)
> {
> struct venus_inst *inst;
> @@ -67,6 +111,9 @@ static void venus_sys_error_handler(struct work_struct *work)
>
> venus_shutdown(core);
>
> + dev_warn(core->dev, "dumping FW region!\n");
Do we need this warning?
> + subsystem_dump(core);
Maybe call it venus_do_coredump() so it isn't so generic.
> +
> pm_runtime_put_sync(core->dev);
>
> while (core->pmdomains[0] && pm_runtime_active(core->pmdomains[0]))
Powered by blists - more mailing lists