diff options
author | Christian Borntraeger <borntraeger@de.ibm.com> | 2013-06-18 14:31:52 +0200 |
---|---|---|
committer | Michael Roth <mdroth@linux.vnet.ibm.com> | 2013-08-12 15:18:30 -0500 |
commit | 5e2053dd159bf979a266f0a615a5d821a58bd06b (patch) | |
tree | eb9a87e4e6af3b9797a6a92c12c38ae54cb4c5d9 /hw | |
parent | 045ccf7056e1451660231881d37fa37bbe0a3a3c (diff) |
s390/ipl: Fix boot order
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 (==0).
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
(cherry picked from commit 5c8ded6ef55761e80353f42d8e59c6e233a2f51a)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r-- | 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 0aeb003c9d..d69adb2f5b 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 = IPL_PSW_MASK; if (!ipl->kernel) { - /* booting firmware, tell what device to boot from */ + /* Tell firmware, if there is a preferred boot device */ + env->regs[7] = -1; 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; - } else { - env->regs[7] = -1; + if (dev_st) { + VirtioCcwDevice *ccw_dev = (VirtioCcwDevice *) object_dynamic_cast( + OBJECT(qdev_get_parent_bus(dev_st)->parent), + TYPE_VIRTIO_CCW_DEVICE); + + if (ccw_dev) { + env->regs[7] = ccw_dev->sch->cssid << 24 | + ccw_dev->sch->ssid << 16 | + ccw_dev->sch->devno; + } } } |