LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v2 1/1] s390: vfio-ccw: push down unsupported IDA check
@ 2018-05-16 17:33 Halil Pasic
       [not found] ` <20180517010925.GA30480@bjsdjshi@linux.ibm.com>
  2018-05-17  9:42 ` Cornelia Huck
  0 siblings, 2 replies; 3+ messages in thread
From: Halil Pasic @ 2018-05-16 17:33 UTC (permalink / raw)
  To: Cornelia Huck, Dong Jia Shi
  Cc: Halil Pasic, Jason J. Herne, linux-s390, kvm, linux-kernel

There is at least one relevant guest OS that doesn't set the IDA flags in
the ORB as we would like them, but never uses any IDA. So instead of
saying -EOPNOTSUPP when observing an ORB, such that a channel program
specified by it could be a not supported one, let us say -EOPNOTSUPP only
if the channel program is a not supported one.

Of course, the real solution would be doing proper translation for all
IDA. This is possible, but given the current code not straight forward.

Signed-off-by: Halil Pasic <pasic@linux.ibm.com>
Tested-by: Jason J. Herne <jjherne@linux.ibm.com>
---
---
 drivers/s390/cio/vfio_ccw_cp.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/drivers/s390/cio/vfio_ccw_cp.c b/drivers/s390/cio/vfio_ccw_cp.c
index 2c7550797ec2..cb4bf0dfbacc 100644
--- a/drivers/s390/cio/vfio_ccw_cp.c
+++ b/drivers/s390/cio/vfio_ccw_cp.c
@@ -365,6 +365,9 @@ static void cp_unpin_free(struct channel_program *cp)
  * This is the chain length not considering any TICs.
  * You need to do a new round for each TIC target.
  *
+ * The program is also validated for absence of not yet supported
+ * indirect data addressing scenarios.
+ *
  * Returns: the length of the ccw chain or -errno.
  */
 static int ccwchain_calc_length(u64 iova, struct channel_program *cp)
@@ -391,6 +394,14 @@ static int ccwchain_calc_length(u64 iova, struct channel_program *cp)
 	do {
 		cnt++;
 
+		/*
+		 * As we don't want to fail direct addressing even if the
+		 * orb specified one of the unsupported formats, we defer
+		 * checking for IDAWs in unsupported formats to here.
+		 */
+		if ((!cp->orb.cmd.c64 || cp->orb.cmd.i2k) && ccw_is_idal(ccw))
+			return -EOPNOTSUPP;
+
 		if ((!ccw_is_chain(ccw)) && (!ccw_is_tic(ccw)))
 			break;
 
@@ -656,10 +667,8 @@ int cp_init(struct channel_program *cp, struct device *mdev, union orb *orb)
 	/*
 	 * XXX:
 	 * Only support prefetch enable mode now.
-	 * Only support 64bit addressing idal.
-	 * Only support 4k IDAW.
 	 */
-	if (!orb->cmd.pfch || !orb->cmd.c64 || orb->cmd.i2k)
+	if (!orb->cmd.pfch)
 		return -EOPNOTSUPP;
 
 	INIT_LIST_HEAD(&cp->ccwchain_list);
@@ -688,6 +697,10 @@ int cp_init(struct channel_program *cp, struct device *mdev, union orb *orb)
 	ret = ccwchain_loop_tic(chain, cp);
 	if (ret)
 		cp_unpin_free(cp);
+	/* It is safe to force: if not set but idals used
+	 * ccwchain_calc_length returns an error.
+	 */
+	cp->orb.cmd.c64 = 1;
 
 	return ret;
 }
-- 
2.16.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 1/1] s390: vfio-ccw: push down unsupported IDA check
       [not found] ` <20180517010925.GA30480@bjsdjshi@linux.ibm.com>
@ 2018-05-17  9:24   ` Cornelia Huck
  0 siblings, 0 replies; 3+ messages in thread
From: Cornelia Huck @ 2018-05-17  9:24 UTC (permalink / raw)
  To: Dong Jia Shi; +Cc: Halil Pasic, Jason J. Herne, linux-s390, kvm, linux-kernel

On Thu, 17 May 2018 09:09:25 +0800
Dong Jia Shi <bjsdjshi@linux.ibm.com> wrote:

> * Halil Pasic <pasic@linux.ibm.com> [2018-05-16 19:33:42 +0200]:
> 
> Nitpick for Subject prefix (?):
> s/s390: vfio-ccw:/vfio: ccw:/

Trivial to fix up while applying.

> 
> > There is at least one relevant guest OS that doesn't set the IDA flags in
> > the ORB as we would like them, but never uses any IDA. So instead of
> > saying -EOPNOTSUPP when observing an ORB, such that a channel program
> > specified by it could be a not supported one, let us say -EOPNOTSUPP only
> > if the channel program is a not supported one.
> > 
> > Of course, the real solution would be doing proper translation for all
> > IDA. This is possible, but given the current code not straight forward.
> > 
> > Signed-off-by: Halil Pasic <pasic@linux.ibm.com>
> > Tested-by: Jason J. Herne <jjherne@linux.ibm.com>
> > ---
> > ---  
> Leftover?

git am will drop this anyway :)

> 
> >  drivers/s390/cio/vfio_ccw_cp.c | 19 ++++++++++++++++---
> >  1 file changed, 16 insertions(+), 3 deletions(-)
> >   
> 
> Reviewed-by: Dong Jia Shi <bjsdjshi@linux.ibm.com>

Thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 1/1] s390: vfio-ccw: push down unsupported IDA check
  2018-05-16 17:33 [PATCH v2 1/1] s390: vfio-ccw: push down unsupported IDA check Halil Pasic
       [not found] ` <20180517010925.GA30480@bjsdjshi@linux.ibm.com>
@ 2018-05-17  9:42 ` Cornelia Huck
  1 sibling, 0 replies; 3+ messages in thread
From: Cornelia Huck @ 2018-05-17  9:42 UTC (permalink / raw)
  To: Halil Pasic; +Cc: Dong Jia Shi, Jason J. Herne, linux-s390, kvm, linux-kernel

On Wed, 16 May 2018 19:33:42 +0200
Halil Pasic <pasic@linux.ibm.com> wrote:

> There is at least one relevant guest OS that doesn't set the IDA flags in
> the ORB as we would like them, but never uses any IDA. So instead of
> saying -EOPNOTSUPP when observing an ORB, such that a channel program
> specified by it could be a not supported one, let us say -EOPNOTSUPP only
> if the channel program is a not supported one.
> 
> Of course, the real solution would be doing proper translation for all
> IDA. This is possible, but given the current code not straight forward.
> 
> Signed-off-by: Halil Pasic <pasic@linux.ibm.com>
> Tested-by: Jason J. Herne <jjherne@linux.ibm.com>
> ---
> ---
>  drivers/s390/cio/vfio_ccw_cp.c | 19 ++++++++++++++++---
>  1 file changed, 16 insertions(+), 3 deletions(-)

Thanks, applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-05-17  9:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-16 17:33 [PATCH v2 1/1] s390: vfio-ccw: push down unsupported IDA check Halil Pasic
     [not found] ` <20180517010925.GA30480@bjsdjshi@linux.ibm.com>
2018-05-17  9:24   ` Cornelia Huck
2018-05-17  9:42 ` Cornelia Huck

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).