From a8904ad5945ca4d5dc9dc1e5ec3bb5db3bc1b4ed Mon Sep 17 00:00:00 2001 From: Avaneesh Kumar Dwivedi Date: Mon, 14 Mar 2016 18:07:48 +0530 Subject: [PATCH] soc: qcom: pil: Make provision for collecting complete subsystem dump Subsystem ramdump collection as of now happen segmentwise, but sometime there are hole in between segment where dynamic image is loaded and which need to be captured during subsystem ramdump collection. This change will dump complete subsystem memory rather than only segments based on the configuration of subsystem who desire it. Change-Id: I5075a90817d1a4d00d69ad39d892dbbc40b0b0dc Signed-off-by: Avaneesh Kumar Dwivedi --- .../devicetree/bindings/pil/subsys-pil-tz.txt | 3 +++ drivers/soc/qcom/ramdump.c | 24 ++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/pil/subsys-pil-tz.txt b/Documentation/devicetree/bindings/pil/subsys-pil-tz.txt index a38eefcd4fb0..d7edafc9a46b 100644 --- a/Documentation/devicetree/bindings/pil/subsys-pil-tz.txt +++ b/Documentation/devicetree/bindings/pil/subsys-pil-tz.txt @@ -64,6 +64,9 @@ Optional properties: - qcom,pil-generic-irq-handler: generic interrupt handler used for communication with subsytem based on bit values in scsr registers. - qcom,spss-scsr-bits: array of bit positions into the scsr registers used in generic handler. +- qcom,complete-ramdump: Boolean. If set, complete ramdump i.e. region between start address of + first segment to end address of last segment will be collected without + leaving any hole in between. Example: qcom,venus@fdce0000 { diff --git a/drivers/soc/qcom/ramdump.c b/drivers/soc/qcom/ramdump.c index 37eb9f0540ed..8792ac046986 100644 --- a/drivers/soc/qcom/ramdump.c +++ b/drivers/soc/qcom/ramdump.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2016, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -26,6 +26,7 @@ #include #include #include +#include #define RAMDUMP_WAIT_MSECS 120000 @@ -45,6 +46,7 @@ struct ramdump_device { size_t elfcore_size; char *elfcore_buf; struct dma_attrs attrs; + bool complete_ramdump; }; static int ramdump_open(struct inode *inode, struct file *filep) @@ -273,6 +275,13 @@ void *create_ramdump_device(const char *dev_name, struct device *parent) rd_dev->device.name = rd_dev->name; rd_dev->device.fops = &ramdump_file_ops; rd_dev->device.parent = parent; + if (parent) { + rd_dev->complete_ramdump = of_property_read_bool( + parent->of_node, "qcom,complete-ramdump"); + if (!rd_dev->complete_ramdump) + dev_info(parent, + "for %s segments only will be dumped.", dev_name); + } init_waitqueue_head(&rd_dev->dump_wait_q); @@ -315,8 +324,17 @@ static int _do_ramdump(void *handle, struct ramdump_segment *segments, return -EPIPE; } - for (i = 0; i < nsegments; i++) - segments[i].size = PAGE_ALIGN(segments[i].size); + if (rd_dev->complete_ramdump) { + for (i = 0; i < nsegments-1; i++) + segments[i].size = + PAGE_ALIGN(segments[i+1].address - segments[i].address); + + segments[nsegments-1].size = + PAGE_ALIGN(segments[nsegments-1].size); + } else { + for (i = 0; i < nsegments; i++) + segments[i].size = PAGE_ALIGN(segments[i].size); + } rd_dev->segments = segments; rd_dev->nsegments = nsegments;