qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 1/2] s390/ipl: Fix boot order


From: Christian Borntraeger
Subject: [Qemu-devel] [PATCH 1/2] s390/ipl: Fix boot order
Date: Mon, 17 Jun 2013 14:29:41 +0200

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 <address@hidden>
CC: address@hidden
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]