[{"id":1772620,"web_url":"http://patchwork.ozlabs.org/comment/1772620/","msgid":"<f5833eee-3896-1d5a-b7a5-6b3f5b1165d2@linux.vnet.ibm.com>","list_archive_url":null,"date":"2017-09-21T09:40:49","subject":"Re: [Qemu-devel] [PATCH v3 2/5] s390x/css: use ccw data stream","submitter":{"id":66825,"url":"http://patchwork.ozlabs.org/api/people/66825/","name":"Pierre Morel","email":"pmorel@linux.vnet.ibm.com"},"content":"On 19/09/2017 20:27, Halil Pasic wrote:\n> Replace direct access which implicitly assumes no IDA\n> or MIDA with the new ccw data stream interface which should\n> cope with these transparently in the future.\n> \n> Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>\n> Reviewed-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>\n> Reviewed-by: Pierre Morel<pmorel@linux.vnet.ibm.com>\n> ---\n>   hw/s390x/css.c | 9 +++++----\n>   1 file changed, 5 insertions(+), 4 deletions(-)\n> \n> diff --git a/hw/s390x/css.c b/hw/s390x/css.c\n> index e8d2016563..6b0cd8861b 100644\n> --- a/hw/s390x/css.c\n> +++ b/hw/s390x/css.c\n> @@ -890,6 +890,7 @@ static int css_interpret_ccw(SubchDev *sch, hwaddr ccw_addr,\n>       }\n> \n>       /* Look at the command. */\n> +    ccw_dstream_init(&sch->cds, &ccw, &(sch->orb));\n>       switch (ccw.cmd_code) {\n>       case CCW_CMD_NOOP:\n>           /* Nothing to do. */\n> @@ -903,8 +904,8 @@ static int css_interpret_ccw(SubchDev *sch, hwaddr ccw_addr,\n>               }\n>           }\n>           len = MIN(ccw.count, sizeof(sch->sense_data));\n> -        cpu_physical_memory_write(ccw.cda, sch->sense_data, len);\n> -        sch->curr_status.scsw.count = ccw.count - len;\n> +        ccw_dstream_write_buf(&sch->cds, sch->sense_data, len);\n\nWell, I oversaw this when I reviewed:\nI think you should test the return value of ccw_dstream_write_buf here.\n\n> +        sch->curr_status.scsw.count = ccw_dstream_residual_count(&sch->cds);\n>           memset(sch->sense_data, 0, sizeof(sch->sense_data));\n>           ret = 0;\n>           break;\n> @@ -930,8 +931,8 @@ static int css_interpret_ccw(SubchDev *sch, hwaddr ccw_addr,\n>           } else {\n>               sense_id.reserved = 0;\n>           }\n> -        cpu_physical_memory_write(ccw.cda, &sense_id, len);\n> -        sch->curr_status.scsw.count = ccw.count - len;\n> +        ccw_dstream_write_buf(&sch->cds, &sense_id, len);\n\nand here\n\n> +        sch->curr_status.scsw.count = ccw_dstream_residual_count(&sch->cds);\n>           ret = 0;\n>           break;\n>       }\n>","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xyWpT2k5nz9t43\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 21 Sep 2017 19:41:36 +1000 (AEST)","from localhost ([::1]:52617 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1duxzB-0002AK-IK\n\tfor incoming@patchwork.ozlabs.org; Thu, 21 Sep 2017 05:41:33 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:34078)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <pmorel@linux.vnet.ibm.com>) id 1duxyh-00028z-V6\n\tfor qemu-devel@nongnu.org; Thu, 21 Sep 2017 05:41:04 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <pmorel@linux.vnet.ibm.com>) id 1duxyb-0007zl-Ug\n\tfor qemu-devel@nongnu.org; Thu, 21 Sep 2017 05:41:03 -0400","from mx0b-001b2d01.pphosted.com ([148.163.158.5]:51410\n\thelo=mx0a-001b2d01.pphosted.com)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <pmorel@linux.vnet.ibm.com>)\n\tid 1duxyb-0007yr-NB\n\tfor qemu-devel@nongnu.org; Thu, 21 Sep 2017 05:40:57 -0400","from pps.filterd (m0098419.ppops.net [127.0.0.1])\n\tby mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id\n\tv8L9Ya2C145124\n\tfor <qemu-devel@nongnu.org>; Thu, 21 Sep 2017 05:40:57 -0400","from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110])\n\tby mx0b-001b2d01.pphosted.com with ESMTP id 2d4aemt5mg-1\n\t(version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT)\n\tfor <qemu-devel@nongnu.org>; Thu, 21 Sep 2017 05:40:56 -0400","from localhost\n\tby e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use\n\tOnly! Violators will be prosecuted\n\tfor <qemu-devel@nongnu.org> from <pmorel@linux.vnet.ibm.com>;\n\tThu, 21 Sep 2017 10:40:53 +0100","from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196)\n\tby e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP\n\tGateway: Authorized Use Only! Violators will be prosecuted; \n\tThu, 21 Sep 2017 10:40:50 +0100","from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com\n\t[9.149.105.62])\n\tby b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with\n\tESMTP id v8L9eoNW25428044; Thu, 21 Sep 2017 09:40:50 GMT","from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id 8E8C7AE051;\n\tThu, 21 Sep 2017 10:35:41 +0100 (BST)","from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id 5EAB8AE04D;\n\tThu, 21 Sep 2017 10:35:41 +0100 (BST)","from [9.145.23.132] (unknown [9.145.23.132])\n\tby d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP;\n\tThu, 21 Sep 2017 10:35:41 +0100 (BST)"],"To":"Halil Pasic <pasic@linux.vnet.ibm.com>, Cornelia Huck <cohuck@redhat.com>","References":"<20170919182745.90280-1-pasic@linux.vnet.ibm.com>\n\t<20170919182745.90280-3-pasic@linux.vnet.ibm.com>","From":"Pierre Morel <pmorel@linux.vnet.ibm.com>","Date":"Thu, 21 Sep 2017 11:40:49 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<20170919182745.90280-3-pasic@linux.vnet.ibm.com>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Language":"en-US","X-TM-AS-GCONF":"00","x-cbid":"17092109-0016-0000-0000-000004EEEEA6","X-IBM-AV-DETECTION":"SAVI=unused REMOTE=unused XFE=unused","x-cbparentid":"17092109-0017-0000-0000-000028292B30","Message-Id":"<f5833eee-3896-1d5a-b7a5-6b3f5b1165d2@linux.vnet.ibm.com>","X-Proofpoint-Virus-Version":"vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2017-09-21_01:, , signatures=0","X-Proofpoint-Spam-Details":"rule=outbound_notspam policy=outbound score=0\n\tspamscore=0 suspectscore=0\n\tmalwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam\n\tadjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000\n\tdefinitions=main-1709210131","Content-Transfer-Encoding":"quoted-printable","X-MIME-Autoconverted":"from 8bit to quoted-printable by\n\tmx0b-001b2d01.pphosted.com id v8L9Ya2C145124","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy]","X-Received-From":"148.163.158.5","Subject":"Re: [Qemu-devel] [PATCH v3 2/5] s390x/css: use ccw data stream","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>, qemu-devel@nongnu.org","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}}]