From patchwork Fri Feb 22 19:01:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Freimann X-Patchwork-Id: 222616 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 796ED2C0297 for ; Sat, 23 Feb 2013 06:02:54 +1100 (EST) Received: from localhost ([::1]:38519 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8xtU-0002Vy-Ln for incoming@patchwork.ozlabs.org; Fri, 22 Feb 2013 14:02:52 -0500 Received: from eggs.gnu.org ([208.118.235.92]:48088) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8xsb-0000Yf-5E for qemu-devel@nongnu.org; Fri, 22 Feb 2013 14:02:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U8xsU-0002RV-Ik for qemu-devel@nongnu.org; Fri, 22 Feb 2013 14:01:57 -0500 Received: from e06smtp18.uk.ibm.com ([195.75.94.114]:60401) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8xsU-0002Qs-Aw for qemu-devel@nongnu.org; Fri, 22 Feb 2013 14:01:50 -0500 Received: from /spool/local by e06smtp18.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 22 Feb 2013 18:59:37 -0000 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp18.uk.ibm.com (192.168.101.148) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 22 Feb 2013 18:59:36 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id C2D1A17D805A for ; Fri, 22 Feb 2013 19:02:16 +0000 (GMT) Received: from d06av04.portsmouth.uk.ibm.com (d06av04.portsmouth.uk.ibm.com [9.149.37.216]) by b06cxnps4076.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r1MJ1bmS21430476 for ; Fri, 22 Feb 2013 19:01:37 GMT Received: from d06av04.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r1MJ1ifE029764 for ; Fri, 22 Feb 2013 12:01:45 -0700 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r1MJ1ikd029761; Fri, 22 Feb 2013 12:01:44 -0700 Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 1122) id AD6FA1224437; Fri, 22 Feb 2013 20:01:44 +0100 (CET) From: Jens Freimann To: Alexander Graf Date: Fri, 22 Feb 2013 20:01:32 +0100 Message-Id: <1361559693-39396-3-git-send-email-jfrei@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1361559693-39396-1-git-send-email-jfrei@linux.vnet.ibm.com> References: <1361559693-39396-1-git-send-email-jfrei@linux.vnet.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13022218-6892-0000-0000-00000469082F X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 195.75.94.114 Cc: Cornelia Huck , Christian Borntraeger , Jens Freimann , qemu-devel Subject: [Qemu-devel] [PATCH 2/3] 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 --- 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 3244201..8240e48 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 01e59b9..670603a 100644 --- a/target-s390x/cpu.h +++ b/target-s390x/cpu.h @@ -405,7 +405,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. */