// SPDX-License-Identifier: GPL-1.0+ /* * zcore module to export memory content and register sets for creating system * dumps on SCSI/NVMe disks (zfcp/nvme dump). * * For more information please refer to Documentation/arch/s390/zfcpdump.rst * * Copyright IBM Corp. 2003, 2008 * Author(s): Michael Holzheu
*/
/* * Copy memory from HSA to iterator (not reentrant): * * @iter: Iterator where memory should be copied to * @src: Start address within HSA where data should be copied * @count: Size of buffer, which should be copied
*/
size_t memcpy_hsa_iter(struct iov_iter *iter, unsignedlong src, size_t count)
{
size_t bytes, copied, res = 0; unsignedlong offset;
/* * Copy memory from HSA to kernel memory (not reentrant): * * @dest: Kernel or user buffer where memory should be copied to * @src: Start address within HSA where data should be copied * @count: Size of buffer, which should be copied
*/ staticinlineint memcpy_hsa_kernel(void *dst, unsignedlong src, size_t count)
{ struct iov_iter iter; struct kvec kvec;
/* get info for boot cpu from lowcore, stored in the HSA */
sa = save_area_boot_cpu(); if (!sa) return -ENOMEM; if (memcpy_hsa_kernel(hsa_buf, __LC_FPREGS_SAVE_AREA, 512) < 0) {
TRACE("could not copy from HSA\n"); return -EIO;
}
save_area_add_regs(sa, hsa_buf); /* vx registers are saved in smp.c */ return 0;
}
staticint __init check_sdias(void)
{ if (!sclp.hsa_size) {
TRACE("Could not determine HSA size\n"); return -ENODEV;
} return 0;
}
/* * Provide IPL parameter information block from either HSA or memory * for future reipl
*/ staticint __init zcore_reipl_init(void)
{ struct os_info_entry *entry; struct ipib_info ipib_info; unsignedlong os_info_addr; struct os_info *os_info; int rc;
rc = memcpy_hsa_kernel(&ipib_info, __LC_DUMP_REIPL, sizeof(ipib_info)); if (rc) return rc; if (ipib_info.ipib == 0) return 0;
zcore_ipl_block = (void *) __get_free_page(GFP_KERNEL); if (!zcore_ipl_block) return -ENOMEM; if (ipib_info.ipib < sclp.hsa_size)
rc = memcpy_hsa_kernel(zcore_ipl_block, ipib_info.ipib,
PAGE_SIZE); else
rc = memcpy_real(zcore_ipl_block, ipib_info.ipib, PAGE_SIZE); if (rc || (__force u32)csum_partial(zcore_ipl_block, zcore_ipl_block->hdr.len, 0) !=
ipib_info.checksum) {
TRACE("Checksum does not match\n");
free_page((unsignedlong) zcore_ipl_block);
zcore_ipl_block = NULL;
} /* * Read the bit-flags field from os_info flags entry. * Return zero even for os_info read or entry checksum errors in order * to continue dump processing, considering that os_info could be * corrupted on the panicked system.
*/
os_info = (void *)__get_free_page(GFP_KERNEL); if (!os_info) return -ENOMEM;
rc = memcpy_hsa_kernel(&os_info_addr, __LC_OS_INFO, sizeof(os_info_addr)); if (rc) goto out; if (os_info_addr < sclp.hsa_size)
rc = memcpy_hsa_kernel(os_info, os_info_addr, PAGE_SIZE); else
rc = memcpy_real(os_info, os_info_addr, PAGE_SIZE); if (rc || os_info_csum(os_info) != os_info->csum) goto out;
entry = &os_info->entry[OS_INFO_FLAGS_ENTRY]; if (entry->addr && entry->size) { if (entry->addr < sclp.hsa_size)
rc = memcpy_hsa_kernel(&os_info_flags, entry->addr, sizeof(os_info_flags)); else
rc = memcpy_real(&os_info_flags, entry->addr, sizeof(os_info_flags)); if (rc || (__force u32)csum_partial(&os_info_flags, entry->size, 0) != entry->csum)
os_info_flags = 0;
}
out:
free_page((unsignedlong)os_info); return 0;
}
staticstruct notifier_block zcore_reboot_notifier = {
.notifier_call = zcore_reboot_and_on_panic_handler, /* we need to be notified before reipl and kdump */
.priority = INT_MAX,
};
staticstruct notifier_block zcore_on_panic_notifier = {
.notifier_call = zcore_reboot_and_on_panic_handler, /* we need to be notified before reipl and kdump */
.priority = INT_MAX,
};
staticint __init zcore_init(void)
{ unsignedchar arch; int rc;
if (!is_ipl_type_dump()) return -ENODATA; if (oldmem_data.start) return -ENODATA;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.