Commit 3ccc00a7 authored by Mahesh Salgaonkar's avatar Mahesh Salgaonkar Committed by Benjamin Herrenschmidt

fadump: Register for firmware assisted dump.

On 2012-02-20 11:02:51 Mon, Paul Mackerras wrote:
> On Thu, Feb 16, 2012 at 04:44:30PM +0530, Mahesh J Salgaonkar wrote:
>
> If I have read the code correctly, we are going to get this printk on
> non-pSeries machines or on older pSeries machines, even if the user
> has not put the fadump=on option on the kernel command line.  The
> printk will be annoying since there is no actual error condition.  It
> seems to me that the condition for the printk should include
> fw_dump.fadump_enabled.  In other words you should probably add
>
> 	if (!fw_dump.fadump_enabled)
> 		return 0;
>
> at the beginning of the function.

Hi Paul,

Thanks for pointing it out. Please find the updated patch below.

The existing patches above this (4/10 through 10/10) cleanly applies
on this update.

Thanks,
-Mahesh.
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent eb39c880
...@@ -48,6 +48,58 @@ ...@@ -48,6 +48,58 @@
#define FADUMP_HPTE_REGION 0x0002 #define FADUMP_HPTE_REGION 0x0002
#define FADUMP_REAL_MODE_REGION 0x0011 #define FADUMP_REAL_MODE_REGION 0x0011
/* Dump request flag */
#define FADUMP_REQUEST_FLAG 0x00000001
/* FAD commands */
#define FADUMP_REGISTER 1
#define FADUMP_UNREGISTER 2
#define FADUMP_INVALIDATE 3
/* Kernel Dump section info */
struct fadump_section {
u32 request_flag;
u16 source_data_type;
u16 error_flags;
u64 source_address;
u64 source_len;
u64 bytes_dumped;
u64 destination_address;
};
/* ibm,configure-kernel-dump header. */
struct fadump_section_header {
u32 dump_format_version;
u16 dump_num_sections;
u16 dump_status_flag;
u32 offset_first_dump_section;
/* Fields for disk dump option. */
u32 dd_block_size;
u64 dd_block_offset;
u64 dd_num_blocks;
u32 dd_offset_disk_path;
/* Maximum time allowed to prevent an automatic dump-reboot. */
u32 max_time_auto;
};
/*
* Firmware Assisted dump memory structure. This structure is required for
* registering future kernel dump with power firmware through rtas call.
*
* No disk dump option. Hence disk dump path string section is not included.
*/
struct fadump_mem_struct {
struct fadump_section_header header;
/* Kernel dump sections */
struct fadump_section cpu_state_data;
struct fadump_section hpte_region;
struct fadump_section rmr_region;
};
/* Firmware-assisted dump configuration details. */
struct fw_dump { struct fw_dump {
unsigned long cpu_state_data_size; unsigned long cpu_state_data_size;
unsigned long hpte_region_size; unsigned long hpte_region_size;
...@@ -62,10 +114,15 @@ struct fw_dump { ...@@ -62,10 +114,15 @@ struct fw_dump {
unsigned long fadump_enabled:1; unsigned long fadump_enabled:1;
unsigned long fadump_supported:1; unsigned long fadump_supported:1;
unsigned long dump_active:1; unsigned long dump_active:1;
unsigned long dump_registered:1;
}; };
extern int early_init_dt_scan_fw_dump(unsigned long node, extern int early_init_dt_scan_fw_dump(unsigned long node,
const char *uname, int depth, void *data); const char *uname, int depth, void *data);
extern int fadump_reserve_mem(void); extern int fadump_reserve_mem(void);
extern int setup_fadump(void);
extern int is_fadump_active(void);
#else /* CONFIG_FA_DUMP */
static inline int is_fadump_active(void) { return 0; }
#endif #endif
#endif #endif
This diff is collapsed.
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include <asm/pci-bridge.h> #include <asm/pci-bridge.h>
#include <asm/machdep.h> #include <asm/machdep.h>
#include <asm/kdump.h> #include <asm/kdump.h>
#include <asm/fadump.h>
#define DBG(...) #define DBG(...)
...@@ -445,7 +446,12 @@ void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist, ...@@ -445,7 +446,12 @@ void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist,
static void iommu_table_clear(struct iommu_table *tbl) static void iommu_table_clear(struct iommu_table *tbl)
{ {
if (!is_kdump_kernel()) { /*
* In case of firmware assisted dump system goes through clean
* reboot process at the time of system crash. Hence it's safe to
* clear the TCE entries if firmware assisted dump is active.
*/
if (!is_kdump_kernel() || is_fadump_active()) {
/* Clear the table in case firmware left allocations in it */ /* Clear the table in case firmware left allocations in it */
ppc_md.tce_free(tbl, tbl->it_offset, tbl->it_size); ppc_md.tce_free(tbl, tbl->it_offset, tbl->it_size);
return; return;
......
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
#include <asm/spu.h> #include <asm/spu.h>
#include <asm/udbg.h> #include <asm/udbg.h>
#include <asm/code-patching.h> #include <asm/code-patching.h>
#include <asm/fadump.h>
#ifdef DEBUG #ifdef DEBUG
#define DBG(fmt...) udbg_printf(fmt) #define DBG(fmt...) udbg_printf(fmt)
...@@ -625,6 +626,16 @@ static void __init htab_initialize(void) ...@@ -625,6 +626,16 @@ static void __init htab_initialize(void)
/* Using a hypervisor which owns the htab */ /* Using a hypervisor which owns the htab */
htab_address = NULL; htab_address = NULL;
_SDR1 = 0; _SDR1 = 0;
#ifdef CONFIG_FA_DUMP
/*
* If firmware assisted dump is active firmware preserves
* the contents of htab along with entire partition memory.
* Clear the htab if firmware assisted dump is active so
* that we dont end up using old mappings.
*/
if (is_fadump_active() && ppc_md.hpte_clear_all)
ppc_md.hpte_clear_all();
#endif
} else { } else {
/* Find storage for the HPT. Must be contiguous in /* Find storage for the HPT. Must be contiguous in
* the absolute address space. On cell we want it to be * the absolute address space. On cell we want it to be
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment