From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46997) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V3kKd-0001lE-SY for qemu-devel@nongnu.org; Mon, 29 Jul 2013 06:05:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V3kKX-0002kJ-6o for qemu-devel@nongnu.org; Mon, 29 Jul 2013 06:05:35 -0400 Received: from cantor2.suse.de ([195.135.220.15]:58704 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V3kKX-0002jT-0f for qemu-devel@nongnu.org; Mon, 29 Jul 2013 06:05:29 -0400 From: Alexander Graf Date: Mon, 29 Jul 2013 12:05:23 +0200 Message-Id: <1375092324-23943-3-git-send-email-agraf@suse.de> In-Reply-To: <1375092324-23943-1-git-send-email-agraf@suse.de> References: <1375092324-23943-1-git-send-email-agraf@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 2/3] s390/ipl: Fix boot order List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel Developers Cc: borntraeger@de.ibm.com, aliguori@us.ibm.com From: 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). Signed-off-by: Christian Borntraeger Reviewed-by: Andreas F=C3=A4rber Signed-off-by: Alexander Graf --- hw/s390x/ipl.c | 22 ++++++++++++---------- 1 files changed, 12 insertions(+), 10 deletions(-) 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_dynamic_= 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_dyna= mic_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 1.6.0.2