qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: qemu-devel Developers <qemu-devel@nongnu.org>
Cc: borntraeger@de.ibm.com, aliguori@us.ibm.com
Subject: [Qemu-devel] [PULL 2/3] s390/ipl: Fix boot order
Date: Mon, 29 Jul 2013 12:05:23 +0200	[thread overview]
Message-ID: <1375092324-23943-3-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1375092324-23943-1-git-send-email-agraf@suse.de>

From: Christian Borntraeger <borntraeger@de.ibm.com>

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>
---
 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 = 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;
+            }
         }
     }
 
-- 
1.6.0.2

  parent reply	other threads:[~2013-07-29 10:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-29 10:05 [Qemu-devel] [PULL 0/3] s390 patch queue 2013-07-29 Alexander Graf
2013-07-29 10:05 ` [Qemu-devel] [PULL 1/3] s390/IPL: Allow boot from other ssid than 0 Alexander Graf
2013-07-29 10:05 ` Alexander Graf [this message]
2013-07-29 10:05 ` [Qemu-devel] [PULL 3/3] s390: update s390-ccw.img Alexander Graf
2013-07-29 14:00 ` [Qemu-devel] [PULL 0/8] s390 patch queue part 2 Christian Borntraeger
2013-07-29 14:00   ` [Qemu-devel] [PATCH 1/8] s390/sclpconsole: handle char layer busy conditions Christian Borntraeger
2013-07-29 14:00   ` [Qemu-devel] [PATCH 2/8] s390x/ioinst: Add missing alignment checks for IO instructions Christian Borntraeger
2013-07-29 14:00   ` [Qemu-devel] [PATCH 3/8] s390x/ioinst: Throw addressing exception when memory_map failed Christian Borntraeger
2013-07-29 14:00   ` [Qemu-devel] [PATCH 4/8] s390x/ioinst: Fixed alignment check in SCHM instruction Christian Borntraeger
2013-07-29 14:00   ` [Qemu-devel] [PATCH 5/8] s390x/ioinst: Fixed priority of operand exceptions Christian Borntraeger
2013-07-29 14:00   ` [Qemu-devel] [PATCH 6/8] s390x/kvm: Reworked/fixed handling of cc3 in kvm_handle_css_inst() Christian Borntraeger
2013-07-29 14:00   ` [Qemu-devel] [PATCH 7/8] s390x/kvm: Remove redundant return code Christian Borntraeger
2013-07-29 14:00   ` [Qemu-devel] [PATCH 8/8] s390: Implement dump-guest-memory support for target s390x Christian Borntraeger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1375092324-23943-3-git-send-email-agraf@suse.de \
    --to=agraf@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).