From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38886) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uov9Z-0002ux-PB for qemu-devel@nongnu.org; Tue, 18 Jun 2013 08:36:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uov9T-0002ks-Pm for qemu-devel@nongnu.org; Tue, 18 Jun 2013 08:36:53 -0400 Message-ID: <51C0545D.3070101@suse.de> Date: Tue, 18 Jun 2013 14:36:45 +0200 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1371547326-40342-1-git-send-email-borntraeger@de.ibm.com> <1371558712-43580-1-git-send-email-borntraeger@de.ibm.com> In-Reply-To: <1371558712-43580-1-git-send-email-borntraeger@de.ibm.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v3] s390/ipl: Fix boot order List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christian Borntraeger Cc: qemu-stable@nongnu.org, qemu-devel , Dominik Dingel , Alexander Graf , Anthony Liguori , =?ISO-8859-15?Q?KONRAD_Fr=E9d=E9ric?= Am 18.06.2013 14:31, schrieb Christian Borntraeger: > The latest ipl code adaptions collided with some of the virtio > refactoring rework. This resulted in always booting the first > disk. Let's fix booting from a given ID. > The new code also checks for command lines without bootindex to > avoid random behaviour when accessing dev_st (=3D=3D0). >=20 > Signed-off-by: Christian Borntraeger > CC: qemu-stable@nongnu.org > --- > Changelog: >=20 > Version 2: Review feedback from Andreas Faerber > Version 3: use object_dynamic_cast to avoid crashes with !ccw Reviewed-by: Andreas F=E4rber Thanks a lot, Andreas >=20 > hw/s390x/ipl.c | 22 ++++++++++++---------- > 1 file changed, 12 insertions(+), 10 deletions(-) >=20 > diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c > index 0aeb003..d69adb2 100644 > --- a/hw/s390x/ipl.c > +++ b/hw/s390x/ipl.c > @@ -154,17 +154,19 @@ static void s390_ipl_reset(DeviceState *dev) > env->psw.mask =3D IPL_PSW_MASK; > =20 > if (!ipl->kernel) { > - /* booting firmware, tell what device to boot from */ > + /* Tell firmware, if there is a preferred boot device */ > + env->regs[7] =3D -1; > DeviceState *dev_st =3D get_boot_device(0); > - VirtioCcwDevice *ccw_dev =3D (VirtioCcwDevice *) object_dynami= c_cast( > - OBJECT(&(dev_st->parent_obj)), "virtio-blk-ccw"); > - > - if (ccw_dev) { > - env->regs[7] =3D ccw_dev->sch->cssid << 24 | > - ccw_dev->sch->ssid << 16 | > - ccw_dev->sch->devno; > - } else { > - env->regs[7] =3D -1; > + if (dev_st) { > + VirtioCcwDevice *ccw_dev =3D (VirtioCcwDevice *) object_dy= namic_cast( > + OBJECT(qdev_get_parent_bus(dev_st)->parent), > + TYPE_VIRTIO_CCW_DEVICE); > + > + if (ccw_dev) { > + env->regs[7] =3D ccw_dev->sch->cssid << 24 | > + ccw_dev->sch->ssid << 16 | > + ccw_dev->sch->devno; > + } > } > } > =20 >=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