s390/cio: use cssid for pgid generation
authorSebastian Ott <sebott@linux.vnet.ibm.com>
Fri, 17 Jun 2016 17:45:23 +0000 (19:45 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Mon, 16 Jan 2017 06:27:52 +0000 (07:27 +0100)
Obtain the real channel subsystem id and use that for the generation
of a unique path group id. Note that this change does not affect the
channel subsystem id as used in the user-visible naming of subchannels
and friends.

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Reviewed-by: Dong Jia Shi <bjsdjshik@linux.vnet.ibm.com>
Reviewed-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
drivers/s390/cio/chsc.c
drivers/s390/cio/chsc.h
drivers/s390/cio/css.c
drivers/s390/cio/css.h

index 928d11454b7ef50a333afeda69ef06371a681b1e..7b0b295b2313b8f3056378ed64c4249381a0213b 100644 (file)
@@ -1131,6 +1131,52 @@ int chsc_enable_facility(int operation_code)
        return ret;
 }
 
+int __init chsc_get_cssid(int idx)
+{
+       struct {
+               struct chsc_header request;
+               u8 atype;
+               u32 : 24;
+               u32 reserved1[6];
+               struct chsc_header response;
+               u32 reserved2[3];
+               struct {
+                       u8 cssid;
+                       u32 : 24;
+               } list[0];
+       } __packed *sdcal_area;
+       int ret;
+
+       spin_lock_irq(&chsc_page_lock);
+       memset(chsc_page, 0, PAGE_SIZE);
+       sdcal_area = chsc_page;
+       sdcal_area->request.length = 0x0020;
+       sdcal_area->request.code = 0x0034;
+       sdcal_area->atype = 4;
+
+       ret = chsc(sdcal_area);
+       if (ret) {
+               ret = (ret == 3) ? -ENODEV : -EBUSY;
+               goto exit;
+       }
+
+       ret = chsc_error_from_response(sdcal_area->response.code);
+       if (ret) {
+               CIO_CRW_EVENT(2, "chsc: sdcal failed (rc=%04x)\n",
+                             sdcal_area->response.code);
+               goto exit;
+       }
+
+       if ((addr_t) &sdcal_area->list[idx] <
+           (addr_t) &sdcal_area->response + sdcal_area->response.length)
+               ret = sdcal_area->list[idx].cssid;
+       else
+               ret = -ENODEV;
+exit:
+       spin_unlock_irq(&chsc_page_lock);
+       return ret;
+}
+
 struct css_general_char css_general_characteristics;
 struct css_chsc_char css_chsc_characteristics;
 
index 67c87b6e63ecada47c08044dd375e6cc1f5d4967..321a3f7658104143149fe51c453cb554845ae374 100644 (file)
@@ -242,6 +242,8 @@ int chsc_pnso_brinfo(struct subchannel_id schid,
                struct chsc_brinfo_resume_token resume_token,
                int cnc);
 
+int __init chsc_get_cssid(int idx);
+
 #ifdef CONFIG_SCM_BUS
 int scm_update_information(void);
 int scm_process_availability_information(void);
index 065c4e1d4cf46db6aff99a899c7053aae5b26ea0..13fea905c61a9616989b9055bd34f19b1fe3afd7 100644 (file)
@@ -703,7 +703,8 @@ css_generate_pgid(struct channel_subsystem *css, u32 tod_high)
 
        if (css_general_characteristics.mcss) {
                css->global_pgid.pgid_high.ext_cssid.version = 0x80;
-               css->global_pgid.pgid_high.ext_cssid.cssid = css->cssid;
+               css->global_pgid.pgid_high.ext_cssid.cssid =
+                       (css->cssid < 0) ? 0 : css->cssid;
        } else {
                css->global_pgid.pgid_high.cpu_addr = stap();
        }
@@ -794,7 +795,8 @@ static int __init setup_css(int nr)
        }
        mutex_init(&css->mutex);
        css->valid = 1;
-       css->cssid = nr;
+       css->cssid = chsc_get_cssid(nr);
+
        dev_set_name(&css->device, "css%x", nr);
        css->device.release = channel_subsystem_release;
        tod_high = (u32) (get_tod_clock() >> 32);
index cd19c08b93b29991c028652487dea260d8e2b65c..3056f96f9d829d6ed4230fcabf409cb5ad9e142f 100644 (file)
@@ -113,7 +113,7 @@ extern int for_each_subchannel(int(*fn)(struct subchannel_id, void *), void *);
 void css_update_ssd_info(struct subchannel *sch);
 
 struct channel_subsystem {
-       u8 cssid;
+       int cssid;
        int valid;
        struct channel_path *chps[__MAX_CHPID + 1];
        struct device device;