From nobody Sun May 19 12:00:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1557216838; cv=none; d=zoho.com; s=zohoarc; b=TFraOLWHwppcW45fjZ4203MZQezWIY0BRPuXmQyF3XLwNrhQVWef4niO2Yf7Vy/mbZJgl0K5QCAV70Z/XDMpsdFpCN5LBLvkV7+n/dFdu5cHGhrvCD6pF5jnvAd8fbKaSDLBAw1esU8J8SZ2u9B81P++EULSwXXuNgaej5pTDO0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557216838; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=TaV+fQ15Snx0wADX5p1po44kRrGzZbP3Wv4mT37pOe4=; b=oj8OhLOkJ+hGt5O2e4N25+zwDpfQ00gEgiDw/oKGBksYjZI7XYFgbUFP6qxmRQ2UCFMpPGgsFCcKVqrY4FWYR0VeEwa5skU8NR9rVEk6u6vbsHR2fM/+nUh52rJCvY8chXQmCCBy4wvwVsz6V/CawuEbxofMv1XaxrBxRySffME= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 155721683800494.29859587342025; Tue, 7 May 2019 01:13:58 -0700 (PDT) Received: from localhost ([127.0.0.1]:41936 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hNvEZ-00076q-2z for importer@patchew.org; Tue, 07 May 2019 04:13:55 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56464) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hNvDc-0006eh-6D for qemu-devel@nongnu.org; Tue, 07 May 2019 04:12:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hNvDb-0004ip-6r for qemu-devel@nongnu.org; Tue, 07 May 2019 04:12:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43432) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hNvDa-0004iY-Vw; Tue, 07 May 2019 04:12:55 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3E90E3097025; Tue, 7 May 2019 08:12:54 +0000 (UTC) Received: from localhost (dhcp-192-187.str.redhat.com [10.33.192.187]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E097B611D9; Tue, 7 May 2019 08:12:53 +0000 (UTC) From: Cornelia Huck To: Halil Pasic , Christian Borntraeger Date: Tue, 7 May 2019 10:12:51 +0200 Message-Id: <20190507081251.24307-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Tue, 07 May 2019 08:12:54 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH RFC v2] s390/css: handle CCW_FLAG_SKIP X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Farman , qemu-s390x@nongnu.org, Cornelia Huck , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" If a ccw has CCW_FLAG_SKIP set, and the command is of type read, read backwards, or sense, no data should be written to the guest for that command. Signed-off-by: Cornelia Huck --- v1 -> v2: fixed checks for command type [Eric] Still only lightly tested (it boots); I don't think I have a tool generating channel programs with the skip flag handy. --- hw/s390x/css.c | 22 ++++++++++++++++++---- include/hw/s390x/css.h | 1 + 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/hw/s390x/css.c b/hw/s390x/css.c index 8fc9e35ba5d3..080ac7e5bc0b 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -830,8 +830,12 @@ static int ccw_dstream_rw_noflags(CcwDataStream *cds, = void *buff, int len, if (op =3D=3D CDS_OP_A) { goto incr; } - ret =3D address_space_rw(&address_space_memory, cds->cda, - MEMTXATTRS_UNSPECIFIED, buff, len, op); + if (!cds->do_skip) { + ret =3D address_space_rw(&address_space_memory, cds->cda, + MEMTXATTRS_UNSPECIFIED, buff, len, op); + } else { + ret =3D 0; + } if (ret !=3D MEMTX_OK) { cds->flags |=3D CDS_F_STREAM_BROKEN; return -EINVAL; @@ -928,8 +932,13 @@ static int ccw_dstream_rw_ida(CcwDataStream *cds, void= *buff, int len, do { iter_len =3D MIN(len, cont_left); if (op !=3D CDS_OP_A) { - ret =3D address_space_rw(&address_space_memory, cds->cda, - MEMTXATTRS_UNSPECIFIED, buff, iter_len,= op); + if (!cds->do_skip) { + ret =3D address_space_rw(&address_space_memory, cds->cda, + MEMTXATTRS_UNSPECIFIED, buff, iter_= len, + op); + } else { + ret =3D 0; + } if (ret !=3D MEMTX_OK) { /* assume inaccessible address */ ret =3D -EINVAL; /* channel program check */ @@ -968,6 +977,11 @@ void ccw_dstream_init(CcwDataStream *cds, CCW1 const *= ccw, ORB const *orb) =20 cds->count =3D ccw->count; cds->cda_orig =3D ccw->cda; + /* skip is only effective for read, read backwards, or sense commands = */ + cds->do_skip =3D (ccw->flags & CCW_FLAG_SKIP) && + ((ccw->cmd_code & CCW_CMD_BASIC_SENSE) =3D=3D CCW_CMD_BASIC_SENSE = || + (ccw->cmd_code & 0x02) =3D=3D 0x02 /* read */ || + (ccw->cmd_code & 0x0c) =3D=3D 0x0c /* read backwards */); ccw_dstream_rewind(cds); if (!(cds->flags & CDS_F_IDA)) { cds->op_handler =3D ccw_dstream_rw_noflags; diff --git a/include/hw/s390x/css.h b/include/hw/s390x/css.h index aae19c427229..7cc183ef4366 100644 --- a/include/hw/s390x/css.h +++ b/include/hw/s390x/css.h @@ -97,6 +97,7 @@ typedef struct CcwDataStream { int (*op_handler)(struct CcwDataStream *cds, void *buff, int len, CcwDataStreamOp op); hwaddr cda; + bool do_skip; } CcwDataStream; =20 /* --=20 2.20.1