s390/sclp: move sclp_early_read_info to sclp_early_core.c
authorVasily Gorbik <gor@linux.ibm.com>
Wed, 23 May 2018 09:07:13 +0000 (11:07 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Tue, 9 Oct 2018 09:21:07 +0000 (11:21 +0200)
To enable early online memory detection sclp_early_read_info has
been moved to sclp_early_core.c. sclp_info_sccb has been made a part
of .boot.data, which allows to reuse it later during early kernel
startup and make sclp_early_read_info call just once.

Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Reviewed-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/boot/startup.c
arch/s390/include/asm/sclp.h
drivers/s390/char/sclp.h
drivers/s390/char/sclp_early.c
drivers/s390/char/sclp_early_core.c

index e9eea37894b304baddf1028bd9a6319d77c86001..78651a2c26b0ee82ba490de12b8f3bf07e4ff301 100644 (file)
@@ -50,6 +50,7 @@ void startup_kernel(void)
        void *img;
 
        rescue_initrd();
+       sclp_early_read_info();
        if (!IS_ENABLED(CONFIG_KERNEL_UNCOMPRESSED)) {
                img = decompress_kernel();
                memmove((void *)vmlinux.default_lma, img, vmlinux.image_size);
index 5d9420bbe1655e54f351c0df2b9715c76a43fe6d..7df57bd09aa1797ca2cd769be8e0278238e9954d 100644 (file)
@@ -105,6 +105,7 @@ struct zpci_report_error_header {
        u8 data[0];     /* Subsequent Data passed verbatim to SCLP ET 24 */
 } __packed;
 
+int sclp_early_read_info(void);
 int sclp_early_get_core_info(struct sclp_core_info *info);
 void sclp_early_get_ipl_info(struct sclp_ipl_info *info);
 void sclp_early_detect(void);
index 1fe4918088e71d86e1b2e0dc2547ac4328af3cce..ffe72f03b5c5a3dcafcc2de3a8c9f861c1a4b070 100644 (file)
@@ -63,6 +63,8 @@
 typedef unsigned int sclp_cmdw_t;
 
 #define SCLP_CMDW_READ_CPU_INFO                0x00010001
+#define SCLP_CMDW_READ_SCP_INFO                0x00020001
+#define SCLP_CMDW_READ_SCP_INFO_FORCED 0x00120001
 #define SCLP_CMDW_READ_EVENT_DATA      0x00770005
 #define SCLP_CMDW_WRITE_EVENT_DATA     0x00760005
 #define SCLP_CMDW_WRITE_EVENT_MASK     0x00780005
@@ -156,6 +158,45 @@ struct read_cpu_info_sccb {
        u8      reserved[4096 - 16];
 } __attribute__((packed, aligned(PAGE_SIZE)));
 
+struct read_info_sccb {
+       struct  sccb_header header;     /* 0-7 */
+       u16     rnmax;                  /* 8-9 */
+       u8      rnsize;                 /* 10 */
+       u8      _pad_11[16 - 11];       /* 11-15 */
+       u16     ncpurl;                 /* 16-17 */
+       u16     cpuoff;                 /* 18-19 */
+       u8      _pad_20[24 - 20];       /* 20-23 */
+       u8      loadparm[8];            /* 24-31 */
+       u8      _pad_32[42 - 32];       /* 32-41 */
+       u8      fac42;                  /* 42 */
+       u8      fac43;                  /* 43 */
+       u8      _pad_44[48 - 44];       /* 44-47 */
+       u64     facilities;             /* 48-55 */
+       u8      _pad_56[66 - 56];       /* 56-65 */
+       u8      fac66;                  /* 66 */
+       u8      _pad_67[76 - 67];       /* 67-83 */
+       u32     ibc;                    /* 76-79 */
+       u8      _pad80[84 - 80];        /* 80-83 */
+       u8      fac84;                  /* 84 */
+       u8      fac85;                  /* 85 */
+       u8      _pad_86[91 - 86];       /* 86-90 */
+       u8      fac91;                  /* 91 */
+       u8      _pad_92[98 - 92];       /* 92-97 */
+       u8      fac98;                  /* 98 */
+       u8      hamaxpow;               /* 99 */
+       u32     rnsize2;                /* 100-103 */
+       u64     rnmax2;                 /* 104-111 */
+       u32     hsa_size;               /* 112-115 */
+       u8      fac116;                 /* 116 */
+       u8      fac117;                 /* 117 */
+       u8      fac118;                 /* 118 */
+       u8      fac119;                 /* 119 */
+       u16     hcpua;                  /* 120-121 */
+       u8      _pad_122[124 - 122];    /* 122-123 */
+       u32     hmfai;                  /* 124-127 */
+       u8      _pad_128[4096 - 128];   /* 128-4095 */
+} __packed __aligned(PAGE_SIZE);
+
 static inline void sclp_fill_core_info(struct sclp_core_info *info,
                                       struct read_cpu_info_sccb *sccb)
 {
@@ -275,6 +316,7 @@ unsigned int sclp_early_con_check_vt220(struct init_sccb *sccb);
 int sclp_early_set_event_mask(struct init_sccb *sccb,
                              sccb_mask_t receive_mask,
                              sccb_mask_t send_mask);
+int sclp_early_get_info(struct read_info_sccb *info);
 
 /* useful inlines */
 
index c06b44b7d8fd28c25ffcfedb6b55e2713397653e..e792cee3b51c5d24089d39b63a88b67bad204fcc 100644 (file)
 #include "sclp_sdias.h"
 #include "sclp.h"
 
-#define SCLP_CMDW_READ_SCP_INFO                0x00020001
-#define SCLP_CMDW_READ_SCP_INFO_FORCED 0x00120001
-
-struct read_info_sccb {
-       struct  sccb_header header;     /* 0-7 */
-       u16     rnmax;                  /* 8-9 */
-       u8      rnsize;                 /* 10 */
-       u8      _pad_11[16 - 11];       /* 11-15 */
-       u16     ncpurl;                 /* 16-17 */
-       u16     cpuoff;                 /* 18-19 */
-       u8      _pad_20[24 - 20];       /* 20-23 */
-       u8      loadparm[8];            /* 24-31 */
-       u8      _pad_32[42 - 32];       /* 32-41 */
-       u8      fac42;                  /* 42 */
-       u8      fac43;                  /* 43 */
-       u8      _pad_44[48 - 44];       /* 44-47 */
-       u64     facilities;             /* 48-55 */
-       u8      _pad_56[66 - 56];       /* 56-65 */
-       u8      fac66;                  /* 66 */
-       u8      _pad_67[76 - 67];       /* 67-83 */
-       u32     ibc;                    /* 76-79 */
-       u8      _pad80[84 - 80];        /* 80-83 */
-       u8      fac84;                  /* 84 */
-       u8      fac85;                  /* 85 */
-       u8      _pad_86[91 - 86];       /* 86-90 */
-       u8      fac91;                  /* 91 */
-       u8      _pad_92[98 - 92];       /* 92-97 */
-       u8      fac98;                  /* 98 */
-       u8      hamaxpow;               /* 99 */
-       u32     rnsize2;                /* 100-103 */
-       u64     rnmax2;                 /* 104-111 */
-       u32     hsa_size;               /* 112-115 */
-       u8      fac116;                 /* 116 */
-       u8      fac117;                 /* 117 */
-       u8      fac118;                 /* 118 */
-       u8      fac119;                 /* 119 */
-       u16     hcpua;                  /* 120-121 */
-       u8      _pad_122[124 - 122];    /* 122-123 */
-       u32     hmfai;                  /* 124-127 */
-       u8      _pad_128[4096 - 128];   /* 128-4095 */
-} __packed __aligned(PAGE_SIZE);
-
 static struct sclp_ipl_info sclp_ipl_info;
 
 struct sclp_info sclp;
 EXPORT_SYMBOL(sclp);
 
-static int __init sclp_early_read_info(struct read_info_sccb *sccb)
-{
-       int i;
-       sclp_cmdw_t commands[] = {SCLP_CMDW_READ_SCP_INFO_FORCED,
-                                 SCLP_CMDW_READ_SCP_INFO};
-
-       for (i = 0; i < ARRAY_SIZE(commands); i++) {
-               memset(sccb, 0, sizeof(*sccb));
-               sccb->header.length = sizeof(*sccb);
-               sccb->header.function_code = 0x80;
-               sccb->header.control_mask[2] = 0x80;
-               if (sclp_early_cmd(commands[i], sccb))
-                       break;
-               if (sccb->header.response_code == 0x10)
-                       return 0;
-               if (sccb->header.response_code != 0x1f0)
-                       break;
-       }
-       return -EIO;
-}
-
 static void __init sclp_early_facilities_detect(struct read_info_sccb *sccb)
 {
        struct sclp_core_entry *cpue;
        u16 boot_cpu_address, cpu;
 
-       if (sclp_early_read_info(sccb))
+       if (sclp_early_get_info(sccb))
                return;
 
        sclp.facilities = sccb->facilities;
index 2f61f5579aa54708213f3226c940ef65c462b72b..bbea2154a8072499abb8b1af27b685d868a7a9a4 100644 (file)
@@ -9,9 +9,12 @@
 #include <asm/lowcore.h>
 #include <asm/ebcdic.h>
 #include <asm/irq.h>
+#include <asm/sections.h>
 #include "sclp.h"
 #include "sclp_rw.h"
 
+static struct read_info_sccb __bootdata(sclp_info_sccb);
+static int __bootdata(sclp_info_sccb_valid);
 char sclp_early_sccb[PAGE_SIZE] __aligned(PAGE_SIZE) __section(.data);
 int sclp_init_state __section(.data) = sclp_init_state_uninitialized;
 /*
@@ -234,3 +237,36 @@ void sclp_early_printk_force(const char *str)
 {
        __sclp_early_printk(str, strlen(str), 1);
 }
+
+int __init sclp_early_read_info(void)
+{
+       int i;
+       struct read_info_sccb *sccb = &sclp_info_sccb;
+       sclp_cmdw_t commands[] = {SCLP_CMDW_READ_SCP_INFO_FORCED,
+                                 SCLP_CMDW_READ_SCP_INFO};
+
+       for (i = 0; i < ARRAY_SIZE(commands); i++) {
+               memset(sccb, 0, sizeof(*sccb));
+               sccb->header.length = sizeof(*sccb);
+               sccb->header.function_code = 0x80;
+               sccb->header.control_mask[2] = 0x80;
+               if (sclp_early_cmd(commands[i], sccb))
+                       break;
+               if (sccb->header.response_code == 0x10) {
+                       sclp_info_sccb_valid = 1;
+                       return 0;
+               }
+               if (sccb->header.response_code != 0x1f0)
+                       break;
+       }
+       return -EIO;
+}
+
+int __init sclp_early_get_info(struct read_info_sccb *info)
+{
+       if (!sclp_info_sccb_valid)
+               return -EIO;
+
+       *info = sclp_info_sccb;
+       return 0;
+}