From: Cornelia Huck <cohuck@redhat.com>
To: Eric Farman <farman@linux.ibm.com>
Cc: Halil Pasic <pasic@linux.ibm.com>,
Christian Borntraeger <borntraeger@de.ibm.com>,
qemu-s390x@nongnu.org, qemu-devel@nongnu.org,
pmorel@linux.ibm.com
Subject: Re: [Qemu-devel] [PATCH RFC v2] s390/css: handle CCW_FLAG_SKIP
Date: Wed, 8 May 2019 10:44:00 +0200 [thread overview]
Message-ID: <20190508104400.68e62de0.cohuck@redhat.com> (raw)
In-Reply-To: <42ffdd81-7bbd-1a46-c4f9-3771ea26a84b@linux.ibm.com>
On Tue, 7 May 2019 11:31:16 -0400
Eric Farman <farman@linux.ibm.com> wrote:
> On 5/7/19 5:08 AM, Pierre Morel wrote:
> > On 07/05/2019 10:12, Cornelia Huck wrote:
> >> 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 <cohuck@redhat.com>
> >> ---
> >>
> >> 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.
>
> FWIW, my test program hits this code once (read of a single page, with
> SLI and SKIP flags set) before getting into the passthrough codepath.
Ah, good.
>
> >>
> >> ---
> >> 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 == CDS_OP_A) {
> >> goto incr;
> >> }
> >> - ret = address_space_rw(&address_space_memory, cds->cda,
> >> - MEMTXATTRS_UNSPECIFIED, buff, len, op);
> >> + if (!cds->do_skip) {
> >> + ret = address_space_rw(&address_space_memory, cds->cda,
> >> + MEMTXATTRS_UNSPECIFIED, buff, len, op);
> >> + } else {
> >> + ret = 0;
> >> + }
> >> if (ret != MEMTX_OK) {
> >> cds->flags |= 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 = MIN(len, cont_left);
> >> if (op != CDS_OP_A) {
> >> - ret = address_space_rw(&address_space_memory, cds->cda,
> >> - MEMTXATTRS_UNSPECIFIED, buff,
> >> iter_len, op);
> >> + if (!cds->do_skip) {
> >> + ret = address_space_rw(&address_space_memory, cds->cda,
> >> + MEMTXATTRS_UNSPECIFIED, buff,
> >> iter_len,
> >> + op);
> >> + } else {
> >> + ret = 0;
> >> + }
> >> if (ret != MEMTX_OK) {
> >> /* assume inaccessible address */
> >> ret = -EINVAL; /* channel program check */
> >> @@ -968,6 +977,11 @@ void ccw_dstream_init(CcwDataStream *cds, CCW1
> >> const *ccw, ORB const *orb)
> >> cds->count = ccw->count;
> >> cds->cda_orig = ccw->cda;
> >> + /* skip is only effective for read, read backwards, or sense
> >> commands */
> >> + cds->do_skip = (ccw->flags & CCW_FLAG_SKIP) &&
> >> + ((ccw->cmd_code & CCW_CMD_BASIC_SENSE) == CCW_CMD_BASIC_SENSE ||
> >> + (ccw->cmd_code & 0x02) == 0x02 /* read */ ||
> >> + (ccw->cmd_code & 0x0c) == 0x0c /* read backwards */);
> >
> > I think you should use masks like
> > ((code & 0x3) == 2) => READ
> > ((code & 0xf) == 0xc) => READ BACKWARD
> > ((code & 0xf) == 0x4) => SENSE
>
> I think Pierre is right. In the v2 code, a control CCW (like NOP) would
> still be flagged as a READ.
Sigh. I hope third time's the charm.
prev parent reply other threads:[~2019-05-08 8:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-07 8:12 [Qemu-devel] [PATCH RFC v2] s390/css: handle CCW_FLAG_SKIP Cornelia Huck
2019-05-07 9:08 ` Pierre Morel
2019-05-07 15:31 ` Eric Farman
2019-05-08 8:44 ` Cornelia Huck [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190508104400.68e62de0.cohuck@redhat.com \
--to=cohuck@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=farman@linux.ibm.com \
--cc=pasic@linux.ibm.com \
--cc=pmorel@linux.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).