]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
ARM: Tegra: add support for ramoops
authorAjay Nandakumar <anandakumarm@nvidia.com>
Mon, 11 Nov 2013 08:56:44 +0000 (14:26 +0530)
committerWinnie Hsu <whsu@nvidia.com>
Thu, 22 May 2014 23:05:32 +0000 (16:05 -0700)
Ramoops is an oops/panic logger that writes its logs to RAM before
the system crashes.
This replaces the old methods which uses last_kmsg.

the last kernel logs can now be found at
/sys/fs/pstore/console-ramoops.

If not found it can be manually mounted using the command from shell
prompt:

mount -t pstore pstore /sys/fs/pstore

Bug 1258617

Change-Id: I7507bfe66a36ae882ad1d2a8f4b111bce9a1d8bc
Signed-off-by: Ajay Nandakumar <anandakumarm@nvidia.com>
Reviewed-on: http://git-master/r/309549
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Tested-by: Bharat Nihalani <bnihalani@nvidia.com>
(cherry picked from commit 5e18da24e97561f8590f3ef0256906d967351a2b)
Signed-off-by: Bryan Wu <pengw@nvidia.com>
Signed-off-by: Prabhu Kuttiyam <pkuttiyam@nvidia.com>
Reviewed-on: http://git-master/r/408431
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Winnie Hsu <whsu@nvidia.com>
arch/arm/mach-tegra/board-ardbeg.c
arch/arm/mach-tegra/board-dalmore.c
arch/arm/mach-tegra/board-loki.c
arch/arm/mach-tegra/board-macallan.c
arch/arm/mach-tegra/board-pismo.c
arch/arm/mach-tegra/board-pluto.c
arch/arm/mach-tegra/board-roth.c
arch/arm/mach-tegra/board-vcm30_t124.c
arch/arm/mach-tegra/board.h
arch/arm/mach-tegra/common.c

index c85f0e2deed0556b277862152088f4364b87eb07..36e9c59d11010e7ce69af626201eff8abb7fb35e 100644 (file)
@@ -1299,7 +1299,6 @@ static void __init tegra_ardbeg_late_init(void)
        else
                platform_device_register(&ardbeg_audio_device_rt5639);
 
