From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44162) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXSyU-00016w-5T for qemu-devel@nongnu.org; Fri, 26 Sep 2014 06:42:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XXSyM-00018T-Jp for qemu-devel@nongnu.org; Fri, 26 Sep 2014 06:42:06 -0400 Received: from cantor2.suse.de ([195.135.220.15]:43900 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXSyM-00015m-9J for qemu-devel@nongnu.org; Fri, 26 Sep 2014 06:41:58 -0400 Message-ID: <542542EF.2040403@suse.de> Date: Fri, 26 Sep 2014 12:41:51 +0200 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1411474456-12226-1-git-send-email-borntraeger@de.ibm.com> <1411474456-12226-3-git-send-email-borntraeger@de.ibm.com> In-Reply-To: <1411474456-12226-3-git-send-email-borntraeger@de.ibm.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PULL 2/3] s390x/css: support format-0 ccws List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christian Borntraeger , Peter Maydell , Cornelia Huck Cc: Jens Freimann , Richard Henderson , qemu-devel , Alexander Graf Am 23.09.2014 um 14:14 schrieb Christian Borntraeger: > From: Cornelia Huck >=20 > Add support for format-0 ccws in channel programs. As a format-1 ccw > contains the same information as format-0 ccws, only supporting larger > addresses, simply convert every ccw to format-1 as we walk the chain. >=20 > Reviewed-by: David Hildenbrand > Signed-off-by: Cornelia Huck > Signed-off-by: Jens Freimann > Signed-off-by: Christian Borntraeger > --- > hw/s390x/css.c | 30 +++++++++++++++++++++--------- > hw/s390x/css.h | 1 + > target-s390x/ioinst.h | 10 ++++++++++ > 3 files changed, 32 insertions(+), 9 deletions(-) >=20 > diff --git a/hw/s390x/css.c b/hw/s390x/css.c > index 49c2aaf..34637cb 100644 > --- a/hw/s390x/css.c > +++ b/hw/s390x/css.c > @@ -243,17 +243,25 @@ static void copy_sense_id_to_guest(SenseId *dest,= SenseId *src) > } > } > =20 > -static CCW1 copy_ccw_from_guest(hwaddr addr) > +static CCW1 copy_ccw_from_guest(hwaddr addr, bool fmt1) > { > - CCW1 tmp; > + CCW0 tmp0; > + CCW1 tmp1; > CCW1 ret; > =20 > - cpu_physical_memory_read(addr, &tmp, sizeof(tmp)); > - ret.cmd_code =3D tmp.cmd_code; > - ret.flags =3D tmp.flags; > - ret.count =3D be16_to_cpu(tmp.count); > - ret.cda =3D be32_to_cpu(tmp.cda); > - > + if (fmt1) { > + cpu_physical_memory_read(addr, &tmp1, sizeof(tmp1)); > + ret.cmd_code =3D tmp1.cmd_code; > + ret.flags =3D tmp1.flags; > + ret.count =3D be16_to_cpu(tmp1.count); > + ret.cda =3D be32_to_cpu(tmp1.cda); > + } else { > + cpu_physical_memory_read(addr, &tmp0, sizeof(tmp0)); > + ret.cmd_code =3D tmp0.cmd_code; > + ret.flags =3D tmp0.flags; > + ret.count =3D be16_to_cpu(tmp0.count); > + ret.cda =3D be16_to_cpu(tmp0.cda1) | (tmp0.cda0 << 16); > + } > return ret; > } > =20 > @@ -268,7 +276,8 @@ static int css_interpret_ccw(SubchDev *sch, hwaddr = ccw_addr) > return -EIO; > } > =20 > - ccw =3D copy_ccw_from_guest(ccw_addr); > + /* Translate everything to format-1 ccws - the information is the = same. */ > + ccw =3D copy_ccw_from_guest(ccw_addr, sch->ccw_fmt_1); > =20 > /* Check for invalid command codes. */ > if ((ccw.cmd_code & 0x0f) =3D=3D 0) { > @@ -386,6 +395,7 @@ static void sch_handle_start_func(SubchDev *sch, OR= B *orb) > s->ctrl |=3D (SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND); > return; > } > + sch->ccw_fmt_1 =3D !!(orb->ctrl0 & ORB_CTRL0_MASK_FMT); > } else { > s->ctrl &=3D ~(SCSW_ACTL_SUSP | SCSW_ACTL_RESUME_PEND); > } > @@ -1347,6 +1357,7 @@ void subch_device_save(SubchDev *s, QEMUFile *f) > qemu_put_byte(f, s->id.ciw[i].command); > qemu_put_be16(f, s->id.ciw[i].count); > } > + qemu_put_byte(f, s->ccw_fmt_1); > return; > } > =20 > @@ -1402,6 +1413,7 @@ int subch_device_load(SubchDev *s, QEMUFile *f) > s->id.ciw[i].command =3D qemu_get_byte(f); > s->id.ciw[i].count =3D qemu_get_be16(f); > } > + s->ccw_fmt_1 =3D qemu_get_byte(f); > return 0; > } > =20 Same load/save issue here as in 3/3. Regards, Andreas > diff --git a/hw/s390x/css.h b/hw/s390x/css.h > index c864ea7..384a455 100644 > --- a/hw/s390x/css.h > +++ b/hw/s390x/css.h > @@ -76,6 +76,7 @@ struct SubchDev { > hwaddr channel_prog; > CCW1 last_cmd; > bool last_cmd_valid; > + bool ccw_fmt_1; > bool thinint_active; > /* transport-provided data: */ > int (*ccw_cb) (SubchDev *, CCW1); > diff --git a/target-s390x/ioinst.h b/target-s390x/ioinst.h > index 5bbc67d..29f6423 100644 > --- a/target-s390x/ioinst.h > +++ b/target-s390x/ioinst.h > @@ -156,6 +156,16 @@ typedef struct ORB { > #define ORB_CTRL1_MASK_ORBX 0x01 > #define ORB_CTRL1_MASK_INVALID 0x3e > =20 > +/* channel command word (type 0) */ > +typedef struct CCW0 { > + uint8_t cmd_code; > + uint8_t cda0; > + uint16_t cda1; > + uint8_t flags; > + uint8_t reserved; > + uint16_t count; > +} QEMU_PACKED CCW0; > + > /* channel command word (type 1) */ > typedef struct CCW1 { > uint8_t cmd_code; >=20 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg