Commit 88702793 authored by Alexander Gordeev's avatar Alexander Gordeev
Browse files

s390/os_info: Introduce value entries



Introduce entries that do not reference any data in memory,
but rather provide values. Set the size of such entries to
zero and do not compute checksum for them, since there is no
data which integrity needs to be checked. The integrity of
the value entries itself is still covered by the os_info
checksum.

Reserve the lowest unused entry index OS_INFO_RESERVED for
future use - presumably for the number of entries present.
That could later be used by user level tools. The existing
tools would not notice any difference.

Acked-by: default avatarHeiko Carstens <hca@linux.ibm.com>
Signed-off-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
parent 5fb50fa6
Loading
Loading
Loading
Loading
+15 −4
Original line number Diff line number Diff line
@@ -17,11 +17,15 @@
#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_FLAG_REIPL_CLEAR	(1UL << 0)

struct os_info_entry {
	union {
		u64	addr;
		u64	val;
	};
	u64	size;
	u32	csum;
} __packed;
@@ -33,17 +37,24 @@ struct os_info {
	u16	version_minor;
	u64	crashkernel_addr;
	u64	crashkernel_size;
	struct os_info_entry entry[3];
	u8	reserved[4004];
	struct os_info_entry entry[4];
	u8	reserved[3984];
} __packed;

void os_info_init(void);
void os_info_entry_add(int nr, void *ptr, u64 len);
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)
{
+3 −3
Original line number Diff line number Diff line
@@ -1209,7 +1209,7 @@ static struct attribute_group reipl_nss_attr_group = {

void set_os_info_reipl_block(void)
{
	os_info_entry_add(OS_INFO_REIPL_BLOCK, reipl_block_actual,
	os_info_entry_add_data(OS_INFO_REIPL_BLOCK, reipl_block_actual,
			       reipl_block_actual->hdr.len);
}

@@ -1940,7 +1940,7 @@ static void dump_reipl_run(struct shutdown_trigger *trigger)
	    reipl_type == IPL_TYPE_NSS ||
	    reipl_type == IPL_TYPE_UNKNOWN)
		os_info_flags |= OS_INFO_FLAG_REIPL_CLEAR;
	os_info_entry_add(OS_INFO_FLAGS_ENTRY, &os_info_flags, sizeof(os_info_flags));
	os_info_entry_add_data(OS_INFO_FLAGS_ENTRY, &os_info_flags, sizeof(os_info_flags));
	csum = (__force unsigned int)cksm(reipl_block_actual, reipl_block_actual->hdr.len, 0);
	abs_lc = get_abs_lowcore();
	abs_lc->ipib = __pa(reipl_block_actual);
+13 −2
Original line number Diff line number Diff line
@@ -43,9 +43,9 @@ void os_info_crashkernel_add(unsigned long base, unsigned long size)
}

/*
 * Add OS info entry and update checksum
 * Add OS info data entry and update checksum
 */
void os_info_entry_add(int nr, void *ptr, u64 size)
void os_info_entry_add_data(int nr, void *ptr, u64 size)
{
	os_info.entry[nr].addr = __pa(ptr);
	os_info.entry[nr].size = size;
@@ -53,6 +53,17 @@ void os_info_entry_add(int nr, void *ptr, u64 size)
	os_info.csum = os_info_csum(&os_info);
}

/*
 * Add OS info value entry and update checksum
 */
void os_info_entry_add_val(int nr, u64 value)
{
	os_info.entry[nr].val = value;
	os_info.entry[nr].size = 0;
	os_info.entry[nr].csum = 0;
	os_info.csum = os_info_csum(&os_info);
}

/*
 * Initialize OS info structure and set lowcore pointer
 */