From 4e19b57b0e335fdaf2cf3f056b327ee6717dec7e Mon Sep 17 00:00:00 2001 From: Cornelia Huck Date: Wed, 24 May 2017 14:06:12 +0200 Subject: [PATCH] s390x/css: fence off MIDA MIDA (modified indirect data addressing) is an optional facility, and we (currently) don't support it. Let's post an operand exception if the guest tries to set it in the orb and a channel program check if it is set in a ccw, as specified in the Principles of Operation. Reviewed-by: Claudio Imbrenda Reviewed-by: Halil Pasic Signed-off-by: Cornelia Huck Signed-off-by: Christian Borntraeger --- hw/s390x/css.c | 5 +++++ include/hw/s390x/ioinst.h | 1 + target/s390x/ioinst.c | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/hw/s390x/css.c b/hw/s390x/css.c index cc76c537da..599805d275 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -433,6 +433,11 @@ static int css_interpret_ccw(SubchDev *sch, hwaddr ccw_addr, return -EINVAL; } + /* We don't support MIDA. */ + if (ccw.flags & CCW_FLAG_MIDA) { + return -EINVAL; + } + if (ccw.flags & CCW_FLAG_SUSPEND) { return suspend_allowed ? -EINPROGRESS : -EINVAL; } diff --git a/include/hw/s390x/ioinst.h b/include/hw/s390x/ioinst.h index c559f53426..92d15655e4 100644 --- a/include/hw/s390x/ioinst.h +++ b/include/hw/s390x/ioinst.h @@ -182,6 +182,7 @@ typedef struct CCW1 { #define CCW_FLAG_PCI 0x08 #define CCW_FLAG_IDA 0x04 #define CCW_FLAG_SUSPEND 0x02 +#define CCW_FLAG_MIDA 0x01 #define CCW_CMD_NOOP 0x03 #define CCW_CMD_BASIC_SENSE 0x04 diff --git a/target/s390x/ioinst.c b/target/s390x/ioinst.c index 62a777100c..d5e6b8066b 100644 --- a/target/s390x/ioinst.c +++ b/target/s390x/ioinst.c @@ -201,6 +201,10 @@ static int ioinst_orb_valid(ORB *orb) (orb->ctrl1 & ORB_CTRL1_MASK_INVALID)) { return 0; } + /* We don't support MIDA. */ + if (orb->ctrl1 & ORB_CTRL1_MASK_MIDAW) { + return 0; + } if ((orb->cpa & HIGH_ORDER_BIT) != 0) { return 0; }