From patchwork Tue Apr 20 17:11:43 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 50552 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CE702B7D0B for ; Wed, 21 Apr 2010 03:15:40 +1000 (EST) Received: from localhost ([127.0.0.1]:43886 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O4H2u-0005G4-JV for incoming@patchwork.ozlabs.org; Tue, 20 Apr 2010 13:15:36 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O4GzO-00040T-0J for qemu-devel@nongnu.org; Tue, 20 Apr 2010 13:11:58 -0400 Received: from [140.186.70.92] (port=50740 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O4GzH-0003wH-I5 for qemu-devel@nongnu.org; Tue, 20 Apr 2010 13:11:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O4GzB-0000bb-LE for qemu-devel@nongnu.org; Tue, 20 Apr 2010 13:11:51 -0400 Received: from cantor.suse.de ([195.135.220.2]:54784 helo=mx1.suse.de) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O4GzB-0000ap-AB for qemu-devel@nongnu.org; Tue, 20 Apr 2010 13:11:45 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id 050AF93F46; Tue, 20 Apr 2010 19:11:44 +0200 (CEST) From: Alexander Graf To: qemu-devel Developers Date: Tue, 20 Apr 2010 19:11:43 +0200 Message-Id: <1271783503-16814-1-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.6.0.2 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 Cc: Bastian Blank , Carsten Otte , Aurelien Jarno Subject: [Qemu-devel] [PATCH] [S390] Add firmware code X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This patch adds a firmware blob to the S390 target. The blob is a simple implementation of a virtio client that tries to read the second stage bootloader from sectors described as of offset 0x20 in the MBR. In combination with an updated zipl this allows for booting from virtio block devices. This firmware is built from the same sources as the second stage bootloader. You can find a virtio capable s390-tools in this repo: git://repo.or.cz/s390-tools.git Signed-off-by: Alexander Graf --- v1 -> v2: - Update bootloader code to support booting from non-virtio aware zipl disks. Now you don't need to modify zipl in the guest anymore just to boot. - Add safety checks - Add documentation on where to find the sources - Make bios optional v2 -> v3: - Add brackets --- hw/s390-virtio.c | 26 ++++++++++++++++++++++++++ pc-bios/README | 5 +++++ pc-bios/s390-zipl.rom | Bin 0 -> 3344 bytes 3 files changed, 31 insertions(+), 0 deletions(-) create mode 100755 pc-bios/s390-zipl.rom diff --git a/pc-bios/s390-zipl.rom b/pc-bios/s390-zipl.rom new file mode 100755 index 0000000000000000000000000000000000000000..915995087824864cfa362176886e94c4473d8c6f GIT binary patch literal 3344 zcmZuzdvH|M8UOC?hP%xJ4gtdQD4v7`l7hGiv0$LMH$WPE;37(cwKWR~A(EFNp#nu# zjrGx5msD)4?YIcxbf7IeIIT_5@%rc=j5CFH8Xolzf_G>;?jK$-r6`Zv-*+|vE!~-W z_nhy3&)@erM_t@PYRLbQ*=nFYQ3JN$; zNmQiDh@6P<(a!#-DcoN~CAATIRHlRsDu`ByK%KAyY!Q?I6{y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g%zI=J4_D2srTOkq~T zL!OxnwA5)mFK4JD@aoM3cu*CG@pTQyz?{g>G-nZ}MK<>7!?E{*o~u3p`bRN8yF3Rs zj{%O?cvZB(cAP&6#D?pVb7&mqUOi4DndD9|mOBg?$E*>&+%({~ z3ANLcJtK@PbtX^m0VjKBLB1iOZN_wcnzjv1%Mj6gNAR}+zxbk#$(lF7)(75Eb;y0K zG3W@kYej^viwH0xvyg8mdu48Y^_n_n?^;Ed19FBm;Wj4d2z<_68sBvABks%hp< zoT8UGqwrV6%K*Q|PcSD-@5!F0Qsxhy-uvyji%Mq~&wS#UXP?{sBlGz)-wA)MY~gor zzQz18SYJr=nR8}5wD@*2$&#koQC~GZI_n!HW_<0shQ{?x8=8N65ae?gAKuu~+ScCj zNasGa)9f|>@z|!W?#&hLWcXqe6F@0-uM+psw.addr = KERN_IMAGE_START; env->psw.mask = 0x0000000180000000ULL; + } else { + ram_addr_t bios_size = 0; + char *bios_filename; + + /* Load zipl bootloader */ + if (bios_name == NULL) { + bios_name = ZIPL_FILENAME; + } + + bios_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); + bios_size = load_image(bios_filename, qemu_get_ram_ptr(ZIPL_LOAD_ADDR)); + + if ((long)bios_size < 0) { + hw_error("could not load bootloader '%s'\n", bios_name); + } + + if (bios_size > 4096) { + hw_error("stage1 bootloader is > 4k\n"); + } + + env->psw.addr = ZIPL_START; + env->psw.mask = 0x0000000180000000ULL; } if (initrd_filename) { diff --git a/pc-bios/README b/pc-bios/README index 437ef1c..be86dde 100644 --- a/pc-bios/README +++ b/pc-bios/README @@ -28,3 +28,8 @@ virtio 1af4:1000 http://rom-o-matic.net/ + +- The S390 zipl loader is an addition to the official IBM s390-tools + package. That fork is maintained in its own git repository at: + git://repo.or.cz/s390-tools.git +