From patchwork Fri Apr 26 12:12:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dominik Dingel X-Patchwork-Id: 239833 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id DF1062C00F0 for ; Fri, 26 Apr 2013 22:13:42 +1000 (EST) Received: from localhost ([::1]:36970 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVhX3-0003Ho-03 for incoming@patchwork.ozlabs.org; Fri, 26 Apr 2013 08:13:41 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58410) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVhWX-0003Fz-WF for qemu-devel@nongnu.org; Fri, 26 Apr 2013 08:13:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UVhWV-0002Do-7f for qemu-devel@nongnu.org; Fri, 26 Apr 2013 08:13:09 -0400 Received: from e06smtp14.uk.ibm.com ([195.75.94.110]:49256) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVhWU-0002D3-Vo for qemu-devel@nongnu.org; Fri, 26 Apr 2013 08:13:07 -0400 Received: from /spool/local by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 26 Apr 2013 13:07:48 +0100 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 26 Apr 2013 13:07:46 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id AB7AB1B08072 for ; Fri, 26 Apr 2013 13:13:02 +0100 (BST) Received: from d06av09.portsmouth.uk.ibm.com (d06av09.portsmouth.uk.ibm.com [9.149.37.250]) by b06cxnps4076.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r3QCCqhb35127340 for ; Fri, 26 Apr 2013 12:12:52 GMT Received: from d06av09.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r3QCD1Ie028911 for ; Fri, 26 Apr 2013 06:13:02 -0600 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r3QCD1tN028908; Fri, 26 Apr 2013 06:13:01 -0600 Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 2944) id C7CCD122442E; Fri, 26 Apr 2013 14:13:01 +0200 (CEST) From: Dominik Dingel To: qemu-devel@nongnu.org Date: Fri, 26 Apr 2013 14:12:50 +0200 Message-Id: <1366978377-16823-4-git-send-email-dingel@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1366978377-16823-1-git-send-email-dingel@linux.vnet.ibm.com> References: <1366978377-16823-1-git-send-email-dingel@linux.vnet.ibm.com> X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13042612-1948-0000-0000-000004FBC25D X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 195.75.94.110 Cc: Christian Paro , Christian Borntraeger , Alexander Graf , Dominik Dingel Subject: [Qemu-devel] [PATCH 03/10] S390: Check Bootdevice Type X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Check for a kernel IPL entry and load kernel image if one was specified. If no kernel image was supplied and the first boot device is not a virtio-ccw-blk device, print error message and exit. In case it is a virtio-ccw-blk device store the dev_no in reg[7] Signed-off-by: Christian Paro Signed-off-by: Dominik Dingel diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c index ace5ff5..9758529 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 @@ -56,14 +58,25 @@ typedef struct S390IPLState { char *firmware; } S390IPLState; +static void s390_ipl_kernel(uint64_t pswaddr) +{ + S390CPU *cpu = S390_CPU(qemu_get_cpu(0)); + CPUS390XState *env = &cpu->env; + + env->psw.addr = pswaddr; + env->psw.mask = IPL_PSW_MASK; + s390_add_running_cpu(cpu); +} -static void s390_ipl_cpu(uint64_t pswaddr) +static void s390_ipl_from_disk(VirtIOBlkCcw *dev, uint64_t pswaddr) { S390CPU *cpu = S390_CPU(qemu_get_cpu(0)); CPUS390XState *env = &cpu->env; + VirtioCcwDevice *ccw_dev = &(dev->parent_obj); env->psw.addr = pswaddr; env->psw.mask = IPL_PSW_MASK; + env->regs[7] = ccw_dev->sch->devno; s390_add_running_cpu(cpu); } @@ -152,7 +165,18 @@ static void s390_ipl_reset(DeviceState *dev) { S390IPLState *ipl = S390_IPL(dev); - s390_ipl_cpu(ipl->start_addr); + if (ipl->kernel) { + return s390_ipl_kernel(ipl->start_addr); + } + + DeviceState *boot_device = get_boot_device(0); + if (object_dynamic_cast(OBJECT(boot_device), TYPE_VIRTIO_BLK) != NULL) { + s390_ipl_from_disk(VIRTIO_BLK_CCW(boot_device->parent_obj.parent), + ipl->start_addr); + } else { + fprintf(stderr, "qemu: s390x only supports boot from virtio-ccw-blk\n"); + exit(1); + } } static void s390_ipl_class_init(ObjectClass *klass, void *data)