Commit 17e89e13 authored by Sven Schnelle's avatar Sven Schnelle Committed by Vasily Gorbik
Browse files

s390/facilities: move stfl information from lowcore to global data



With gcc-11, there are a lot of warnings because the facility functions
are accessing lowcore through a null pointer. Fix this by moving the
facility arrays away from lowcore.

Signed-off-by: default avatarSven Schnelle <svens@linux.ibm.com>
Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
parent af9ad822
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ void print_missing_facilities(void)

	first = 1;
	for (i = 0; i < ARRAY_SIZE(als); i++) {
		val = ~S390_lowcore.stfle_fac_list[i] & als[i];
		val = ~stfle_fac_list[i] & als[i];
		for (j = 0; j < BITS_PER_LONG; j++) {
			if (!(val & (1UL << (BITS_PER_LONG - 1 - j))))
				continue;
@@ -106,9 +106,9 @@ void verify_facilities(void)
{
	int i;

	__stfle(S390_lowcore.stfle_fac_list, ARRAY_SIZE(S390_lowcore.stfle_fac_list));
	__stfle(stfle_fac_list, ARRAY_SIZE(stfle_fac_list));
	for (i = 0; i < ARRAY_SIZE(als); i++) {
		if ((S390_lowcore.stfle_fac_list[i] & als[i]) != als[i])
		if ((stfle_fac_list[i] & als[i]) != als[i])
			facility_mismatch();
	}
}
+3 −3
Original line number Diff line number Diff line
@@ -180,9 +180,9 @@ void setup_boot_command_line(void)
static void modify_facility(unsigned long nr, bool clear)
{
	if (clear)
		__clear_facility(nr, S390_lowcore.stfle_fac_list);
		__clear_facility(nr, stfle_fac_list);
	else
		__set_facility(nr, S390_lowcore.stfle_fac_list);
		__set_facility(nr, stfle_fac_list);
}

static void check_cleared_facilities(void)
@@ -191,7 +191,7 @@ static void check_cleared_facilities(void)
	int i;

	for (i = 0; i < ARRAY_SIZE(als); i++) {
		if ((S390_lowcore.stfle_fac_list[i] & als[i]) != als[i]) {
		if ((stfle_fac_list[i] & als[i]) != als[i]) {
			sclp_early_printk("Warning: The Linux kernel requires facilities cleared via command line option\n");
			print_missing_facilities();
			break;
+3 −0
Original line number Diff line number Diff line
@@ -17,6 +17,9 @@ extern char __boot_data_preserved_start[], __boot_data_preserved_end[];
unsigned long __bootdata_preserved(__kaslr_offset);
unsigned long __bootdata(ident_map_size);

u64 __bootdata_preserved(stfle_fac_list[16]);
u64 __bootdata_preserved(alt_stfle_fac_list[16]);

/*
 * Some code and data needs to stay below 2 GB, even when the kernel would be
 * relocated above 2 GB, because it has to use 31 bit addresses.
+9 −4
Original line number Diff line number Diff line
@@ -13,7 +13,10 @@
#include <linux/preempt.h>
#include <asm/lowcore.h>

#define MAX_FACILITY_BIT (sizeof(((struct lowcore *)0)->stfle_fac_list) * 8)
#define MAX_FACILITY_BIT (sizeof(stfle_fac_list) * 8)

extern u64 stfle_fac_list[16];
extern u64 alt_stfle_fac_list[16];

static inline void __set_facility(unsigned long nr, void *facilities)
{
@@ -56,7 +59,7 @@ static inline int test_facility(unsigned long nr)
		if (__test_facility(nr, &facilities_als))
			return 1;
	}
	return __test_facility(nr, &S390_lowcore.stfle_fac_list);
	return __test_facility(nr, &stfle_fac_list);
}

static inline unsigned long __stfle_asm(u64 *stfle_fac_list, int size)
@@ -79,13 +82,15 @@ static inline unsigned long __stfle_asm(u64 *stfle_fac_list, int size)
static inline void __stfle(u64 *stfle_fac_list, int size)
{
	unsigned long nr;
	u32 stfl_fac_list;

	asm volatile(
		"	stfl	0(0)\n"
		: "=m" (S390_lowcore.stfl_fac_list));
	stfl_fac_list = S390_lowcore.stfl_fac_list;
	memcpy(stfle_fac_list, &stfl_fac_list, 4);
	nr = 4; /* bytes stored by stfl */
	memcpy(stfle_fac_list, &S390_lowcore.stfl_fac_list, 4);
	if (S390_lowcore.stfl_fac_list & 0x01000000) {
	if (stfl_fac_list & 0x01000000) {
		/* More facility bits available with stfle */
		nr = __stfle_asm(stfle_fac_list, size);
		nr = min_t(unsigned long, (nr + 1) * 8, size * 8);
+1 −6
Original line number Diff line number Diff line
@@ -153,12 +153,7 @@ struct lowcore {
	__u64	vmcore_info;			/* 0x0e0c */
	__u8	pad_0x0e14[0x0e18-0x0e14];	/* 0x0e14 */
	__u64	os_info;			/* 0x0e18 */
	__u8	pad_0x0e20[0x0f00-0x0e20];	/* 0x0e20 */

	/* Extended facility list */
	__u64	stfle_fac_list[16];		/* 0x0f00 */
	__u64	alt_stfle_fac_list[16];		/* 0x0f80 */
	__u8	pad_0x1000[0x11b0-0x1000];	/* 0x1000 */
	__u8	pad_0x0e20[0x11b0-0x0e20];	/* 0x0e20 */

	/* Pointer to the machine check extended save area */
	__u64	mcesad;				/* 0x11b0 */
Loading