-       //tegra_ram_console_debug_init();
        tegra_io_dpd_init();
        ardbeg_sdhci_init();
        if (board_info.board_id == BOARD_PM359 ||
@@ -1375,7 +1374,7 @@ static void __init tegra_ardbeg_late_init(void)
 
 static void __init ardbeg_ramconsole_reserve(unsigned long size)
 {
-       tegra_ram_console_debug_reserve(SZ_1M);
+       tegra_reserve_ramoops_memory(SZ_1M);
 }
 
 static void __init tegra_ardbeg_init_early(void)
index 43460f9db4282a7f7d7cfeec4a7f92130c7f2289..96d34cdd09a40346fd09169f33e667402757384b 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * arch/arm/mach-tegra/board-dalmore.c
  *
- * Copyright (c) 2012-2013, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2012-2014, NVIDIA CORPORATION.  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 as
@@ -671,7 +671,6 @@ static void __init tegra_dalmore_late_init(void)
        dalmore_uart_init();
        dalmore_audio_init();
        platform_add_devices(dalmore_devices, ARRAY_SIZE(dalmore_devices));
-       //tegra_ram_console_debug_init();
        tegra_io_dpd_init();
        dalmore_regulator_init();
        dalmore_sdhci_init();
@@ -704,7 +703,7 @@ static void __init tegra_dalmore_late_init(void)
 
 static void __init dalmore_ramconsole_reserve(unsigned long size)
 {
-       tegra_ram_console_debug_reserve(SZ_1M);
+       tegra_reserve_ramoops_memory(SZ_1M);
 }
 
 static void __init tegra_dalmore_dt_init(void)
index 570e001e7eed01ad93fdf654c05ae2f0a079fffe..acb7e9dace5e21c36d90335114faa2ad276be37c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * arch/arm/mach-tegra/board-loki.c
  *
- * Copyright (c) 2013, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2013-2014, NVIDIA CORPORATION.  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 as
@@ -799,7 +799,6 @@ static void __init tegra_loki_late_init(void)
        loki_uart_init();
        loki_audio_init();
        platform_add_devices(loki_devices, ARRAY_SIZE(loki_devices));
-       //tegra_ram_console_debug_init();
        tegra_io_dpd_init();
        loki_sdhci_init();
        loki_regulator_init();
@@ -829,7 +828,7 @@ static void __init tegra_loki_late_init(void)
 
 static void __init loki_ramconsole_reserve(unsigned long size)
 {
-       tegra_ram_console_debug_reserve(SZ_1M);
+       tegra_reserve_ramoops_memory(SZ_1M);
 }
 
 static void __init tegra_loki_dt_init(void)
index 2f0a50256477d539a108ab913675ae318df663ca..3ce948d3b7d669318d60ff061a86dcb90c69cf62 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * arch/arm/mach-tegra/board-macallan.c
  *
- * Copyright (c) 2013, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2013-2014, NVIDIA CORPORATION.  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 as
@@ -546,7 +546,6 @@ static void __init tegra_macallan_late_init(void)
        macallan_uart_init();
        macallan_audio_init();
        platform_add_devices(macallan_devices, ARRAY_SIZE(macallan_devices));
-       //tegra_ram_console_debug_init();
        tegra_io_dpd_init();
        macallan_regulator_init();
        macallan_sdhci_init();
@@ -574,7 +573,7 @@ static void __init tegra_macallan_late_init(void)
 
 static void __init macallan_ramconsole_reserve(unsigned long size)
 {
-       tegra_ram_console_debug_reserve(SZ_1M);
+       tegra_reserve_ramoops_memory(SZ_1M);
 }
 
 static void __init tegra_macallan_dt_init(void)
index 2577b12e54265494e9ba9aacb4883aaf7ac53915..8db6779d841836feb0a57f49a40a8d077f1ee8a1 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * arch/arm/mach-tegra/board-pismo.c
  *
- * Copyright (c) 2012-2013, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2012-2014, NVIDIA CORPORATION.  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 as
@@ -595,7 +595,6 @@ static void __init tegra_pismo_init(void)
        pismo_uart_init();
        pismo_audio_init();
        platform_add_devices(pismo_devices, ARRAY_SIZE(pismo_devices));
-       //tegra_ram_console_debug_init();
        tegra_io_dpd_init();
        pismo_regulator_init();
        pismo_sdhci_init();
@@ -621,7 +620,7 @@ static void __init tegra_pismo_init(void)
 
 static void __init pismo_ramconsole_reserve(unsigned long size)
 {
-       tegra_ram_console_debug_reserve(SZ_1M);
+       tegra_reserve_ramoops_memory(SZ_1M);
 }
 
 #ifdef CONFIG_USE_OF
index 68b162873e215d255ccda044a785185a18c8d691..f24ab3c7de7fc4e620023dea3ae0e97fa56808b6 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * arch/arm/mach-tegra/board-pluto.c
  *
- * Copyright (c) 2012-2013, NVIDIA CORPORATION. All rights reserved.
+ * Copyright (c) 2012-2014, NVIDIA CORPORATION. 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 as
@@ -1229,7 +1229,6 @@ static void __init tegra_pluto_late_init(void)
        pluto_uart_init();
        pluto_audio_init();
        platform_add_devices(pluto_devices, ARRAY_SIZE(pluto_devices));
-       //tegra_ram_console_debug_init();
        tegra_io_dpd_init();
        pluto_sdhci_init();
        pluto_regulator_init();
@@ -1260,7 +1259,7 @@ static void __init tegra_pluto_late_init(void)
 
 static void __init pluto_ramconsole_reserve(unsigned long size)
 {
-       tegra_ram_console_debug_reserve(SZ_1M);
+       tegra_reserve_ramoops_memory(SZ_1M);
 }
 
 static void __init tegra_pluto_dt_init(void)
index b2518795227f77ff0ac5af96497ea44e5d88c79c..bfd728de1afd194e692baac501035389abc72959 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * arch/arm/mach-tegra/board-roth.c
  *
- * Copyright (c) 2012-2013, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2012-2014, NVIDIA CORPORATION.  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 as
@@ -571,7 +571,6 @@ static void __init tegra_roth_init(void)
        roth_led_init();
        roth_audio_init();
        platform_add_devices(roth_devices, ARRAY_SIZE(roth_devices));
-       //tegra_ram_console_debug_init();
        tegra_io_dpd_init();
        roth_regulator_init();
        roth_sdhci_init();
@@ -603,7 +602,7 @@ static void __init tegra_roth_init(void)
 
 static void __init roth_ramconsole_reserve(unsigned long size)
 {
-       tegra_ram_console_debug_reserve(SZ_1M);
+       tegra_reserve_ramoops_memory(SZ_1M);
 }
 
 #ifdef CONFIG_USE_OF
index bf76143776e6db26062755e59b514fe854640bb8..16dfd3c342646a99e77995976dcb88e1775f24ad 100644 (file)
@@ -489,7 +489,7 @@ static void __init tegra_vcm30_t124_late_init(void)
 
 static void __init vcm30_t124_ramconsole_reserve(unsigned long size)
 {
-       tegra_ram_console_debug_reserve(SZ_1M);
+       tegra_reserve_ramoops_memory(SZ_1M);
 }
 
 static void __init tegra_vcm30_t124_dt_init(void)
index 6fd8cfe3f7cf000aecfd321074d0dcb56c781cc3..738ddabd0170bd4c4117da817d016b600e625e5a 100644 (file)
@@ -2,7 +2,7 @@
  * arch/arm/mach-tegra/board.h
  *
  * Copyright (C) 2010 Google, Inc.
- * Copyright (c) 2011-2013, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2011-2014, NVIDIA CORPORATION.  All rights reserved.
  *
  * Author:
  *     Colin Cross <ccross@google.com>
@@ -123,9 +123,10 @@ void set_sd_uart_port_id(int);
 int __init tegra_register_fuse(void);
 
 #ifdef CONFIG_PSTORE_RAM
-void __init tegra_ram_console_debug_reserve(unsigned long ram_console_size);
+void __init tegra_reserve_ramoops_memory(unsigned long ram_console_size);
 #else
-static inline void __init tegra_ram_console_debug_reserve(unsigned long ram_console_size)
+static inline void __init
+       tegra_reserve_ramoops_memory(unsigned long ram_console_size)
 {}
 #endif
 
index 1b76f7ecd804f222924bbae3df2b8b0ae96bbdbe..79065ea08233f46bcbb9ec913c4b02ce1b86c994 100644 (file)
@@ -881,7 +881,6 @@ void __init tegra20_init_early(void)
        tegra_init_power();
        tegra_init_ahb_gizmo_settings();
        tegra_init_debug_uart_rate();
-       tegra_ram_console_debug_reserve(SZ_1M);
 }
 #endif
 #ifdef CONFIG_ARCH_TEGRA_3x_SOC
