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 /* OS defined sections */ 27 #define RTAS_FADUMP_PARAM_AREA 0x0100 28 29 /* Dump request flag */ 30 #define RTAS_FADUMP_REQUEST_FLAG 0x00000001 31 32 /* Dump status flag */ 33 #define RTAS_FADUMP_ERROR_FLAG 0x2000 34 35 /* 36 * The Firmware Assisted Dump Memory structure supports a maximum of 10 sections 37 * in the dump memory structure. Presently, three sections are used for 38 * CPU state data, HPTE & Parameters area, while the remaining seven sections 39 * can be used for boot memory regions. 40 */ 41 #define MAX_SECTIONS 10 42 #define RTAS_FADUMP_MAX_BOOT_MEM_REGS 7 43 44 /* Kernel Dump section info */ 45 struct rtas_fadump_section { 46 __be32 request_flag; 47 __be16 source_data_type; 48 __be16 error_flags; 49 __be64 source_address; 50 __be64 source_len; 51 __be64 bytes_dumped; 52 __be64 destination_address; 53 }; 54 55 /* ibm,configure-kernel-dump header. */ 56 struct rtas_fadump_section_header { 57 __be32 dump_format_version; 58 __be16 dump_num_sections; 59 __be16 dump_status_flag; 60 __be32 offset_first_dump_section; 61 62 /* Fields for disk dump option. */ 63 __be32 dd_block_size; 64 __be64 dd_block_offset; 65 __be64 dd_num_blocks; 66 __be32 dd_offset_disk_path; 67 68 /* Maximum time allowed to prevent an automatic dump-reboot. */ 69 __be32 max_time_auto; 70 }; 71 72 /* 73 * Firmware Assisted dump memory structure. This structure is required for 74 * registering future kernel dump with power firmware through rtas call. 75 * 76 * In version 1, the platform permits one section header, dump-disk path 77 * and ten sections. 78 * 79 * Note: No disk dump option. Hence disk dump path string section is not 80 * included. 81 */ 82 struct rtas_fadump_mem_struct { 83 struct rtas_fadump_section_header header; 84 struct rtas_fadump_section rgn[MAX_SECTIONS]; 85 }; 86 87 /* 88 * The firmware-assisted dump format. 89 * 90 * The register save area is an area in the partition's memory used to preserve 91 * the register contents (CPU state data) for the active CPUs during a firmware 92 * assisted dump. The dump format contains register save area header followed 93 * by register entries. Each list of registers for a CPU starts with "CPUSTRT" 94 * and ends with "CPUEND". 95 */ 96 97 /* Register save area header. */ 98 struct rtas_fadump_reg_save_area_header { 99 __be64 magic_number; 100 __be32 version; 101 __be32 num_cpu_offset; 102 }; 103 104 /* Register entry. */ 105 struct rtas_fadump_reg_entry { 106 __be64 reg_id; 107 __be64 reg_value; 108 }; 109 110 /* Utility macros */ 111 #define RTAS_FADUMP_SKIP_TO_NEXT_CPU(reg_entry) \ 112 ({ \ 113 while (be64_to_cpu(reg_entry->reg_id) != \ 114 fadump_str_to_u64("CPUEND")) \ 115 reg_entry++; \ 116 reg_entry++; \ 117 }) 118 119 #define RTAS_FADUMP_CPU_ID_MASK ((1UL << 32) - 1) 120 121 #endif /* _PSERIES_RTAS_FADUMP_H */ 122
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.