linux/arch/powerpc/platforms/pseries/rtas-fadump.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0-or-later */
   2/*
   3 * Firmware-Assisted Dump support on POWERVM platform.
   4 *
   5 * Copyright 2011, Mahesh Salgaonkar, IBM Corporation.
   6 * Copyright 2019, Hari Bathini, IBM Corporation.
   7 */
   8
   9#ifndef _PSERIES_RTAS_FADUMP_H
  10#define _PSERIES_RTAS_FADUMP_H
  11
  12/*
  13 * On some Power systems where RMO is 128MB, it still requires minimum of
  14 * 256MB for kernel to boot successfully. When kdump infrastructure is
  15 * configured to save vmcore over network, we run into OOM issue while
  16 * loading modules related to network setup. Hence we need additional 64M
  17 * of memory to avoid OOM issue.
  18 */
  19#define RTAS_FADUMP_MIN_BOOT_MEM        ((0x1UL << 28) + (0x1UL << 26))
  20
  21/* Firmware provided dump sections */
  22#define RTAS_FADUMP_CPU_STATE_DATA      0x0001
  23#define RTAS_FADUMP_HPTE_REGION         0x0002
  24#define RTAS_FADUMP_REAL_MODE_REGION    0x0011
  25
  26/* Dump request flag */
  27#define RTAS_FADUMP_REQUEST_FLAG        0x00000001
  28
  29/* Dump status flag */
  30#define RTAS_FADUMP_ERROR_FLAG          0x2000
  31
  32/* Kernel Dump section info */
  33struct rtas_fadump_section {
  34        __be32  request_flag;
  35        __be16  source_data_type;
  36        __be16  error_flags;
  37        __be64  source_address;
  38        __be64  source_len;
  39        __be64  bytes_dumped;
  40        __be64  destination_address;
  41};
  42
  43/* ibm,configure-kernel-dump header. */
  44struct rtas_fadump_section_header {
  45        __be32  dump_format_version;
  46        __be16  dump_num_sections;
  47        __be16  dump_status_flag;
  48        __be32  offset_first_dump_section;
  49
  50        /* Fields for disk dump option. */
  51        __be32  dd_block_size;
  52        __be64  dd_block_offset;
  53        __be64  dd_num_blocks;
  54        __be32  dd_offset_disk_path;
  55
  56        /* Maximum time allowed to prevent an automatic dump-reboot. */
  57        __be32  max_time_auto;
  58};
  59
  60/*
  61 * Firmware Assisted dump memory structure. This structure is required for
  62 * registering future kernel dump with power firmware through rtas call.
  63 *
  64 * No disk dump option. Hence disk dump path string section is not included.
  65 */
  66struct rtas_fadump_mem_struct {
  67        struct rtas_fadump_section_header       header;
  68
  69        /* Kernel dump sections */
  70        struct rtas_fadump_section              cpu_state_data;
  71        struct rtas_fadump_section              hpte_region;
  72
  73        /*
  74         * TODO: Extend multiple boot memory regions support in the kernel
  75         *       for this platform.
  76         */
  77        struct rtas_fadump_section              rmr_region;
  78};
  79
  80/*
  81 * The firmware-assisted dump format.
  82 *
  83 * The register save area is an area in the partition's memory used to preserve
  84 * the register contents (CPU state data) for the active CPUs during a firmware
  85 * assisted dump. The dump format contains register save area header followed
  86 * by register entries. Each list of registers for a CPU starts with "CPUSTRT"
  87 * and ends with "CPUEND".
  88 */
  89
  90/* Register save area header. */
  91struct rtas_fadump_reg_save_area_header {
  92        __be64          magic_number;
  93        __be32          version;
  94        __be32          num_cpu_offset;
  95};
  96
  97/* Register entry. */
  98struct rtas_fadump_reg_entry {
  99        __be64          reg_id;
 100        __be64          reg_value;
 101};
 102
 103/* Utility macros */
 104#define RTAS_FADUMP_SKIP_TO_NEXT_CPU(reg_entry)                         \
 105({                                                                      \
 106        while (be64_to_cpu(reg_entry->reg_id) !=                        \
 107               fadump_str_to_u64("CPUEND"))                             \
 108                reg_entry++;                                            \
 109        reg_entry++;                                                    \
 110})
 111
 112#define RTAS_FADUMP_CPU_ID_MASK                 ((1UL << 32) - 1)
 113
 114#endif /* _PSERIES_RTAS_FADUMP_H */
 115