@@ -928,7 +927,6 @@ void __init tegra30_init_early(void)
        tegra_init_power();
        tegra_init_ahb_gizmo_settings();
        tegra_init_debug_uart_rate();
-       tegra_ram_console_debug_reserve(SZ_1M);
 
        init_dma_coherent_pool_size(SZ_1M);
 }
@@ -1024,7 +1022,6 @@ void __init tegra14x_init_early(void)
        tegra_init_power();
        tegra_init_ahb_gizmo_settings();
        tegra_init_debug_uart_rate();
-       tegra_ram_console_debug_reserve(SZ_1M);
 }
 #endif
 static int __init tegra_lp0_vec_arg(char *options)
@@ -2143,34 +2140,31 @@ void tegra_get_fb2_resource(struct resource *fb2_res)
 }
 
 #ifdef CONFIG_PSTORE_RAM
-static struct persistent_ram_descriptor desc = {
+static struct ramoops_platform_data ramoops_data;
+
+static struct platform_device ramoops_dev  = {
        .name = "ramoops",
+       .dev = {
+               .platform_data = &ramoops_data,
+       },
 };
 
-static struct persistent_ram ram = {
-       .descs = &desc,
-       .num_descs = 1,
-};
 
-void __init tegra_ram_console_debug_reserve(unsigned long ram_console_size)
+void __init tegra_reserve_ramoops_memory(unsigned long reserve_size)
 {
-       int ret;
-
-       ram.start = memblock_end_of_DRAM() - ram_console_size;
-       ram.size = ram_console_size;
-       ram.descs->size = ram_console_size;
-
-       INIT_LIST_HEAD(&ram.node);
-
-       ret = persistent_ram_early_init(&ram);
-       if (ret)
-               goto fail;
-
-       return;
+       ramoops_data.mem_size = reserve_size;
+       ramoops_data.mem_address = memblock_end_of_4G() - reserve_size;
+       ramoops_data.console_size = reserve_size;
+       ramoops_data.dump_oops = 1;
+       memblock_reserve(ramoops_data.mem_address, ramoops_data.mem_size);
+}
 
-fail:
-       pr_err("Failed to reserve memory block for ram console\n");
+static void __init tegra_register_ramoops_device()
+{
+       if (platform_device_register(&ramoops_dev))
+               pr_info("Unable to register ramoops platform device\n");
 }
+core_initcall(tegra_register_ramoops_device);
 #endif
 
 int __init tegra_register_fuse(void)