From patchwork Fri Jan 22 12:23:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cornelia Huck X-Patchwork-Id: 8089661 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 24835BEEE5 for ; Fri, 22 Jan 2016 12:26:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7788E203AA for ; Fri, 22 Jan 2016 12:26:09 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ACBC320272 for ; Fri, 22 Jan 2016 12:26:08 +0000 (UTC) Received: from localhost ([::1]:53010 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMan2-0004gg-25 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 22 Jan 2016 07:26:08 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56383) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMako-0000uc-Cq for qemu-devel@nongnu.org; Fri, 22 Jan 2016 07:23:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aMakk-0001cT-Ar for qemu-devel@nongnu.org; Fri, 22 Jan 2016 07:23:50 -0500 Received: from e06smtp14.uk.ibm.com ([195.75.94.110]:55726) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMakk-0001be-0e for qemu-devel@nongnu.org; Fri, 22 Jan 2016 07:23:46 -0500 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 22 Jan 2016 12:23:43 -0000 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 22 Jan 2016 12:23:40 -0000 X-IBM-Helo: d06dlp01.portsmouth.uk.ibm.com X-IBM-MailFrom: cornelia.huck@de.ibm.com X-IBM-RcptTo: qemu-devel@nongnu.org Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id AAA2117D8059 for ; Fri, 22 Jan 2016 12:23:46 +0000 (GMT) Received: from d06av08.portsmouth.uk.ibm.com (d06av08.portsmouth.uk.ibm.com [9.149.37.249]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u0MCNeCP10617298 for ; Fri, 22 Jan 2016 12:23:40 GMT Received: from d06av08.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u0MCNdr9029794 for ; Fri, 22 Jan 2016 05:23:39 -0700 Received: from gondolin.ibm.com (sig-9-81-16-240.evts.uk.ibm.com [9.81.16.240]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u0MCNZDR029586 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 22 Jan 2016 05:23:39 -0700 From: Cornelia Huck To: qemu-devel@nongnu.org Date: Fri, 22 Jan 2016 13:23:28 +0100 Message-Id: <1453465413-12846-6-git-send-email-cornelia.huck@de.ibm.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1453465413-12846-1-git-send-email-cornelia.huck@de.ibm.com> References: <1453465413-12846-1-git-send-email-cornelia.huck@de.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16012212-0017-0000-0000-000006EC084F X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.75.94.110 Cc: Song Shan Gong , borntraeger@de.ibm.com, jfrei@linux.vnet.ibm.com, Cornelia Huck , agraf@suse.de Subject: [Qemu-devel] [PATCH 05/10] s390x: fix generation of event information crw 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Song Shan Gong Only one channel report word (crw) may be pending if there is event-information pending. This patch introduces a bool-type field 'sei_pending' for the channel subsystem, which indicates whether there are pending events. It is set when event information is made pending and the crw generated, and cleared after the guest has collected all pending event information. A crw is not generated if this flag had already been set. Signed-off-by: Song Shan Gong Reviewed-by: Cornelia Huck Signed-off-by: Cornelia Huck --- hw/s390x/css.c | 13 ++++++++++++- hw/s390x/css.h | 1 + target-s390x/ioinst.c | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/hw/s390x/css.c b/hw/s390x/css.c index 343c352..533357a 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -49,6 +49,7 @@ typedef struct IoAdapter { typedef struct ChannelSubSys { QTAILQ_HEAD(, CrwContainer) pending_crws; + bool sei_pending; bool do_crw_mchk; bool crws_lost; uint8_t max_cssid; @@ -1359,7 +1360,15 @@ void css_generate_chp_crws(uint8_t cssid, uint8_t chpid) void css_generate_css_crws(uint8_t cssid) { - css_queue_crw(CRW_RSC_CSS, 0, 0, cssid); + if (!channel_subsys->sei_pending) { + css_queue_crw(CRW_RSC_CSS, 0, 0, cssid); + } + channel_subsys->sei_pending = true; +} + +void css_clear_sei_pending(void) +{ + channel_subsys->sei_pending = false; } int css_enable_mcsse(void) @@ -1509,6 +1518,7 @@ static void css_init(void) { channel_subsys = g_malloc0(sizeof(*channel_subsys)); QTAILQ_INIT(&channel_subsys->pending_crws); + channel_subsys->sei_pending = false; channel_subsys->do_crw_mchk = true; channel_subsys->crws_lost = false; channel_subsys->chnmon_active = false; @@ -1561,6 +1571,7 @@ void css_reset(void) QTAILQ_REMOVE(&channel_subsys->pending_crws, crw_cont, sibling); g_free(crw_cont); } + channel_subsys->sei_pending = false; channel_subsys->do_crw_mchk = true; channel_subsys->crws_lost = false; diff --git a/hw/s390x/css.h b/hw/s390x/css.h index a09bb1f..a47937d 100644 --- a/hw/s390x/css.h +++ b/hw/s390x/css.h @@ -103,6 +103,7 @@ void css_generate_sch_crws(uint8_t cssid, uint8_t ssid, uint16_t schid, int hotplugged, int add); void css_generate_chp_crws(uint8_t cssid, uint8_t chpid); void css_generate_css_crws(uint8_t cssid); +void css_clear_sei_pending(void); void css_adapter_interrupt(uint8_t isc); #define CSS_IO_ADAPTER_VIRTIO 1 diff --git a/target-s390x/ioinst.c b/target-s390x/ioinst.c index 57c2d8b..9a8de6d 100644 --- a/target-s390x/ioinst.c +++ b/target-s390x/ioinst.c @@ -614,6 +614,7 @@ static void ioinst_handle_chsc_sei(ChscReq *req, ChscResp *res) (*res_flags) |= 0x80; } else { (*res_flags) &= ~0x80; + css_clear_sei_pending(); } } else { res->code = cpu_to_be16(0x0005);