]> git.dujemihanovic.xyz Git - linux.git/commitdiff
s390/boot: move sclp early buffer from fixed address in asm to C
authorAlexander Egorenkov <egorenar@linux.ibm.com>
Thu, 5 Nov 2020 12:09:06 +0000 (13:09 +0100)
committerHeiko Carstens <hca@linux.ibm.com>
Tue, 27 Jul 2021 07:39:15 +0000 (09:39 +0200)
To make the decompressor relocatable, the early SCLP buffer with a fixed
address must be replaced with a relocatable C buffer of the according size
and alignment as required by SCLP.

Introduce a new function sclp_early_set_buffer() into the SCLP driver
which enables the decompressor to change the SCLP early buffer at any time.
This will be useful when the decompressor becomes fully relocatable and
might need to change the SCLP early buffer to one with an address < 2G
as required by SCLP because it was loaded at an address >= 2G.

Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/boot/boot.h
arch/s390/boot/compressed/vmlinux.lds.S
arch/s390/boot/head.S
arch/s390/boot/sclp_early_core.c
arch/s390/include/asm/sclp.h
arch/s390/include/asm/setup.h
drivers/s390/char/sclp_early_core.c

index 3d7d5ef4d16900374fd758afd719c37574bde73d..716c35c1d78f23586e43754b7d8b5c4742441075 100644 (file)
@@ -13,6 +13,7 @@ void setup_boot_command_line(void);
 void parse_boot_command_line(void);
 void verify_facilities(void);
 void print_missing_facilities(void);
+void sclp_early_setup_buffer(void);
 void print_pgm_check_info(void);
 unsigned long get_random_base(unsigned long safe_addr);
 void __printf(1, 2) decompressor_printk(const char *fmt, ...);
index 0bd8aaaa4b3326215b46a34b8ace66fd33667622..d6a69aa6e93704edd50b8e5137feb3706495a0fd 100644 (file)
@@ -3,6 +3,7 @@
 #include <asm/vmlinux.lds.h>
 #include <asm/thread_info.h>
 #include <asm/page.h>
+#include <asm/sclp.h>
 
 OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390")
 OUTPUT_ARCH(s390:64-bit)
@@ -54,7 +55,9 @@ SECTIONS
                KEEP(*(.dma.ex_table))
                _stop_dma_ex_table = .;
        }
-       .dma.data : { *(.dma.data) }
+       .dma.data : {
+               *(.dma.data)
+       }
        . = ALIGN(PAGE_SIZE);
        _edma = .;
 
index 4ac3958b30325f198fbbf880da147ce105662d18..759f77c6af451979b9d40105cffe0b0854e1d3f6 100644 (file)
@@ -320,6 +320,7 @@ SYM_CODE_START_LOCAL(startup_normal)
        spt     6f-.LPG0(%r13)
        mvc     __LC_LAST_UPDATE_TIMER(8),6f-.LPG0(%r13)
        larl    %r15,_stack_end-STACK_FRAME_OVERHEAD
+       brasl   %r14,sclp_early_setup_buffer
        brasl   %r14,verify_facilities
        brasl   %r14,startup_kernel
 SYM_CODE_END(startup_normal)
@@ -410,7 +411,4 @@ SYM_DATA_START(parmarea)
        .org    PARMAREA+__PARMAREA_SIZE
 SYM_DATA_END(parmarea)
 
-       .org    EARLY_SCCB_OFFSET
-       .fill   EXT_SCCB_READ_SCP
-
        .org    HEAD_END
index 5a19fd7020b5e88a2434112218947d92c3b44673..6f30646afbd0915749be6ba62866cb6b1bcb2841 100644 (file)
@@ -1,2 +1,11 @@
 // SPDX-License-Identifier: GPL-2.0
+#include "boot.h"
 #include "../../../drivers/s390/char/sclp_early_core.c"
+
+/* SCLP early buffer must stay page-aligned and below 2GB */
+static char __sclp_early_sccb[EXT_SCCB_READ_SCP] __aligned(PAGE_SIZE);
+
+void sclp_early_setup_buffer(void)
+{
+       sclp_early_set_buffer(&__sclp_early_sccb);
+}
index 3adbb417f74007a882d4c53dbe1f260ab44115b7..835adb85b01651b3b60e9ad9f6cd4750e676bce1 100644 (file)
@@ -115,6 +115,7 @@ struct zpci_report_error_header {
        u8 data[0];     /* Subsequent Data passed verbatim to SCLP ET 24 */
 } __packed;
 
+void sclp_early_set_buffer(void *sccb);
 int sclp_early_read_info(void);
 int sclp_early_read_storage_info(void);
 int sclp_early_get_core_info(struct sclp_core_info *info);
index cf285f57579f9b8ae7390203f88debb5d496d09e..b72714c632d73e2f3f9e504e678a7e2ef0bf7169 100644 (file)
@@ -7,15 +7,13 @@
 #define _ASM_S390_SETUP_H
 
 #include <linux/bits.h>
-#include <asm/sclp.h>
 #include <uapi/asm/setup.h>
 #include <linux/build_bug.h>
 
 #define EP_OFFSET              0x10008
 #define EP_STRING              "S390EP"
 #define PARMAREA               0x10400
-#define EARLY_SCCB_OFFSET      0x11000
-#define HEAD_END               (EARLY_SCCB_OFFSET + EXT_SCCB_READ_SCP)
+#define HEAD_END               0x11000
 
 /*
  * Machine features detected in early.c
index 80ba6523e76ee7518b71f13b1d9a86ed2a84e676..676634de65a89177c1245c43fca7ef5f8f4bedd6 100644 (file)
@@ -17,7 +17,7 @@
 
 static struct read_info_sccb __bootdata(sclp_info_sccb);
 static int __bootdata(sclp_info_sccb_valid);
-char *sclp_early_sccb = (char *) EARLY_SCCB_OFFSET;
+char *__bootdata(sclp_early_sccb);
 int sclp_init_state = sclp_init_state_uninitialized;
 /*
  * Used to keep track of the size of the event masks. Qemu until version 2.11
@@ -211,6 +211,11 @@ static int sclp_early_setup(int disable, int *have_linemode, int *have_vt220)
        return rc;
 }
 
+void sclp_early_set_buffer(void *sccb)
+{
+       sclp_early_sccb = sccb;
+}
+
 /*
  * Output one or more lines of text on the SCLP console (VT220 and /
  * or line-mode).