| .. | .. |
|---|
| 13 | 13 | #include <linux/mm.h> |
|---|
| 14 | 14 | #include <linux/gfp.h> |
|---|
| 15 | 15 | #include <linux/slab.h> |
|---|
| 16 | | -#include <linux/bootmem.h> |
|---|
| 16 | +#include <linux/memblock.h> |
|---|
| 17 | 17 | #include <linux/elf.h> |
|---|
| 18 | 18 | #include <asm/asm-offsets.h> |
|---|
| 19 | | -#include <linux/memblock.h> |
|---|
| 20 | 19 | #include <asm/os_info.h> |
|---|
| 21 | 20 | #include <asm/elf.h> |
|---|
| 22 | 21 | #include <asm/ipl.h> |
|---|
| .. | .. |
|---|
| 45 | 44 | u64 fprs[16]; |
|---|
| 46 | 45 | u32 fpc; |
|---|
| 47 | 46 | u32 prefix; |
|---|
| 48 | | - u64 todpreg; |
|---|
| 47 | + u32 todpreg; |
|---|
| 49 | 48 | u64 timer; |
|---|
| 50 | 49 | u64 todcmp; |
|---|
| 51 | 50 | u64 vxrs_low[16]; |
|---|
| .. | .. |
|---|
| 61 | 60 | { |
|---|
| 62 | 61 | struct save_area *sa; |
|---|
| 63 | 62 | |
|---|
| 64 | | - sa = (void *) memblock_alloc(sizeof(*sa), 8); |
|---|
| 63 | + sa = (void *) memblock_phys_alloc(sizeof(*sa), 8); |
|---|
| 64 | + if (!sa) |
|---|
| 65 | + panic("Failed to allocate save area\n"); |
|---|
| 66 | + |
|---|
| 65 | 67 | if (is_boot_cpu) |
|---|
| 66 | 68 | list_add(&sa->list, &dump_save_areas); |
|---|
| 67 | 69 | else |
|---|
| .. | .. |
|---|
| 139 | 141 | while (count) { |
|---|
| 140 | 142 | from = __pa(src); |
|---|
| 141 | 143 | if (!OLDMEM_BASE && from < sclp.hsa_size) { |
|---|
| 142 | | - /* Copy from zfcpdump HSA area */ |
|---|
| 144 | + /* Copy from zfcp/nvme dump HSA area */ |
|---|
| 143 | 145 | len = min(count, sclp.hsa_size - from); |
|---|
| 144 | 146 | rc = memcpy_hsa_kernel(dst, from, len); |
|---|
| 145 | 147 | if (rc) |
|---|
| .. | .. |
|---|
| 182 | 184 | while (count) { |
|---|
| 183 | 185 | from = __pa(src); |
|---|
| 184 | 186 | if (!OLDMEM_BASE && from < sclp.hsa_size) { |
|---|
| 185 | | - /* Copy from zfcpdump HSA area */ |
|---|
| 187 | + /* Copy from zfcp/nvme dump HSA area */ |
|---|
| 186 | 188 | len = min(count, sclp.hsa_size - from); |
|---|
| 187 | 189 | rc = memcpy_hsa_user(dst, from, len); |
|---|
| 188 | 190 | if (rc) |
|---|
| .. | .. |
|---|
| 256 | 258 | } |
|---|
| 257 | 259 | |
|---|
| 258 | 260 | /* |
|---|
| 259 | | - * Remap "oldmem" for zfcpdump |
|---|
| 261 | + * Remap "oldmem" for zfcp/nvme dump |
|---|
| 260 | 262 | * |
|---|
| 261 | 263 | * We only map available memory above HSA size. Memory below HSA size |
|---|
| 262 | 264 | * is read on demand using the copy_oldmem_page() function. |
|---|
| .. | .. |
|---|
| 281 | 283 | } |
|---|
| 282 | 284 | |
|---|
| 283 | 285 | /* |
|---|
| 284 | | - * Remap "oldmem" for kdump or zfcpdump |
|---|
| 286 | + * Remap "oldmem" for kdump or zfcp/nvme dump |
|---|
| 285 | 287 | */ |
|---|
| 286 | 288 | int remap_oldmem_pfn_range(struct vm_area_struct *vma, unsigned long from, |
|---|
| 287 | 289 | unsigned long pfn, unsigned long size, pgprot_t prot) |
|---|
| .. | .. |
|---|
| 430 | 432 | Elf64_Nhdr note; |
|---|
| 431 | 433 | void *addr; |
|---|
| 432 | 434 | |
|---|
| 433 | | - if (copy_oldmem_kernel(&addr, &S390_lowcore.vmcore_info, sizeof(addr))) |
|---|
| 435 | + if (copy_oldmem_kernel(&addr, (void *)__LC_VMCORE_INFO, sizeof(addr))) |
|---|
| 434 | 436 | return NULL; |
|---|
| 435 | 437 | memset(nt_name, 0, sizeof(nt_name)); |
|---|
| 436 | 438 | if (copy_oldmem_kernel(¬e, addr, sizeof(note))) |
|---|
| .. | .. |
|---|
| 547 | 549 | int cnt = 0; |
|---|
| 548 | 550 | u64 idx; |
|---|
| 549 | 551 | |
|---|
| 550 | | - for_each_mem_range(idx, &memblock.physmem, &oldmem_type, NUMA_NO_NODE, |
|---|
| 551 | | - MEMBLOCK_NONE, NULL, NULL, NULL) |
|---|
| 552 | + for_each_physmem_range(idx, &oldmem_type, NULL, NULL) |
|---|
| 552 | 553 | cnt++; |
|---|
| 553 | 554 | return cnt; |
|---|
| 554 | 555 | } |
|---|
| .. | .. |
|---|
| 561 | 562 | phys_addr_t start, end; |
|---|
| 562 | 563 | u64 idx; |
|---|
| 563 | 564 | |
|---|
| 564 | | - for_each_mem_range(idx, &memblock.physmem, &oldmem_type, NUMA_NO_NODE, |
|---|
| 565 | | - MEMBLOCK_NONE, &start, &end, NULL) { |
|---|
| 565 | + for_each_physmem_range(idx, &oldmem_type, &start, &end) { |
|---|
| 566 | 566 | phdr->p_filesz = end - start; |
|---|
| 567 | 567 | phdr->p_type = PT_LOAD; |
|---|
| 568 | 568 | phdr->p_offset = start; |
|---|
| .. | .. |
|---|
| 632 | 632 | u32 alloc_size; |
|---|
| 633 | 633 | u64 hdr_off; |
|---|
| 634 | 634 | |
|---|
| 635 | | - /* If we are not in kdump or zfcpdump mode return */ |
|---|
| 636 | | - if (!OLDMEM_BASE && ipl_info.type != IPL_TYPE_FCP_DUMP) |
|---|
| 635 | + /* If we are not in kdump or zfcp/nvme dump mode return */ |
|---|
| 636 | + if (!OLDMEM_BASE && !is_ipl_type_dump()) |
|---|
| 637 | 637 | return 0; |
|---|
| 638 | | - /* If we cannot get HSA size for zfcpdump return error */ |
|---|
| 639 | | - if (ipl_info.type == IPL_TYPE_FCP_DUMP && !sclp.hsa_size) |
|---|
| 638 | + /* If we cannot get HSA size for zfcp/nvme dump return error */ |
|---|
| 639 | + if (is_ipl_type_dump() && !sclp.hsa_size) |
|---|
| 640 | 640 | return -ENODEV; |
|---|
| 641 | 641 | |
|---|
| 642 | 642 | /* For kdump, exclude previous crashkernel memory */ |
|---|