s390/css: Fix subchannel detection

We have to consider the m bit to find the real channel subsystem when
determining the last subchannel.

If we fail to take this into account, removal of a subchannel in
the middle of a big list of devices will stop device detection after
a reboot.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
Christian Borntraeger 2013-02-22 09:01:32 +00:00 committed by Alexander Graf
parent 35569cea79
commit 38dd7cc776
3 changed files with 9 additions and 6 deletions

View file

@ -988,15 +988,18 @@ int css_do_rchp(uint8_t cssid, uint8_t chpid)
return 0; return 0;
} }
bool css_schid_final(uint8_t cssid, uint8_t ssid, uint16_t schid) bool css_schid_final(int m, uint8_t cssid, uint8_t ssid, uint16_t schid)
{ {
SubchSet *set; SubchSet *set;
uint8_t real_cssid;
if (cssid > MAX_CSSID || ssid > MAX_SSID || !channel_subsys->css[cssid] || real_cssid = (!m && (cssid == 0)) ? channel_subsys->default_cssid : cssid;
!channel_subsys->css[cssid]->sch_set[ssid]) { if (real_cssid > MAX_CSSID || ssid > MAX_SSID ||
!channel_subsys->css[real_cssid] ||
!channel_subsys->css[real_cssid]->sch_set[ssid]) {
return true; return true;
} }
set = channel_subsys->css[cssid]->sch_set[ssid]; set = channel_subsys->css[real_cssid]->sch_set[ssid];
return schid > find_last_bit(set->schids_used, return schid > find_last_bit(set->schids_used,
(MAX_SCHID + 1) / sizeof(unsigned long)); (MAX_SCHID + 1) / sizeof(unsigned long));
} }

View file

@ -404,7 +404,7 @@ SubchDev *css_find_subch(uint8_t m, uint8_t cssid, uint8_t ssid,
bool css_subch_visible(SubchDev *sch); bool css_subch_visible(SubchDev *sch);
void css_conditional_io_interrupt(SubchDev *sch); void css_conditional_io_interrupt(SubchDev *sch);
int css_do_stsch(SubchDev *sch, SCHIB *schib); int css_do_stsch(SubchDev *sch, SCHIB *schib);
bool css_schid_final(uint8_t cssid, uint8_t ssid, uint16_t schid); bool css_schid_final(int m, uint8_t cssid, uint8_t ssid, uint16_t schid);
int css_do_msch(SubchDev *sch, SCHIB *schib); int css_do_msch(SubchDev *sch, SCHIB *schib);
int css_do_xsch(SubchDev *sch); int css_do_xsch(SubchDev *sch);
int css_do_csch(SubchDev *sch); int css_do_csch(SubchDev *sch);

View file

@ -316,7 +316,7 @@ int ioinst_handle_stsch(CPUS390XState *env, uint64_t reg1, uint32_t ipb)
cc = 3; cc = 3;
} }
} else { } else {
if (css_schid_final(cssid, ssid, schid)) { if (css_schid_final(m, cssid, ssid, schid)) {
cc = 3; /* No more subchannels in this css/ss */ cc = 3; /* No more subchannels in this css/ss */
} else { } else {
/* Store an empty schib. */ /* Store an empty schib. */