From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44154) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d5jsb-0007Ze-2V for qemu-devel@nongnu.org; Tue, 02 May 2017 22:19:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d5jsY-0002Ih-AK for qemu-devel@nongnu.org; Tue, 02 May 2017 22:19:00 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:43126 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d5jsY-0002Ib-4Q for qemu-devel@nongnu.org; Tue, 02 May 2017 22:18:58 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v432IbNY059139 for ; Tue, 2 May 2017 22:18:56 -0400 Received: from e11.ny.us.ibm.com (e11.ny.us.ibm.com [129.33.205.201]) by mx0a-001b2d01.pphosted.com with ESMTP id 2a765b89u6-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 02 May 2017 22:18:56 -0400 Received: from localhost by e11.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 2 May 2017 22:18:55 -0400 Date: Wed, 3 May 2017 10:18:50 +0800 From: Dong Jia Shi References: <20170428130951.44771-1-bjsdjshi@linux.vnet.ibm.com> <20170428130951.44771-11-bjsdjshi@linux.vnet.ibm.com> <6a3e0621-9e16-ddd4-c1d9-2a7351ebb9e6@redhat.com> <20170502021519.GA27968@bjsdjshi@linux.vnet.ibm.com> <20170502180407.33a8f468.cornelia.huck@de.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170502180407.33a8f468.cornelia.huck@de.ibm.com> Message-Id: <20170503021850.GG27968@bjsdjshi@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [PATCH v6 10/13] s390x/css: introduce and realize ccw-request callback List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cornelia Huck Cc: Dong Jia Shi , linux-s390@vger.kernel.org, kvm@vger.kernel.org, borntraeger@de.ibm.com, qemu-devel@nongnu.org, Auger Eric , alex.williamson@redhat.com, Xiao Feng Ren , agraf@suse.com * Cornelia Huck [2017-05-02 18:04:07 +0200]: > On Tue, 2 May 2017 10:15:19 +0800 > Dong Jia Shi wrote: > > > * Auger Eric [2017-05-01 19:28:23 +0200]: > > > > > static void vfio_ccw_io_notifier_handler(void *opaque) > > > > { > > > > VFIOCCWDevice *vcdev = opaque; > > > > + struct ccw_io_region *region = vcdev->io_region; > > > > + S390CCWDevice *cdev = S390_CCW_DEVICE(vcdev); > > > > + CcwDevice *ccw_dev = CCW_DEVICE(cdev); > > > > + SubchDev *sch = ccw_dev->sch; > > > > + SCSW *s = &sch->curr_status.scsw; > > > > + IRB irb; > > > > > > > > if (!event_notifier_test_and_clear(&vcdev->io_notifier)) { > > > > return; > > > > } > > > > + > > > > + if (pread(vcdev->vdev.fd, region, > > > > + vcdev->io_region_size, vcdev->io_region_offset) == -1) { > > > is it possible to read less bytes than requested? > > Currently, impossible. The kernel side returns either the full region, > > or an error. > > But we surely could make it more friendly for a partial return. I will > > add a check for that case, and generate a channel program check for it. > > I think a channel-control check would be more appropriate here. Hi Conny, After reading PoP 14-43, I think you are right. Quotation from PoP: ------------------8<----------------------------------- Channel-control check is caused by any machine malfunction affecting channel-subsystem controls. ... ... Channel-control check may also indicate that an error has been detected in the information trans- ferred to or from main storage during an I/O opera- tion. ... ... Detection of the channel-control-check condition causes the current operation, if any, to be terminated immediately. The subchannel is made status pending with primary and alert status or with primary, second- ary, and alert status as a function of the type of termi- nation, the current subchannel state, and the device status presented, if any. When the channel sub- system recognizes a channel-control-check condi- tion, any previously existing intermediate interruption condition may or may not be recognized by the chan- nel subsystem. ------------------>8----------------------------------- So I decide to add this piece of code: if (size != vcdev->io_region_size) { /* Information transfer error, generate channel-control check. */ s->ctrl &= ~SCSW_ACTL_START_PEND; s->cstat = SCSW_CSTAT_CHN_CTRL_CHK; s->ctrl &= ~SCSW_CTRL_MASK_STCTL; s->ctrl |= SCSW_STCTL_PRIMARY | SCSW_STCTL_SECONDARY | SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND; goto read_err; } -- Dong Jia Shi