aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHalil Pasic <pasic@linux.ibm.com>2018-05-16 13:33:42 -0400
committerCornelia Huck <cohuck@redhat.com>2018-05-29 03:27:41 -0400
commitfb9e7880af357f0244f57a3dc4dd365091970b1a (patch)
treed9848a6af8fd8e7cbdebf5191c00747b8f3abb28
parent2c861d89ccda2fbcea9358eff9cc5f8fae548be5 (diff)
vfio: ccw: push down unsupported IDA check
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> Message-Id: <20180516173342.15174-1-pasic@linux.ibm.com> Reviewed-by: Dong Jia Shi <bjsdjshi@linux.ibm.com> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
-rw-r--r--drivers/s390/cio/vfio_ccw_cp.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/s390/cio/vfio_ccw_cp.c b/drivers/s390/cio/vfio_ccw_cp.c
index dce92b2a895d..9a2a39df1056 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)
365 * This is the chain length not considering any TICs. 365 * This is the chain length not considering any TICs.
366 * You need to do a new round for each TIC target. 366 * You need to do a new round for each TIC target.
367 * 367 *
368 * The program is also validated for absence of not yet supported
369 * indirect data addressing scenarios.
370 *
368 * Returns: the length of the ccw chain or -errno. 371 * Returns: the length of the ccw chain or -errno.
369 */ 372 */
370static int ccwchain_calc_length(u64 iova, struct channel_program *cp) 373static 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)
391 do { 394 do {
392 cnt++; 395 cnt++;
393 396
397 /*
398 * As we don't want to fail direct addressing even if the
399 * orb specified one of the unsupported formats, we defer
400 * checking for IDAWs in unsupported formats to here.
401 */
402 if ((!cp->orb.cmd.c64 || cp->orb.cmd.i2k) && ccw_is_idal(ccw))
403 return -EOPNOTSUPP;
404
394 if ((!ccw_is_chain(ccw)) && (!ccw_is_tic(ccw))) 405 if ((!ccw_is_chain(ccw)) && (!ccw_is_tic(ccw)))
395 break; 406 break;
396 407
@@ -656,10 +667,8 @@ int cp_init(struct channel_program *cp, struct device *mdev, union orb *orb)
656 /* 667 /*
657 * XXX: 668 * XXX:
658 * Only support prefetch enable mode now. 669 * Only support prefetch enable mode now.
659 * Only support 64bit addressing idal.
660 * Only support 4k IDAW.
661 */ 670 */
662 if (!orb->cmd.pfch || !orb->cmd.c64 || orb->cmd.i2k) 671 if (!orb->cmd.pfch)
663 return -EOPNOTSUPP; 672 return -EOPNOTSUPP;
664 673
665 INIT_LIST_HEAD(&cp->ccwchain_list); 674 INIT_LIST_HEAD(&cp->ccwchain_list);
@@ -688,6 +697,10 @@ int cp_init(struct channel_program *cp, struct device *mdev, union orb *orb)
688 ret = ccwchain_loop_tic(chain, cp); 697 ret = ccwchain_loop_tic(chain, cp);
689 if (ret) 698 if (ret)
690 cp_unpin_free(cp); 699 cp_unpin_free(cp);
700 /* It is safe to force: if not set but idals used
701 * ccwchain_calc_length returns an error.
702 */
703 cp->orb.cmd.c64 = 1;
691 704
692 return ret; 705 return ret;
693} 706}