Skip to content

Commit bd50b74

Browse files
Alexander Gordeevhcahca
Alexander Gordeev
authored andcommitted
s390/boot: detect and enable memory facilities
Detect and enable memory facilities which is a prerequisite for pgtables setup in the decompressor. Reviewed-by: Heiko Carstens <[email protected]> Signed-off-by: Alexander Gordeev <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
1 parent b265854 commit bd50b74

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

arch/s390/boot/boot.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88

99
#ifndef __ASSEMBLY__
1010

11+
struct machine_info {
12+
unsigned char has_edat1 : 1;
13+
unsigned char has_edat2 : 1;
14+
unsigned char has_nx : 1;
15+
};
16+
1117
struct vmlinux_info {
1218
unsigned long default_lma;
1319
void (*entry)(void);
@@ -38,6 +44,8 @@ unsigned long get_random_base(unsigned long safe_addr);
3844
void __printf(1, 2) decompressor_printk(const char *fmt, ...);
3945
void error(char *m);
4046

47+
extern struct machine_info machine;
48+
4149
/* Symbols defined by linker scripts */
4250
extern const char kernel_version[];
4351
extern unsigned long memory_limit;

arch/s390/boot/startup.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ u64 __bootdata_preserved(stfle_fac_list[16]);
3333
u64 __bootdata_preserved(alt_stfle_fac_list[16]);
3434
struct oldmem_data __bootdata_preserved(oldmem_data);
3535

36+
struct machine_info machine;
37+
3638
void error(char *x)
3739
{
3840
sclp_early_printk("\n\n");
@@ -42,6 +44,20 @@ void error(char *x)
4244
disabled_wait();
4345
}
4446

47+
static void detect_facilities(void)
48+
{
49+
if (test_facility(8)) {
50+
machine.has_edat1 = 1;
51+
__ctl_set_bit(0, 23);
52+
}
53+
if (test_facility(78))
54+
machine.has_edat2 = 1;
55+
if (!noexec_disabled && test_facility(130)) {
56+
machine.has_nx = 1;
57+
__ctl_set_bit(0, 20);
58+
}
59+
}
60+
4561
static void setup_lpp(void)
4662
{
4763
S390_lowcore.current_pid = 0;
@@ -254,6 +270,8 @@ void startup_kernel(void)
254270
unsigned long safe_addr;
255271
void *img;
256272

273+
detect_facilities();
274+
257275
initrd_data.start = parmarea.initrd_start;
258276
initrd_data.size = parmarea.initrd_size;
259277
oldmem_data.start = parmarea.oldmem_base;

0 commit comments

Comments
 (0)