linux/arch/s390/include/asm/os_info.h
Alexander Gordeev f4cac27dc0 s390/crash: Use old os_info to create PT_LOAD headers
This is a preparatory rework to allow uncoupling virtual
and physical addresses spaces.

The vmcore ELF program headers describe virtual memory
regions of a crashed kernel. User level tools use that
information for the kernel text and data analysis (e.g
vmcore-dmesg extracts the kernel log).

Currently the kernel image is covered by program headers
describing the identity mapping regions. But in the future
the kernel image will be mapped into separate region outside
of the identity mapping. Create the additional ELF program
header that covers kernel image only, so that vmcore tools
could locate kernel text and data.

Further, the identity mapping in crashed and capture kernels
will have different base address. Due to that __va() macro
can not be used in the capture kernel. Instead, read crashed
kernel identity mapping base address from os_info and use
it for PT_LOAD type program headers creation.

Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
2024-04-17 13:38:01 +02:00

74 lines
1.6 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
/*
* OS info memory interface
*
* Copyright IBM Corp. 2012
* Author(s): Michael Holzheu <holzheu@linux.vnet.ibm.com>
*/
#ifndef _ASM_S390_OS_INFO_H
#define _ASM_S390_OS_INFO_H
#include <linux/uio.h>
#define OS_INFO_VERSION_MAJOR 1
#define OS_INFO_VERSION_MINOR 1
#define OS_INFO_MAGIC 0x4f53494e464f535aULL /* OSINFOSZ */
#define OS_INFO_VMCOREINFO 0
#define OS_INFO_REIPL_BLOCK 1
#define OS_INFO_FLAGS_ENTRY 2
#define OS_INFO_RESERVED 3
#define OS_INFO_IDENTITY_BASE 4
#define OS_INFO_KASLR_OFFSET 5
#define OS_INFO_KASLR_OFF_PHYS 6
#define OS_INFO_VMEMMAP 7
#define OS_INFO_AMODE31_START 8
#define OS_INFO_AMODE31_END 9
#define OS_INFO_IMAGE_START 10
#define OS_INFO_IMAGE_END 11
#define OS_INFO_IMAGE_PHYS 12
#define OS_INFO_FLAG_REIPL_CLEAR (1UL << 0)
struct os_info_entry {
union {
u64 addr;
u64 val;
};
u64 size;
u32 csum;
} __packed;
struct os_info {
u64 magic;
u32 csum;
u16 version_major;
u16 version_minor;
u64 crashkernel_addr;
u64 crashkernel_size;
struct os_info_entry entry[10];
u8 reserved[3864];
} __packed;
void os_info_init(void);
void os_info_entry_add_data(int nr, void *ptr, u64 len);
void os_info_entry_add_val(int nr, u64 val);
void os_info_crashkernel_add(unsigned long base, unsigned long size);
u32 os_info_csum(struct os_info *os_info);
#ifdef CONFIG_CRASH_DUMP
void *os_info_old_entry(int nr, unsigned long *size);
static inline unsigned long os_info_old_value(int nr)
{
unsigned long size;
return (unsigned long)os_info_old_entry(nr, &size);
}
#else
static inline void *os_info_old_entry(int nr, unsigned long *size)
{
return NULL;
}
#endif
#endif /* _ASM_S390_OS_INFO_H */