Received: from eggs.gnu.org ([208.118.235.92]:48740) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWpRJ-0007iw-JR for qemu-devel@nongnu.org; Mon, 29 Apr 2013 10:52:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UWpRA-0002Vn-Np for qemu-devel@nongnu.org; Mon, 29 Apr 2013 10:52:25 -0400 Received: from e06smtp18.uk.ibm.com ([195.75.94.114]:48219) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWpRA-0002TS-GP for qemu-devel@nongnu.org; Mon, 29 Apr 2013 10:52:16 -0400 Received: from /spool/local by e06smtp18.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 29 Apr 2013 15:48:21 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 3C098219005E for ; Mon, 29 Apr 2013 15:54:42 +0100 (BST) Received: from d06av05.portsmouth.uk.ibm.com (d06av05.portsmouth.uk.ibm.com [9.149.37.229]) by b06cxnps3075.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r3TEq25t45940754 for ; Mon, 29 Apr 2013 14:52:02 GMT Received: from d06av05.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r3TEqB6r014535 for ; Mon, 29 Apr 2013 08:52:12 -0600 From: Dominik Dingel Date: Mon, 29 Apr 2013 16:52:04 +0200 Message-Id: <1367247128-22409-2-git-send-email-dingel@linux.vnet.ibm.com> In-Reply-To: <1367247128-22409-1-git-send-email-dingel@linux.vnet.ibm.com> References: <1367247128-22409-1-git-send-email-dingel@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH v2 1/5] S390: Add virtio-blk boot List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Christian Paro , Christian Borntraeger , Alexander Graf , Dominik Dingel Check for a kernel IPL entry and load kernel image if one was specified. If no kernel image was supplied and no boot device was specified or the boot device is not of type virtio-blk-ccw, print an error message and exit. Signed-off-by: Christian Paro Signed-off-by: Dominik Dingel diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c index ace5ff5..bcbba7c 100644 --- a/hw/s390x/ipl.c +++ b/hw/s390x/ipl.c @@ -16,6 +16,8 @@ #include "elf.h" #include "hw/loader.h" #include "hw/sysbus.h" +#include "hw/s390x/virtio-ccw.h" +#include "hw/s390x/css.h" #define KERN_IMAGE_START 0x010000UL #define KERN_PARM_AREA 0x010480UL @@ -57,13 +59,22 @@ typedef struct S390IPLState { } S390IPLState; -static void s390_ipl_cpu(uint64_t pswaddr) +static void s390_ipl_cpu(uint64_t pswaddr, VirtioCcwDevice *dev) { S390CPU *cpu = S390_CPU(qemu_get_cpu(0)); CPUS390XState *env = &cpu->env; env->psw.addr = pswaddr; env->psw.mask = IPL_PSW_MASK; + + if (dev) { + env->regs[7] = dev->sch->cssid << 24 | + dev->sch->ssid << 16 | + dev->sch->devno; + } else { + env->regs[7] = -1; + } + s390_add_running_cpu(cpu); } @@ -151,8 +162,17 @@ static Property s390_ipl_properties[] = { static void s390_ipl_reset(DeviceState *dev) { S390IPLState *ipl = S390_IPL(dev); - - s390_ipl_cpu(ipl->start_addr); + + if (ipl->kernel) { + s390_ipl_cpu(ipl->start_addr, NULL); + } else { + /* is there a bootable device? */ + DeviceState *dev_st = get_boot_device(0); + VirtioCcwDevice *ccw_dev = (VirtioCcwDevice *) object_dynamic_cast( + OBJECT(&(dev_st->parent_obj)), "virtio-blk-ccw"); + + s390_ipl_cpu(ipl->start_addr, ccw_dev); + } } static void s390_ipl_class_init(ObjectClass *klass, void *data) -- 1.7.9.5