From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41804) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UoYZ0-0008Hu-J5 for qemu-devel@nongnu.org; Mon, 17 Jun 2013 08:29:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UoYYv-0003h6-SW for qemu-devel@nongnu.org; Mon, 17 Jun 2013 08:29:38 -0400 Received: from e06smtp13.uk.ibm.com ([195.75.94.109]:59485) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UoYYv-0003gj-JI for qemu-devel@nongnu.org; Mon, 17 Jun 2013 08:29:33 -0400 Received: from /spool/local by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 17 Jun 2013 13:25:34 +0100 From: Christian Borntraeger Date: Mon, 17 Jun 2013 14:29:41 +0200 Message-Id: <1371472182-10074-2-git-send-email-borntraeger@de.ibm.com> In-Reply-To: <1371472182-10074-1-git-send-email-borntraeger@de.ibm.com> References: <1371472182-10074-1-git-send-email-borntraeger@de.ibm.com> Subject: [Qemu-devel] [PATCH 1/2] s390/ipl: Fix boot order List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: Christian Borntraeger , qemu-stable@nongnu.org, =?UTF-8?q?Andreas=20F=C3=A4rber?= , Dominik Dingel , qemu-devel The latest ipl code adoptions collided with some of the virtio refactoring rework. This resulted in always booting the first disk. Lets fix booting from a given ID. The new code also checks for command lines without bootindex to avoid random behaviour when accessing dev_st (==0). Signed-off-by: Christian Borntraeger CC: qemu-stable@nongnu.org --- hw/s390x/ipl.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c index 0aeb003..8b25b1c 100644 --- a/hw/s390x/ipl.c +++ b/hw/s390x/ipl.c @@ -156,13 +156,15 @@ static void s390_ipl_reset(DeviceState *dev) if (!ipl->kernel) { /* booting firmware, tell what device to boot from */ DeviceState *dev_st = get_boot_device(0); - VirtioCcwDevice *ccw_dev = (VirtioCcwDevice *) object_dynamic_cast( - OBJECT(&(dev_st->parent_obj)), "virtio-blk-ccw"); - - if (ccw_dev) { - env->regs[7] = ccw_dev->sch->cssid << 24 | - ccw_dev->sch->ssid << 16 | - ccw_dev->sch->devno; + if (dev_st) { + VirtioCcwDevice *ccw_dev = (VirtioCcwDevice *) object_dynamic_cast( + OBJECT((dev_st->parent_obj.parent)), "virtio-blk-ccw"); + + if (ccw_dev) { + env->regs[7] = ccw_dev->sch->cssid << 24 | + ccw_dev->sch->ssid << 16 | + ccw_dev->sch->devno; + } } else { env->regs[7] = -1; } -- 1.8.1.4