From 3906d34c64e54e0656f23a4ec93062c6d872b4bc Mon Sep 17 00:00:00 2001 From: Lingutla Chandrasekhar Date: Fri, 20 Jan 2017 13:46:34 +0530 Subject: soc: qcom: Add Minidump support Add Minidump support for clients to get minimum required data at the time of system crash. The Minidump table resides in SMEM, BOOT(SBL) will iterate the table entries and dumps out (to USB/Flash) the data in address location. Any client can register to this table with static or known addresses, as currently Minidump doesn't support dumping of dynamic data structures. To simplify post processing, we create an ELF header, where each entry in the minidump table is a section in elf header. If Memory dump table enabled, Dump all data entries registered with MDT. Enable Minidump: echo mini > /sys/kernel/dload/dload_mode Change-Id: I0fc8d21aef71ded34a498426ee3d7f86b063a639 Signed-off-by: Lingutla Chandrasekhar --- kernel/trace/msm_rtb.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'kernel') diff --git a/kernel/trace/msm_rtb.c b/kernel/trace/msm_rtb.c index 80058b544cb5..587082117842 100644 --- a/kernel/trace/msm_rtb.c +++ b/kernel/trace/msm_rtb.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2016, The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2017, 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 @@ -28,6 +28,7 @@ #include #include #include +#include #define SENTINEL_BYTE_1 0xFF #define SENTINEL_BYTE_2 0xAA @@ -243,6 +244,7 @@ EXPORT_SYMBOL(uncached_logk); static int msm_rtb_probe(struct platform_device *pdev) { struct msm_rtb_platform_data *d = pdev->dev.platform_data; + struct md_region md_entry; #if defined(CONFIG_QCOM_RTB_SEPARATE_CPUS) unsigned int cpu; #endif @@ -294,6 +296,12 @@ static int msm_rtb_probe(struct platform_device *pdev) memset(msm_rtb.rtb, 0, msm_rtb.size); + strlcpy(md_entry.name, "KRTB_BUF", sizeof(md_entry.name)); + md_entry.virt_addr = (uintptr_t)msm_rtb.rtb; + md_entry.phys_addr = msm_rtb.phys; + md_entry.size = msm_rtb.size; + if (msm_minidump_add_region(&md_entry)) + pr_info("Failed to add RTB in Minidump\n"); #if defined(CONFIG_QCOM_RTB_SEPARATE_CPUS) for_each_possible_cpu(cpu) { -- cgit v1.2.3