From: Eric Farman <farman@linux.ibm.com>
To: Cornelia Huck <cohuck@redhat.com>,
qemu-devel@nongnu.org, qemu-s390x@nongnu.org
Cc: Thomas Huth <thuth@redhat.com>,
Matthew Rosato <mjrosato@linux.ibm.com>,
David Hildenbrand <david@redhat.com>,
Richard Henderson <richard.henderson@linaro.org>,
Eric Farman <farman@linux.ibm.com>,
Halil Pasic <pasic@linux.ibm.com>,
Christian Borntraeger <borntraeger@de.ibm.com>,
Alex Williamson <alex.williamson@redhat.com>
Subject: [PATCH 1/1] vfio-ccw: Keep passthrough sense data intact
Date: Thu, 10 Jun 2021 22:20:11 +0200 [thread overview]
Message-ID: <20210610202011.391029-2-farman@linux.ibm.com> (raw)
In-Reply-To: <20210610202011.391029-1-farman@linux.ibm.com>
For virtual devices, there is space for sense data to be built
and later copied into the IRB's ECW space once a TSCH is handled.
For passthrough devices, the IRB is passed up from hardware.
There might already be sense data in the ECW, in which case it
would be unusual to overwrite the IRB ESW/ECW data with itself.
In either case, if there isn't sense data, then an explicit SENSE
operation might be needed from the guest driver. Regardless,
fabricating sense data out of zeros seems like it would result
in unexpected behavior.
Let's remove the copying of the ECW/sense data in the vfio-ccw
driver, and adapt the check in the TSCH handler to look for
non-zero data in the local sense data before building a sense
data response in the IRB.
This fixes a "dasdfmt -M quick" command issued within a guest.
Signed-off-by: Eric Farman <farman@linux.ibm.com>
---
hw/s390x/css.c | 3 ++-
hw/vfio/ccw.c | 6 ------
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/hw/s390x/css.c b/hw/s390x/css.c
index bed46f5ec3..29234daa27 100644
--- a/hw/s390x/css.c
+++ b/hw/s390x/css.c
@@ -1661,7 +1661,8 @@ int css_do_tsch_get_irb(SubchDev *sch, IRB *target_irb, int *irb_len)
}
/* If a unit check is pending, copy sense data. */
if ((schib->scsw.dstat & SCSW_DSTAT_UNIT_CHECK) &&
- (schib->pmcw.chars & PMCW_CHARS_MASK_CSENSE)) {
+ (schib->pmcw.chars & PMCW_CHARS_MASK_CSENSE) &&
+ (sch->sense_data[0] != 0)) {
int i;
irb.scsw.flags |= SCSW_FLAGS_MASK_ESWF | SCSW_FLAGS_MASK_ECTL;
diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
index 139a3d9d1b..a4dc4acb34 100644
--- a/hw/vfio/ccw.c
+++ b/hw/vfio/ccw.c
@@ -371,12 +371,6 @@ static void vfio_ccw_io_notifier_handler(void *opaque)
copy_scsw_to_guest(&s, &irb.scsw);
schib->scsw = s;
- /* If a uint check is pending, copy sense data. */
- if ((schib->scsw.dstat & SCSW_DSTAT_UNIT_CHECK) &&
- (schib->pmcw.chars & PMCW_CHARS_MASK_CSENSE)) {
- memcpy(sch->sense_data, irb.ecw, sizeof(irb.ecw));
- }
-
read_err:
css_inject_io_interrupt(sch);
}
--
2.25.1
next prev parent reply other threads:[~2021-06-10 20:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-10 20:20 [PATCH 0/1] vfio-ccw: Fix garbage sense data on I/O error Eric Farman
2021-06-10 20:20 ` Eric Farman [this message]
2021-06-11 7:15 ` [PATCH 1/1] vfio-ccw: Keep passthrough sense data intact Cornelia Huck
2021-06-11 10:21 ` Cornelia Huck
2021-06-11 12:51 ` Eric Farman
2021-06-11 14:37 ` Cornelia Huck
2021-06-10 20:25 ` [PATCH 0/1] vfio-ccw: Fix garbage sense data on I/O error Matthew Rosato
2021-06-10 20:38 ` Eric Farman
2021-06-11 7:12 ` Cornelia Huck
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=20210610202011.391029-2-farman@linux.ibm.com \
--to=farman@linux.ibm.com \
--cc=alex.williamson@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=mjrosato@linux.ibm.com \
--cc=pasic@linux.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.com \
/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).