Merge tag 'powerpc-6.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
[linux-block.git] / arch / powerpc / include / asm / fadump-internal.h
index 27f9e11eda28cd2c9254b52e9fdafe1eac820003..e83869a4eb6a5b938b4e6509d4bd3968672446a7 100644 (file)
@@ -42,13 +42,38 @@ static inline u64 fadump_str_to_u64(const char *str)
 
 #define FADUMP_CPU_UNKNOWN             (~((u32)0))
 
-#define FADUMP_CRASH_INFO_MAGIC                fadump_str_to_u64("FADMPINF")
+/*
+ * The introduction of new fields in the fadump crash info header has
+ * led to a change in the magic key from `FADMPINF` to `FADMPSIG` for
+ * identifying a kernel crash from an old kernel.
+ *
+ * To prevent the need for further changes to the magic number in the
+ * event of future modifications to the fadump crash info header, a
+ * version field has been introduced to track the fadump crash info
+ * header version.
+ *
+ * Consider a few points before adding new members to the fadump crash info
+ * header structure:
+ *
+ *  - Append new members; avoid adding them in between.
+ *  - Non-primitive members should have a size member as well.
+ *  - For every change in the fadump header, increment the
+ *    fadump header version. This helps the updated kernel decide how to
+ *    handle kernel dumps from older kernels.
+ */
+#define FADUMP_CRASH_INFO_MAGIC_OLD    fadump_str_to_u64("FADMPINF")
+#define FADUMP_CRASH_INFO_MAGIC                fadump_str_to_u64("FADMPSIG")
+#define FADUMP_HEADER_VERSION          1
 
 /* fadump crash info structure */
 struct fadump_crash_info_header {
        u64             magic_number;
-       u64             elfcorehdr_addr;
+       u32             version;
        u32             crashing_cpu;
+       u64             vmcoreinfo_raddr;
+       u64             vmcoreinfo_size;
+       u32             pt_regs_sz;
+       u32             cpu_mask_sz;
        struct pt_regs  regs;
        struct cpumask  cpu_mask;
 };
@@ -94,9 +119,13 @@ struct fw_dump {
        u64             boot_mem_regs_cnt;
 
        unsigned long   fadumphdr_addr;
+       u64             elfcorehdr_addr;
+       u64             elfcorehdr_size;
        unsigned long   cpu_notes_buf_vaddr;
        unsigned long   cpu_notes_buf_size;
 
+       unsigned long   param_area;
+
        /*
         * Maximum size supported by firmware to copy from source to
         * destination address per entry.
@@ -111,6 +140,7 @@ struct fw_dump {
        unsigned long   dump_active:1;
        unsigned long   dump_registered:1;
        unsigned long   nocma:1;
+       unsigned long   param_area_supported:1;
 
        struct fadump_ops       *ops;
 };
@@ -129,6 +159,7 @@ struct fadump_ops {
                                      struct seq_file *m);
        void    (*fadump_trigger)(struct fadump_crash_info_header *fdh,
                                  const char *msg);
+       int     (*fadump_max_boot_mem_rgns)(void);
 };
 
 /* Helper functions */
@@ -136,7 +167,6 @@ s32 __init fadump_setup_cpu_notes_buf(u32 num_cpus);
 void fadump_free_cpu_notes_buf(void);
 u32 *__init fadump_regs_to_elf_notes(u32 *buf, struct pt_regs *regs);
 void __init fadump_update_elfcore_header(char *bufp);
-bool is_fadump_boot_mem_contiguous(void);
 bool is_fadump_reserved_mem_contiguous(void);
 
 #else /* !CONFIG_PRESERVE_FA_DUMP */