Skip to content

Commit 8870279

Browse files
author
Alexander Gordeev
committed
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: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
1 parent 5fb50fa commit 8870279

3 files changed

Lines changed: 31 additions & 9 deletions

File tree

arch/s390/include/asm/os_info.h

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,15 @@
1717
#define OS_INFO_VMCOREINFO 0
1818
#define OS_INFO_REIPL_BLOCK 1
1919
#define OS_INFO_FLAGS_ENTRY 2
20+
#define OS_INFO_RESERVED 3
2021

2122
#define OS_INFO_FLAG_REIPL_CLEAR (1UL << 0)
2223

2324
struct os_info_entry {
24-
u64 addr;
25+
union {
26+
u64 addr;
27+
u64 val;
28+
};
2529
u64 size;
2630
u32 csum;
2731
} __packed;
@@ -33,17 +37,24 @@ struct os_info {
3337
u16 version_minor;
3438
u64 crashkernel_addr;
3539
u64 crashkernel_size;
36-
struct os_info_entry entry[3];
37-
u8 reserved[4004];
40+
struct os_info_entry entry[4];
41+
u8 reserved[3984];
3842
} __packed;
3943

4044
void os_info_init(void);
41-
void os_info_entry_add(int nr, void *ptr, u64 len);
45+
void os_info_entry_add_data(int nr, void *ptr, u64 len);
46+
void os_info_entry_add_val(int nr, u64 val);
4247
void os_info_crashkernel_add(unsigned long base, unsigned long size);
4348
u32 os_info_csum(struct os_info *os_info);
4449

4550
#ifdef CONFIG_CRASH_DUMP
4651
void *os_info_old_entry(int nr, unsigned long *size);
52+
static inline unsigned long os_info_old_value(int nr)
53+
{
54+
unsigned long size;
55+
56+
return (unsigned long)os_info_old_entry(nr, &size);
57+
}
4758
#else
4859
static inline void *os_info_old_entry(int nr, unsigned long *size)
4960
{

arch/s390/kernel/ipl.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,8 +1209,8 @@ static struct attribute_group reipl_nss_attr_group = {
12091209

12101210
void set_os_info_reipl_block(void)
12111211
{
1212-
os_info_entry_add(OS_INFO_REIPL_BLOCK, reipl_block_actual,
1213-
reipl_block_actual->hdr.len);
1212+
os_info_entry_add_data(OS_INFO_REIPL_BLOCK, reipl_block_actual,
1213+
reipl_block_actual->hdr.len);
12141214
}
12151215

12161216
/* reipl type */
@@ -1940,7 +1940,7 @@ static void dump_reipl_run(struct shutdown_trigger *trigger)
19401940
reipl_type == IPL_TYPE_NSS ||
19411941
reipl_type == IPL_TYPE_UNKNOWN)
19421942
os_info_flags |= OS_INFO_FLAG_REIPL_CLEAR;
1943-
os_info_entry_add(OS_INFO_FLAGS_ENTRY, &os_info_flags, sizeof(os_info_flags));
1943+
os_info_entry_add_data(OS_INFO_FLAGS_ENTRY, &os_info_flags, sizeof(os_info_flags));
19441944
csum = (__force unsigned int)cksm(reipl_block_actual, reipl_block_actual->hdr.len, 0);
19451945
abs_lc = get_abs_lowcore();
19461946
abs_lc->ipib = __pa(reipl_block_actual);

arch/s390/kernel/os_info.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,27 @@ void os_info_crashkernel_add(unsigned long base, unsigned long size)
4343
}
4444

4545
/*
46-
* Add OS info entry and update checksum
46+
* Add OS info data entry and update checksum
4747
*/
48-
void os_info_entry_add(int nr, void *ptr, u64 size)
48+
void os_info_entry_add_data(int nr, void *ptr, u64 size)
4949
{
5050
os_info.entry[nr].addr = __pa(ptr);
5151
os_info.entry[nr].size = size;
5252
os_info.entry[nr].csum = (__force u32)cksm(ptr, size, 0);
5353
os_info.csum = os_info_csum(&os_info);
5454
}
5555

56+
/*
57+
* Add OS info value entry and update checksum
58+
*/
59+
void os_info_entry_add_val(int nr, u64 value)
60+
{
61+
os_info.entry[nr].val = value;
62+
os_info.entry[nr].size = 0;
63+
os_info.entry[nr].csum = 0;
64+
os_info.csum = os_info_csum(&os_info);
65+
}
66+
5667
/*
5768
* Initialize OS info structure and set lowcore pointer
5869
*/

0 commit comments

Comments
 (0)