From: Halil Pasic <pasic@linux.ibm.com>
To: Cornelia Huck <cohuck@redhat.com>,
qemu-s390x@nongnu.org, qemu-devel@nongnu.org
Cc: Halil Pasic <pasic@linux.ibm.com>,
Dong Jia Shi <bjsdjshi@linux.ibm.com>,
"Jason J. Herne" <jjherne@linux.ibm.com>,
Pierre Morel <pmorel@linux.ibm.com>
Subject: [Qemu-devel] [PATCH 1/2] vfio-ccw: add force unlimited prefetch property
Date: Thu, 10 May 2018 02:07:11 +0200 [thread overview]
Message-ID: <20180510000712.6472-2-pasic@linux.ibm.com> (raw)
In-Reply-To: <20180510000712.6472-1-pasic@linux.ibm.com>
There is at least one control program (guest) that although it does not
rely on the guarantees provided by ORB 1 word 9 bit (aka unlimited
prefetch, aka P bit) not being set, fails to tell this to the machine.
Usually this ain't a big deal, as the story is usually about performance
optimizations only. But vfio-ccw can not provide the guarantees required
if the bit is not set.
Since it is impossible to implement support for P bit not set (at
impossible least without transitioning to lower level protocols) in
vfio-ccw let's provide a manual override.
Signed-off-by: Halil Pasic <pasic@linux.ibm.com>
Suggested-by: Dong Jia Shi <bjsdjshi@linux.ibm.com>
Acked-by: Jason J. Herne <jjherne@linux.ibm.com>
Tested-by: Jason J. Herne <jjherne@linux.ibm.com>
---
hw/s390x/css.c | 3 +--
hw/vfio/ccw.c | 13 +++++++++++++
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/hw/s390x/css.c b/hw/s390x/css.c
index 301bf1772f..32f1b2820d 100644
--- a/hw/s390x/css.c
+++ b/hw/s390x/css.c
@@ -1196,8 +1196,7 @@ static IOInstEnding sch_handle_start_func_passthrough(SubchDev *sch)
* Only support prefetch enable mode.
* Only support 64bit addressing idal.
*/
- if (!(orb->ctrl0 & ORB_CTRL0_MASK_PFCH) ||
- !(orb->ctrl0 & ORB_CTRL0_MASK_C64)) {
+ if (!(orb->ctrl0 & ORB_CTRL0_MASK_C64)) {
warn_report("vfio-ccw requires PFCH and C64 flags set");
sch_gen_unit_exception(sch);
css_inject_io_interrupt(sch);
diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
index e67392c5f9..32cf606a71 100644
--- a/hw/vfio/ccw.c
+++ b/hw/vfio/ccw.c
@@ -32,6 +32,8 @@ typedef struct VFIOCCWDevice {
uint64_t io_region_offset;
struct ccw_io_region *io_region;
EventNotifier io_notifier;
+ /* force unlimited prefetch */
+ bool f_upfch;
} VFIOCCWDevice;
static void vfio_ccw_compute_needs_reset(VFIODevice *vdev)
@@ -52,8 +54,18 @@ static IOInstEnding vfio_ccw_handle_request(SubchDev *sch)
S390CCWDevice *cdev = sch->driver_data;
VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev);
struct ccw_io_region *region = vcdev->io_region;
+ bool upfch = sch->orb.ctrl0 & ORB_CTRL0_MASK_PFCH;
int ret;
+ if (!upfch && !vcdev->f_upfch) {
+ warn_report("vfio-ccw requires PFCH flag set");
+ sch_gen_unit_exception(sch);
+ css_inject_io_interrupt(sch);
+ return IOINST_CC_EXPECTED;
+ } else if (!upfch) {
+ sch->orb.ctrl0 |= ORB_CTRL0_MASK_PFCH;
+ }
+
QEMU_BUILD_BUG_ON(sizeof(region->orb_area) != sizeof(ORB));
QEMU_BUILD_BUG_ON(sizeof(region->scsw_area) != sizeof(SCSW));
QEMU_BUILD_BUG_ON(sizeof(region->irb_area) != sizeof(IRB));
@@ -429,6 +441,7 @@ static void vfio_ccw_unrealize(DeviceState *dev, Error **errp)
static Property vfio_ccw_properties[] = {
DEFINE_PROP_STRING("sysfsdev", VFIOCCWDevice, vdev.sysfsdev),
+ DEFINE_PROP_BOOL("f-upfch", VFIOCCWDevice, f_upfch, false),
DEFINE_PROP_END_OF_LIST(),
};
--
2.16.3
next prev parent reply other threads:[~2018-05-10 0:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-10 0:07 [Qemu-devel] [PATCH 0/2] vfio-ccw: loosen orb flags checks Halil Pasic
2018-05-10 0:07 ` Halil Pasic [this message]
2018-05-14 12:18 ` [Qemu-devel] [PATCH 1/2] vfio-ccw: add force unlimited prefetch property Cornelia Huck
2018-05-14 12:40 ` Halil Pasic
2018-05-14 13:45 ` Cornelia Huck
2018-05-14 14:22 ` Halil Pasic
2018-05-14 16:04 ` Cornelia Huck
2018-05-16 16:42 ` [Qemu-devel] [qemu-s390x] " Halil Pasic
2018-05-17 14:21 ` Cornelia Huck
2018-05-17 18:02 ` Halil Pasic
2018-05-10 0:07 ` [Qemu-devel] [PATCH 2/2] vfio-ccw: remove orb.c64 (64 bit data addresses) check Halil Pasic
2018-05-14 12:19 ` 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=20180510000712.6472-2-pasic@linux.ibm.com \
--to=pasic@linux.ibm.com \
--cc=bjsdjshi@linux.ibm.com \
--cc=cohuck@redhat.com \
--cc=jjherne@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).