s390/sclp: simplify early hsa_size detection
authorVasily Gorbik <gor@linux.ibm.com>
Mon, 9 Apr 2018 08:40:39 +0000 (10:40 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Tue, 9 Oct 2018 09:21:04 +0000 (11:21 +0200)
Architecture documentation suggests that hsa_size has been available in
the read info since the list-directed ipl dump has been introduced. By
using this value few early sclp calls could be avoided.

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>
drivers/s390/char/sclp_early.c

index 9a74abb9224d02fc47041e98a6600265a3bac881..c06b44b7d8fd28c25ffcfedb6b55e2713397653e 100644 (file)
@@ -46,7 +46,7 @@ struct read_info_sccb {
        u8      hamaxpow;               /* 99 */
        u32     rnsize2;                /* 100-103 */
        u64     rnmax2;                 /* 104-111 */
-       u8      _pad_112[116 - 112];    /* 112-115 */
+       u32     hsa_size;               /* 112-115 */
        u8      fac116;                 /* 116 */
        u8      fac117;                 /* 117 */
        u8      fac118;                 /* 118 */
@@ -147,6 +147,8 @@ static void __init sclp_early_facilities_detect(struct read_info_sccb *sccb)
                sclp_ipl_info.has_dump = 1;
        memcpy(&sclp_ipl_info.loadparm, &sccb->loadparm, LOADPARM_LEN);
 
+       if (sccb->hsa_size)
+               sclp.hsa_size = (sccb->hsa_size - 1) * PAGE_SIZE;
        sclp.mtid = (sccb->fac42 & 0x80) ? (sccb->fac42 & 31) : 0;
        sclp.mtid_cp = (sccb->fac42 & 0x80) ? (sccb->fac43 & 31) : 0;
        sclp.mtid_prev = (sccb->fac42 & 0x80) ? (sccb->fac66 & 31) : 0;
@@ -189,61 +191,6 @@ int __init sclp_early_get_core_info(struct sclp_core_info *info)
        return 0;
 }
 
-static long __init sclp_early_hsa_size_init(struct sdias_sccb *sccb)
-{
-       memset(sccb, 0, sizeof(*sccb));
-       sccb->hdr.length = sizeof(*sccb);
-       sccb->evbuf.hdr.length = sizeof(struct sdias_evbuf);
-       sccb->evbuf.hdr.type = EVTYP_SDIAS;
-       sccb->evbuf.event_qual = SDIAS_EQ_SIZE;
-       sccb->evbuf.data_id = SDIAS_DI_FCP_DUMP;
-       sccb->evbuf.event_id = 4712;
-       sccb->evbuf.dbs = 1;
-       if (sclp_early_cmd(SCLP_CMDW_WRITE_EVENT_DATA, sccb))
-               return -EIO;
-       if (sccb->hdr.response_code != 0x20)
-               return -EIO;
-       if (sccb->evbuf.blk_cnt == 0)
-               return 0;
-       return (sccb->evbuf.blk_cnt - 1) * PAGE_SIZE;
-}
-
-static long __init sclp_early_hsa_copy_wait(struct sdias_sccb *sccb)
-{
-       memset(sccb, 0, PAGE_SIZE);
-       sccb->hdr.length = PAGE_SIZE;
-       if (sclp_early_cmd(SCLP_CMDW_READ_EVENT_DATA, sccb))
-               return -EIO;
-       if ((sccb->hdr.response_code != 0x20) && (sccb->hdr.response_code != 0x220))
-               return -EIO;
-       if (sccb->evbuf.blk_cnt == 0)
-               return 0;
-       return (sccb->evbuf.blk_cnt - 1) * PAGE_SIZE;
-}
-
-static void __init sclp_early_hsa_size_detect(void *sccb)
-{
-       unsigned long flags;
-       long size = -EIO;
-
-       raw_local_irq_save(flags);
-       if (sclp_early_set_event_mask(sccb, EVTYP_SDIAS_MASK, EVTYP_SDIAS_MASK))
-               goto out;
-       size = sclp_early_hsa_size_init(sccb);
-       /* First check for synchronous response (LPAR) */
-       if (size)
-               goto out_mask;
-       if (!(S390_lowcore.ext_params & 1))
-               sclp_early_wait_irq();
-       size = sclp_early_hsa_copy_wait(sccb);
-out_mask:
-       sclp_early_set_event_mask(sccb, 0, 0);
-out:
-       raw_local_irq_restore(flags);
-       if (size > 0)
-               sclp.hsa_size = size;
-}
-
 static void __init sclp_early_console_detect(struct init_sccb *sccb)
 {
        if (sccb->header.response_code != 0x20)
@@ -262,7 +209,6 @@ void __init sclp_early_detect(void)
 
        sclp_early_facilities_detect(sccb);
        sclp_early_init_core_info(sccb);
-       sclp_early_hsa_size_detect(sccb);
 
        /*
         * Turn off SCLP event notifications.  Also save remote masks in the