From patchwork Fri Mar 8 20:17:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 226274 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4308B2C0365 for ; Sat, 9 Mar 2013 08:32:33 +1100 (EST) Received: from localhost ([::1]:48101 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UE44p-0005iq-9N for incoming@patchwork.ozlabs.org; Fri, 08 Mar 2013 15:39:39 -0500 Received: from eggs.gnu.org ([208.118.235.92]:51439) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UE3js-0006m7-Sg for qemu-devel@nongnu.org; Fri, 08 Mar 2013 15:18:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UE3jn-0004BK-63 for qemu-devel@nongnu.org; Fri, 08 Mar 2013 15:18:00 -0500 Received: from cantor2.suse.de ([195.135.220.15]:39907 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UE3jm-0004Aj-S5 for qemu-devel@nongnu.org; Fri, 08 Mar 2013 15:17:55 -0500 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 3C49BA51B6; Fri, 8 Mar 2013 21:17:54 +0100 (CET) From: Alexander Graf To: qemu-devel qemu-devel Date: Fri, 8 Mar 2013 21:17:52 +0100 Message-Id: <1362773873-4510-5-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.6.0.2 In-Reply-To: <1362773873-4510-1-git-send-email-agraf@suse.de> References: <1362773873-4510-1-git-send-email-agraf@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 195.135.220.15 Cc: Blue Swirl , Christian Borntraeger , Jens Freimann , =?utf-8?q?Aur=C3=A9lien=20Jarno?= Subject: [Qemu-devel] [PATCH 4/5] s390/css: Fix subchannel detection X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Christian Borntraeger 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 Signed-off-by: Jens Freimann Reviewed-by: Cornelia Huck Signed-off-by: Alexander Graf --- hw/s390x/css.c | 11 +++++++---- target-s390x/cpu.h | 2 +- target-s390x/ioinst.c | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/hw/s390x/css.c b/hw/s390x/css.c index 85f6f22..e526a1c 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -988,15 +988,18 @@ int css_do_rchp(uint8_t cssid, uint8_t chpid) 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; + uint8_t real_cssid; - if (cssid > MAX_CSSID || ssid > MAX_SSID || !channel_subsys->css[cssid] || - !channel_subsys->css[cssid]->sch_set[ssid]) { + real_cssid = (!m && (cssid == 0)) ? channel_subsys->default_cssid : cssid; + if (real_cssid > MAX_CSSID || ssid > MAX_SSID || + !channel_subsys->css[real_cssid] || + !channel_subsys->css[real_cssid]->sch_set[ssid]) { 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, (MAX_SCHID + 1) / sizeof(unsigned long)); } diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h index e450db7..9cb739d 100644 --- a/target-s390x/cpu.h +++ b/target-s390x/cpu.h @@ -404,7 +404,7 @@ SubchDev *css_find_subch(uint8_t m, uint8_t cssid, uint8_t ssid, bool css_subch_visible(SubchDev *sch); void css_conditional_io_interrupt(SubchDev *sch); 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_xsch(SubchDev *sch); int css_do_csch(SubchDev *sch); diff --git a/target-s390x/ioinst.c b/target-s390x/ioinst.c index e3531f3..28c508d 100644 --- a/target-s390x/ioinst.c +++ b/target-s390x/ioinst.c @@ -316,7 +316,7 @@ int ioinst_handle_stsch(CPUS390XState *env, uint64_t reg1, uint32_t ipb) cc = 3; } } 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 */ } else { /* Store an empty schib. */