Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 1 | /* |
| 2 | * zcore module to export memory content and register sets for creating system |
| 3 | * dumps on SCSI disks (zfcpdump). The "zcore/mem" debugfs file shows the same |
| 4 | * dump format as s390 standalone dumps. |
| 5 | * |
| 6 | * For more information please refer to Documentation/s390/zfcpdump.txt |
| 7 | * |
Heiko Carstens | a53c8fa | 2012-07-20 11:15:04 +0200 | [diff] [blame] | 8 | * Copyright IBM Corp. 2003, 2008 |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 9 | * Author(s): Michael Holzheu |
Paul Gortmaker | cbe62fa | 2016-10-30 16:37:25 -0400 | [diff] [blame] | 10 | * License: GPL |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 11 | */ |
| 12 | |
Michael Holzheu | 17159dc6 | 2008-12-25 13:39:51 +0100 | [diff] [blame] | 13 | #define KMSG_COMPONENT "zdump" |
| 14 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt |
| 15 | |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 16 | #include <linux/init.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 17 | #include <linux/slab.h> |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 18 | #include <linux/debugfs.h> |
Philipp Hachtmann | 50be634 | 2014-01-29 18:16:01 +0100 | [diff] [blame] | 19 | #include <linux/memblock.h> |
| 20 | |
Heiko Carstens | cbb870c | 2010-02-26 22:37:43 +0100 | [diff] [blame] | 21 | #include <asm/asm-offsets.h> |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 22 | #include <asm/ipl.h> |
| 23 | #include <asm/sclp.h> |
| 24 | #include <asm/setup.h> |
Linus Torvalds | 7c0f6ba | 2016-12-24 11:46:01 -0800 | [diff] [blame] | 25 | #include <linux/uaccess.h> |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 26 | #include <asm/debug.h> |
| 27 | #include <asm/processor.h> |
| 28 | #include <asm/irqflags.h> |
Frank Munzert | 159d1ff | 2009-03-26 15:24:45 +0100 | [diff] [blame] | 29 | #include <asm/checksum.h> |
Martin Schwidefsky | bbfed51 | 2015-10-15 11:14:19 +0200 | [diff] [blame] | 30 | #include <asm/os_info.h> |
Michael Holzheu | a62bc07 | 2014-10-06 17:57:43 +0200 | [diff] [blame] | 31 | #include <asm/switch_to.h> |
Heiko Carstens | 763968e | 2007-05-10 15:45:46 +0200 | [diff] [blame] | 32 | #include "sclp.h" |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 33 | |
| 34 | #define TRACE(x...) debug_sprintf_event(zcore_dbf, 1, x) |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 35 | |
Frank Munzert | 12e0c95 | 2008-07-17 17:16:40 +0200 | [diff] [blame] | 36 | #define CHUNK_INFO_SIZE 34 /* 2 16-byte char, each followed by blank */ |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 37 | |
| 38 | enum arch_id { |
| 39 | ARCH_S390 = 0, |
| 40 | ARCH_S390X = 1, |
| 41 | }; |
| 42 | |
Frank Munzert | 099b765 | 2009-03-26 15:23:43 +0100 | [diff] [blame] | 43 | struct ipib_info { |
| 44 | unsigned long ipib; |
| 45 | u32 checksum; |
| 46 | } __attribute__((packed)); |
| 47 | |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 48 | static struct debug_info *zcore_dbf; |
| 49 | static int hsa_available; |
| 50 | static struct dentry *zcore_dir; |
Frank Munzert | 12e0c95 | 2008-07-17 17:16:40 +0200 | [diff] [blame] | 51 | static struct dentry *zcore_memmap_file; |
Frank Munzert | 099b765 | 2009-03-26 15:23:43 +0100 | [diff] [blame] | 52 | static struct dentry *zcore_reipl_file; |
Michael Holzheu | b4b3d12 | 2013-01-21 18:37:41 +0100 | [diff] [blame] | 53 | static struct dentry *zcore_hsa_file; |
Frank Munzert | 099b765 | 2009-03-26 15:23:43 +0100 | [diff] [blame] | 54 | static struct ipl_parameter_block *ipl_block; |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 55 | |
Martin Schwidefsky | 019d6be | 2015-10-12 10:51:54 +0200 | [diff] [blame] | 56 | static char hsa_buf[PAGE_SIZE] __aligned(PAGE_SIZE); |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 57 | |
Martin Schwidefsky | df9694c | 2015-10-12 10:43:37 +0200 | [diff] [blame] | 58 | /* |
| 59 | * Copy memory from HSA to user memory (not reentrant): |
| 60 | * |
Martin Schwidefsky | 019d6be | 2015-10-12 10:51:54 +0200 | [diff] [blame] | 61 | * @dest: User buffer where memory should be copied to |
Martin Schwidefsky | df9694c | 2015-10-12 10:43:37 +0200 | [diff] [blame] | 62 | * @src: Start address within HSA where data should be copied |
| 63 | * @count: Size of buffer, which should be copied |
| 64 | */ |
| 65 | int memcpy_hsa_user(void __user *dest, unsigned long src, size_t count) |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 66 | { |
Martin Schwidefsky | 019d6be | 2015-10-12 10:51:54 +0200 | [diff] [blame] | 67 | unsigned long offset, bytes; |
| 68 | |
| 69 | if (!hsa_available) |
| 70 | return -ENODATA; |
| 71 | |
| 72 | while (count) { |
| 73 | if (sclp_sdias_copy(hsa_buf, src / PAGE_SIZE + 2, 1)) { |
| 74 | TRACE("sclp_sdias_copy() failed\n"); |
| 75 | return -EIO; |
| 76 | } |
| 77 | offset = src % PAGE_SIZE; |
| 78 | bytes = min(PAGE_SIZE - offset, count); |
| 79 | if (copy_to_user(dest, hsa_buf + offset, bytes)) |
| 80 | return -EFAULT; |
| 81 | src += bytes; |
| 82 | dest += bytes; |
| 83 | count -= bytes; |
| 84 | } |
| 85 | return 0; |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 86 | } |
| 87 | |
Martin Schwidefsky | df9694c | 2015-10-12 10:43:37 +0200 | [diff] [blame] | 88 | /* |
| 89 | * Copy memory from HSA to kernel memory (not reentrant): |
| 90 | * |
| 91 | * @dest: Kernel or user buffer where memory should be copied to |
| 92 | * @src: Start address within HSA where data should be copied |
| 93 | * @count: Size of buffer, which should be copied |
| 94 | */ |
| 95 | int memcpy_hsa_kernel(void *dest, unsigned long src, size_t count) |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 96 | { |
Martin Schwidefsky | 019d6be | 2015-10-12 10:51:54 +0200 | [diff] [blame] | 97 | unsigned long offset, bytes; |
| 98 | |
| 99 | if (!hsa_available) |
| 100 | return -ENODATA; |
| 101 | |
| 102 | while (count) { |
| 103 | if (sclp_sdias_copy(hsa_buf, src / PAGE_SIZE + 2, 1)) { |
| 104 | TRACE("sclp_sdias_copy() failed\n"); |
| 105 | return -EIO; |
| 106 | } |
| 107 | offset = src % PAGE_SIZE; |
| 108 | bytes = min(PAGE_SIZE - offset, count); |
| 109 | memcpy(dest, hsa_buf + offset, bytes); |
| 110 | src += bytes; |
| 111 | dest += bytes; |
| 112 | count -= bytes; |
| 113 | } |
| 114 | return 0; |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 115 | } |
| 116 | |
Martin Schwidefsky | ffa52d0 | 2015-10-28 09:47:58 +0100 | [diff] [blame] | 117 | static int __init init_cpu_info(void) |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 118 | { |
Martin Schwidefsky | 1a2c584 | 2015-10-29 10:59:15 +0100 | [diff] [blame] | 119 | struct save_area *sa; |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 120 | |
| 121 | /* get info for boot cpu from lowcore, stored in the HSA */ |
Martin Schwidefsky | 1a2c584 | 2015-10-29 10:59:15 +0100 | [diff] [blame] | 122 | sa = save_area_boot_cpu(); |
| 123 | if (!sa) |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 124 | return -ENOMEM; |
Martin Schwidefsky | 1a2c584 | 2015-10-29 10:59:15 +0100 | [diff] [blame] | 125 | if (memcpy_hsa_kernel(hsa_buf, __LC_FPREGS_SAVE_AREA, 512) < 0) { |
Michael Holzheu | 2a062ab | 2008-07-14 09:59:38 +0200 | [diff] [blame] | 126 | TRACE("could not copy from HSA\n"); |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 127 | return -EIO; |
| 128 | } |
Martin Schwidefsky | 1a2c584 | 2015-10-29 10:59:15 +0100 | [diff] [blame] | 129 | save_area_add_regs(sa, hsa_buf); /* vx registers are saved in smp.c */ |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 130 | return 0; |
| 131 | } |
| 132 | |
| 133 | /* |
Michael Holzheu | b4b3d12 | 2013-01-21 18:37:41 +0100 | [diff] [blame] | 134 | * Release the HSA |
| 135 | */ |
| 136 | static void release_hsa(void) |
| 137 | { |
| 138 | diag308(DIAG308_REL_HSA, NULL); |
| 139 | hsa_available = 0; |
| 140 | } |
| 141 | |
Frank Munzert | 12e0c95 | 2008-07-17 17:16:40 +0200 | [diff] [blame] | 142 | static ssize_t zcore_memmap_read(struct file *filp, char __user *buf, |
| 143 | size_t count, loff_t *ppos) |
| 144 | { |
| 145 | return simple_read_from_buffer(buf, count, ppos, filp->private_data, |
Philipp Hachtmann | 50be634 | 2014-01-29 18:16:01 +0100 | [diff] [blame] | 146 | memblock.memory.cnt * CHUNK_INFO_SIZE); |
Frank Munzert | 12e0c95 | 2008-07-17 17:16:40 +0200 | [diff] [blame] | 147 | } |
| 148 | |
| 149 | static int zcore_memmap_open(struct inode *inode, struct file *filp) |
| 150 | { |
Philipp Hachtmann | 50be634 | 2014-01-29 18:16:01 +0100 | [diff] [blame] | 151 | struct memblock_region *reg; |
Frank Munzert | 12e0c95 | 2008-07-17 17:16:40 +0200 | [diff] [blame] | 152 | char *buf; |
Philipp Hachtmann | 50be634 | 2014-01-29 18:16:01 +0100 | [diff] [blame] | 153 | int i = 0; |
Frank Munzert | 12e0c95 | 2008-07-17 17:16:40 +0200 | [diff] [blame] | 154 | |
Philipp Hachtmann | 50be634 | 2014-01-29 18:16:01 +0100 | [diff] [blame] | 155 | buf = kzalloc(memblock.memory.cnt * CHUNK_INFO_SIZE, GFP_KERNEL); |
Frank Munzert | 12e0c95 | 2008-07-17 17:16:40 +0200 | [diff] [blame] | 156 | if (!buf) { |
Frank Munzert | 12e0c95 | 2008-07-17 17:16:40 +0200 | [diff] [blame] | 157 | return -ENOMEM; |
| 158 | } |
Philipp Hachtmann | 50be634 | 2014-01-29 18:16:01 +0100 | [diff] [blame] | 159 | for_each_memblock(memory, reg) { |
| 160 | sprintf(buf + (i++ * CHUNK_INFO_SIZE), "%016llx %016llx ", |
| 161 | (unsigned long long) reg->base, |
| 162 | (unsigned long long) reg->size); |
Frank Munzert | 12e0c95 | 2008-07-17 17:16:40 +0200 | [diff] [blame] | 163 | } |
Frank Munzert | 12e0c95 | 2008-07-17 17:16:40 +0200 | [diff] [blame] | 164 | filp->private_data = buf; |
Martin Schwidefsky | 58ea91c | 2010-05-17 10:00:07 +0200 | [diff] [blame] | 165 | return nonseekable_open(inode, filp); |
Frank Munzert | 12e0c95 | 2008-07-17 17:16:40 +0200 | [diff] [blame] | 166 | } |
| 167 | |
| 168 | static int zcore_memmap_release(struct inode *inode, struct file *filp) |
| 169 | { |
| 170 | kfree(filp->private_data); |
| 171 | return 0; |
| 172 | } |
| 173 | |
| 174 | static const struct file_operations zcore_memmap_fops = { |
| 175 | .owner = THIS_MODULE, |
| 176 | .read = zcore_memmap_read, |
| 177 | .open = zcore_memmap_open, |
| 178 | .release = zcore_memmap_release, |
Arnd Bergmann | 6038f37 | 2010-08-15 18:52:59 +0200 | [diff] [blame] | 179 | .llseek = no_llseek, |
Frank Munzert | 12e0c95 | 2008-07-17 17:16:40 +0200 | [diff] [blame] | 180 | }; |
| 181 | |
Frank Munzert | 099b765 | 2009-03-26 15:23:43 +0100 | [diff] [blame] | 182 | static ssize_t zcore_reipl_write(struct file *filp, const char __user *buf, |
| 183 | size_t count, loff_t *ppos) |
| 184 | { |
| 185 | if (ipl_block) { |
| 186 | diag308(DIAG308_SET, ipl_block); |
Heiko Carstens | 0599eea | 2016-06-11 11:24:27 +0200 | [diff] [blame] | 187 | diag308(DIAG308_LOAD_CLEAR, NULL); |
Frank Munzert | 099b765 | 2009-03-26 15:23:43 +0100 | [diff] [blame] | 188 | } |
| 189 | return count; |
| 190 | } |
| 191 | |
| 192 | static int zcore_reipl_open(struct inode *inode, struct file *filp) |
| 193 | { |
Martin Schwidefsky | 58ea91c | 2010-05-17 10:00:07 +0200 | [diff] [blame] | 194 | return nonseekable_open(inode, filp); |
Frank Munzert | 099b765 | 2009-03-26 15:23:43 +0100 | [diff] [blame] | 195 | } |
| 196 | |
| 197 | static int zcore_reipl_release(struct inode *inode, struct file *filp) |
| 198 | { |
| 199 | return 0; |
| 200 | } |
| 201 | |
| 202 | static const struct file_operations zcore_reipl_fops = { |
| 203 | .owner = THIS_MODULE, |
| 204 | .write = zcore_reipl_write, |
| 205 | .open = zcore_reipl_open, |
| 206 | .release = zcore_reipl_release, |
Arnd Bergmann | 6038f37 | 2010-08-15 18:52:59 +0200 | [diff] [blame] | 207 | .llseek = no_llseek, |
Frank Munzert | 099b765 | 2009-03-26 15:23:43 +0100 | [diff] [blame] | 208 | }; |
| 209 | |
Michael Holzheu | b4b3d12 | 2013-01-21 18:37:41 +0100 | [diff] [blame] | 210 | static ssize_t zcore_hsa_read(struct file *filp, char __user *buf, |
| 211 | size_t count, loff_t *ppos) |
| 212 | { |
| 213 | static char str[18]; |
| 214 | |
| 215 | if (hsa_available) |
David Hildenbrand | 37c5f6c | 2015-05-06 13:18:59 +0200 | [diff] [blame] | 216 | snprintf(str, sizeof(str), "%lx\n", sclp.hsa_size); |
Michael Holzheu | b4b3d12 | 2013-01-21 18:37:41 +0100 | [diff] [blame] | 217 | else |
| 218 | snprintf(str, sizeof(str), "0\n"); |
| 219 | return simple_read_from_buffer(buf, count, ppos, str, strlen(str)); |
| 220 | } |
| 221 | |
| 222 | static ssize_t zcore_hsa_write(struct file *filp, const char __user *buf, |
| 223 | size_t count, loff_t *ppos) |
| 224 | { |
| 225 | char value; |
| 226 | |
| 227 | if (*ppos != 0) |
| 228 | return -EPIPE; |
| 229 | if (copy_from_user(&value, buf, 1)) |
| 230 | return -EFAULT; |
| 231 | if (value != '0') |
| 232 | return -EINVAL; |
| 233 | release_hsa(); |
| 234 | return count; |
| 235 | } |
| 236 | |
| 237 | static const struct file_operations zcore_hsa_fops = { |
| 238 | .owner = THIS_MODULE, |
| 239 | .write = zcore_hsa_write, |
| 240 | .read = zcore_hsa_read, |
| 241 | .open = nonseekable_open, |
| 242 | .llseek = no_llseek, |
| 243 | }; |
| 244 | |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 245 | static int __init check_sdias(void) |
| 246 | { |
David Hildenbrand | 37c5f6c | 2015-05-06 13:18:59 +0200 | [diff] [blame] | 247 | if (!sclp.hsa_size) { |
Michael Holzheu | 2a062ab | 2008-07-14 09:59:38 +0200 | [diff] [blame] | 248 | TRACE("Could not determine HSA size\n"); |
Michael Holzheu | e657d8f | 2013-11-13 10:38:27 +0100 | [diff] [blame] | 249 | return -ENODEV; |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 250 | } |
| 251 | return 0; |
| 252 | } |
| 253 | |
Frank Munzert | 099b765 | 2009-03-26 15:23:43 +0100 | [diff] [blame] | 254 | /* |
| 255 | * Provide IPL parameter information block from either HSA or memory |
| 256 | * for future reipl |
| 257 | */ |
| 258 | static int __init zcore_reipl_init(void) |
| 259 | { |
| 260 | struct ipib_info ipib_info; |
| 261 | int rc; |
| 262 | |
| 263 | rc = memcpy_hsa_kernel(&ipib_info, __LC_DUMP_REIPL, sizeof(ipib_info)); |
| 264 | if (rc) |
| 265 | return rc; |
| 266 | if (ipib_info.ipib == 0) |
| 267 | return 0; |
| 268 | ipl_block = (void *) __get_free_page(GFP_KERNEL); |
| 269 | if (!ipl_block) |
| 270 | return -ENOMEM; |
David Hildenbrand | 37c5f6c | 2015-05-06 13:18:59 +0200 | [diff] [blame] | 271 | if (ipib_info.ipib < sclp.hsa_size) |
Frank Munzert | 099b765 | 2009-03-26 15:23:43 +0100 | [diff] [blame] | 272 | rc = memcpy_hsa_kernel(ipl_block, ipib_info.ipib, PAGE_SIZE); |
| 273 | else |
Michael Holzheu | 92fe313 | 2010-03-24 11:49:50 +0100 | [diff] [blame] | 274 | rc = memcpy_real(ipl_block, (void *) ipib_info.ipib, PAGE_SIZE); |
Heiko Carstens | 90b3baa | 2016-12-20 16:08:05 +0100 | [diff] [blame] | 275 | if (rc || (__force u32)csum_partial(ipl_block, ipl_block->hdr.len, 0) != |
Frank Munzert | 159d1ff | 2009-03-26 15:24:45 +0100 | [diff] [blame] | 276 | ipib_info.checksum) { |
Frank Munzert | 099b765 | 2009-03-26 15:23:43 +0100 | [diff] [blame] | 277 | TRACE("Checksum does not match\n"); |
| 278 | free_page((unsigned long) ipl_block); |
| 279 | ipl_block = NULL; |
| 280 | } |
| 281 | return 0; |
| 282 | } |
| 283 | |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 284 | static int __init zcore_init(void) |
| 285 | { |
| 286 | unsigned char arch; |
| 287 | int rc; |
| 288 | |
| 289 | if (ipl_info.type != IPL_TYPE_FCP_DUMP) |
| 290 | return -ENODATA; |
Michael Holzheu | 3f25dc4 | 2011-11-14 11:19:05 +0100 | [diff] [blame] | 291 | if (OLDMEM_BASE) |
| 292 | return -ENODATA; |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 293 | |
| 294 | zcore_dbf = debug_register("zcore", 4, 1, 4 * sizeof(long)); |
| 295 | debug_register_view(zcore_dbf, &debug_sprintf_view); |
| 296 | debug_set_level(zcore_dbf, 6); |
| 297 | |
| 298 | TRACE("devno: %x\n", ipl_info.data.fcp.dev_id.devno); |
| 299 | TRACE("wwpn: %llx\n", (unsigned long long) ipl_info.data.fcp.wwpn); |
| 300 | TRACE("lun: %llx\n", (unsigned long long) ipl_info.data.fcp.lun); |
| 301 | |
Heiko Carstens | 763968e | 2007-05-10 15:45:46 +0200 | [diff] [blame] | 302 | rc = sclp_sdias_init(); |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 303 | if (rc) |
| 304 | goto fail; |
| 305 | |
| 306 | rc = check_sdias(); |
Michael Holzheu | 2a062ab | 2008-07-14 09:59:38 +0200 | [diff] [blame] | 307 | if (rc) |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 308 | goto fail; |
Michael Holzheu | b4b3d12 | 2013-01-21 18:37:41 +0100 | [diff] [blame] | 309 | hsa_available = 1; |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 310 | |
| 311 | rc = memcpy_hsa_kernel(&arch, __LC_AR_MODE_ID, 1); |
Michael Holzheu | 2a062ab | 2008-07-14 09:59:38 +0200 | [diff] [blame] | 312 | if (rc) |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 313 | goto fail; |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 314 | |
Heiko Carstens | f64ca21 | 2010-02-26 22:37:32 +0100 | [diff] [blame] | 315 | if (arch == ARCH_S390) { |
| 316 | pr_alert("The 64-bit dump tool cannot be used for a " |
| 317 | "32-bit system\n"); |
| 318 | rc = -EINVAL; |
| 319 | goto fail; |
| 320 | } |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 321 | |
Michael Holzheu | 6896226 | 2016-11-14 18:51:41 +0100 | [diff] [blame] | 322 | pr_alert("The dump process started for a 64-bit operating system\n"); |
Martin Schwidefsky | ffa52d0 | 2015-10-28 09:47:58 +0100 | [diff] [blame] | 323 | rc = init_cpu_info(); |
Michael Holzheu | 2a062ab | 2008-07-14 09:59:38 +0200 | [diff] [blame] | 324 | if (rc) |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 325 | goto fail; |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 326 | |
Frank Munzert | 099b765 | 2009-03-26 15:23:43 +0100 | [diff] [blame] | 327 | rc = zcore_reipl_init(); |
| 328 | if (rc) |
| 329 | goto fail; |
| 330 | |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 331 | zcore_dir = debugfs_create_dir("zcore" , NULL); |
| 332 | if (!zcore_dir) { |
| 333 | rc = -ENOMEM; |
| 334 | goto fail; |
| 335 | } |
Frank Munzert | 12e0c95 | 2008-07-17 17:16:40 +0200 | [diff] [blame] | 336 | zcore_memmap_file = debugfs_create_file("memmap", S_IRUSR, zcore_dir, |
| 337 | NULL, &zcore_memmap_fops); |
| 338 | if (!zcore_memmap_file) { |
| 339 | rc = -ENOMEM; |
Martin Schwidefsky | ffa52d0 | 2015-10-28 09:47:58 +0100 | [diff] [blame] | 340 | goto fail_dir; |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 341 | } |
Frank Munzert | 099b765 | 2009-03-26 15:23:43 +0100 | [diff] [blame] | 342 | zcore_reipl_file = debugfs_create_file("reipl", S_IRUSR, zcore_dir, |
| 343 | NULL, &zcore_reipl_fops); |
| 344 | if (!zcore_reipl_file) { |
| 345 | rc = -ENOMEM; |
| 346 | goto fail_memmap_file; |
| 347 | } |
Michael Holzheu | b4b3d12 | 2013-01-21 18:37:41 +0100 | [diff] [blame] | 348 | zcore_hsa_file = debugfs_create_file("hsa", S_IRUSR|S_IWUSR, zcore_dir, |
| 349 | NULL, &zcore_hsa_fops); |
| 350 | if (!zcore_hsa_file) { |
| 351 | rc = -ENOMEM; |
| 352 | goto fail_reipl_file; |
| 353 | } |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 354 | return 0; |
| 355 | |
Michael Holzheu | b4b3d12 | 2013-01-21 18:37:41 +0100 | [diff] [blame] | 356 | fail_reipl_file: |
| 357 | debugfs_remove(zcore_reipl_file); |
Frank Munzert | 099b765 | 2009-03-26 15:23:43 +0100 | [diff] [blame] | 358 | fail_memmap_file: |
| 359 | debugfs_remove(zcore_memmap_file); |
Frank Munzert | 12e0c95 | 2008-07-17 17:16:40 +0200 | [diff] [blame] | 360 | fail_dir: |
| 361 | debugfs_remove(zcore_dir); |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 362 | fail: |
| 363 | diag308(DIAG308_REL_HSA, NULL); |
| 364 | return rc; |
| 365 | } |
Michael Holzheu | 411ed32 | 2007-04-27 16:01:49 +0200 | [diff] [blame] | 366 | subsys_initcall(zcore_init); |