* [PATCH 0/1] vfio-ccw: be less trusting
@ 2018-02-22 15:39 Cornelia Huck
2018-02-22 15:39 ` [PATCH 1/1] vfio-ccw: fence off transport mode Cornelia Huck
0 siblings, 1 reply; 5+ messages in thread
From: Cornelia Huck @ 2018-02-22 15:39 UTC (permalink / raw)
To: Dong Jia Shi, Halil Pasic; +Cc: linux-s390, kvm, linux-kernel, Cornelia Huck
I'm currently prototyping hsch()/csch() support for vfio-ccw, and
stumbled over this: We currently expect any I/O to be in command-mode,
but don't take care to actively reject transport-mode. This is not an
issue with QEMU (which rejects transport-mode ORBs before even the css
backend gets to it), but better play safe.
Should we want to support transport-mode in the future, we'll probably
need to introduce a capability for it that needs to be enabled by user
space.
[I also still have the doc patch from some time ago queued. Let's see
if we'll collect more patches.]
Cornelia Huck (1):
vfio-ccw: fence off transport mode
drivers/s390/cio/vfio_ccw_fsm.c | 5 +++++
1 file changed, 5 insertions(+)
--
2.13.6
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/1] vfio-ccw: fence off transport mode
2018-02-22 15:39 [PATCH 0/1] vfio-ccw: be less trusting Cornelia Huck
@ 2018-02-22 15:39 ` Cornelia Huck
2018-03-01 14:51 ` Halil Pasic
2018-03-02 12:03 ` Cornelia Huck
0 siblings, 2 replies; 5+ messages in thread
From: Cornelia Huck @ 2018-02-22 15:39 UTC (permalink / raw)
To: Dong Jia Shi, Halil Pasic; +Cc: linux-s390, kvm, linux-kernel, Cornelia Huck
vfio-ccw only supports command mode for channel programs, not transport
mode. User space is supposed to already take care of that and pass us
command-mode ORBs only, but better make sure and return an error to
the caller instead of trying to process tcws as ccws.
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
---
drivers/s390/cio/vfio_ccw_fsm.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/s390/cio/vfio_ccw_fsm.c b/drivers/s390/cio/vfio_ccw_fsm.c
index c30420c517b1..ff6963ad6e39 100644
--- a/drivers/s390/cio/vfio_ccw_fsm.c
+++ b/drivers/s390/cio/vfio_ccw_fsm.c
@@ -124,6 +124,11 @@ static void fsm_io_request(struct vfio_ccw_private *private,
if (scsw->cmd.fctl & SCSW_FCTL_START_FUNC) {
orb = (union orb *)io_region->orb_area;
+ /* Don't try to build a cp if transport mode is specified. */
+ if (orb->tm.b) {
+ io_region->ret_code = -EOPNOTSUPP;
+ goto err_out;
+ }
io_region->ret_code = cp_init(&private->cp, mdev_dev(mdev),
orb);
if (io_region->ret_code)
--
2.13.6
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] vfio-ccw: fence off transport mode
2018-02-22 15:39 ` [PATCH 1/1] vfio-ccw: fence off transport mode Cornelia Huck
@ 2018-03-01 14:51 ` Halil Pasic
2018-03-01 15:07 ` Cornelia Huck
2018-03-02 12:03 ` Cornelia Huck
1 sibling, 1 reply; 5+ messages in thread
From: Halil Pasic @ 2018-03-01 14:51 UTC (permalink / raw)
To: Cornelia Huck, Dong Jia Shi; +Cc: linux-s390, kvm, linux-kernel
On 02/22/2018 04:39 PM, Cornelia Huck wrote:
> vfio-ccw only supports command mode for channel programs, not transport
> mode. User space is supposed to already take care of that and pass us
> command-mode ORBs only, but better make sure and return an error to
> the caller instead of trying to process tcws as ccws.
>
> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Halil Pasic <pasic@linux.vnet.ibm.com>
> ---
> drivers/s390/cio/vfio_ccw_fsm.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/s390/cio/vfio_ccw_fsm.c b/drivers/s390/cio/vfio_ccw_fsm.c
> index c30420c517b1..ff6963ad6e39 100644
> --- a/drivers/s390/cio/vfio_ccw_fsm.c
> +++ b/drivers/s390/cio/vfio_ccw_fsm.c
> @@ -124,6 +124,11 @@ static void fsm_io_request(struct vfio_ccw_private *private,
> if (scsw->cmd.fctl & SCSW_FCTL_START_FUNC) {
> orb = (union orb *)io_region->orb_area;
>
> + /* Don't try to build a cp if transport mode is specified. */
> + if (orb->tm.b) {
> + io_region->ret_code = -EOPNOTSUPP;
I guess now we communicate this as appropriately as possible.
> + goto err_out;
> + }
> io_region->ret_code = cp_init(&private->cp, mdev_dev(mdev),
> orb);
> if (io_region->ret_code)
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] vfio-ccw: fence off transport mode
2018-03-01 14:51 ` Halil Pasic
@ 2018-03-01 15:07 ` Cornelia Huck
0 siblings, 0 replies; 5+ messages in thread
From: Cornelia Huck @ 2018-03-01 15:07 UTC (permalink / raw)
To: Halil Pasic; +Cc: Dong Jia Shi, linux-s390, kvm, linux-kernel
On Thu, 1 Mar 2018 15:51:05 +0100
Halil Pasic <pasic@linux.vnet.ibm.com> wrote:
> On 02/22/2018 04:39 PM, Cornelia Huck wrote:
> > vfio-ccw only supports command mode for channel programs, not transport
> > mode. User space is supposed to already take care of that and pass us
> > command-mode ORBs only, but better make sure and return an error to
> > the caller instead of trying to process tcws as ccws.
> >
> > Signed-off-by: Cornelia Huck <cohuck@redhat.com>
>
> Acked-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Thanks!
>
> > ---
> > drivers/s390/cio/vfio_ccw_fsm.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/drivers/s390/cio/vfio_ccw_fsm.c b/drivers/s390/cio/vfio_ccw_fsm.c
> > index c30420c517b1..ff6963ad6e39 100644
> > --- a/drivers/s390/cio/vfio_ccw_fsm.c
> > +++ b/drivers/s390/cio/vfio_ccw_fsm.c
> > @@ -124,6 +124,11 @@ static void fsm_io_request(struct vfio_ccw_private *private,
> > if (scsw->cmd.fctl & SCSW_FCTL_START_FUNC) {
> > orb = (union orb *)io_region->orb_area;
> >
> > + /* Don't try to build a cp if transport mode is specified. */
> > + if (orb->tm.b) {
> > + io_region->ret_code = -EOPNOTSUPP;
>
> I guess now we communicate this as appropriately as possible.
Yes. We certainly only want to return an error to user space; it is
their responsibility to correctly reflect that to the guest (and even
more their responsibility to not present us with a transport orb in the
first place...)
>
> > + goto err_out;
> > + }
> > io_region->ret_code = cp_init(&private->cp, mdev_dev(mdev),
> > orb);
> > if (io_region->ret_code)
> >
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] vfio-ccw: fence off transport mode
2018-02-22 15:39 ` [PATCH 1/1] vfio-ccw: fence off transport mode Cornelia Huck
2018-03-01 14:51 ` Halil Pasic
@ 2018-03-02 12:03 ` Cornelia Huck
1 sibling, 0 replies; 5+ messages in thread
From: Cornelia Huck @ 2018-03-02 12:03 UTC (permalink / raw)
To: Dong Jia Shi, Halil Pasic; +Cc: linux-s390, kvm, linux-kernel
On Thu, 22 Feb 2018 16:39:59 +0100
Cornelia Huck <cohuck@redhat.com> wrote:
> vfio-ccw only supports command mode for channel programs, not transport
> mode. User space is supposed to already take care of that and pass us
> command-mode ORBs only, but better make sure and return an error to
> the caller instead of trying to process tcws as ccws.
>
> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
> ---
> drivers/s390/cio/vfio_ccw_fsm.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/s390/cio/vfio_ccw_fsm.c b/drivers/s390/cio/vfio_ccw_fsm.c
> index c30420c517b1..ff6963ad6e39 100644
> --- a/drivers/s390/cio/vfio_ccw_fsm.c
> +++ b/drivers/s390/cio/vfio_ccw_fsm.c
> @@ -124,6 +124,11 @@ static void fsm_io_request(struct vfio_ccw_private *private,
> if (scsw->cmd.fctl & SCSW_FCTL_START_FUNC) {
> orb = (union orb *)io_region->orb_area;
>
> + /* Don't try to build a cp if transport mode is specified. */
> + if (orb->tm.b) {
> + io_region->ret_code = -EOPNOTSUPP;
> + goto err_out;
> + }
> io_region->ret_code = cp_init(&private->cp, mdev_dev(mdev),
> orb);
> if (io_region->ret_code)
Queued.
I'll probably send a pull request next week.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-03-02 12:03 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-22 15:39 [PATCH 0/1] vfio-ccw: be less trusting Cornelia Huck
2018-02-22 15:39 ` [PATCH 1/1] vfio-ccw: fence off transport mode Cornelia Huck
2018-03-01 14:51 ` Halil Pasic
2018-03-01 15:07 ` Cornelia Huck
2018-03-02 12:03 ` Cornelia Huck
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.