From patchwork Mon Nov 30 18:15:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?C=C3=A9dric_Le_Goater?= X-Patchwork-Id: 550272 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 724041401CD for ; Tue, 1 Dec 2015 05:16:30 +1100 (AEDT) Received: from localhost ([::1]:42622 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3T00-000477-IG for incoming@patchwork.ozlabs.org; Mon, 30 Nov 2015 13:16:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48591) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3Szi-0003lm-1y for qemu-devel@nongnu.org; Mon, 30 Nov 2015 13:16:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a3Sze-0004iD-Pw for qemu-devel@nongnu.org; Mon, 30 Nov 2015 13:16:09 -0500 Received: from e06smtp09.uk.ibm.com ([195.75.94.105]:56145) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3Sze-0004hM-Ge for qemu-devel@nongnu.org; Mon, 30 Nov 2015 13:16:06 -0500 Received: from localhost by e06smtp09.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 30 Nov 2015 18:16:03 -0000 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp09.uk.ibm.com (192.168.101.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 30 Nov 2015 18:16:02 -0000 X-IBM-Helo: d06dlp03.portsmouth.uk.ibm.com X-IBM-MailFrom: clg@fr.ibm.com X-IBM-RcptTo: qemu-devel@nongnu.org;qemu-ppc@nongnu.org Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id CA9551B0805F; Mon, 30 Nov 2015 18:16:26 +0000 (GMT) Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id tAUIG1pF3539250; Mon, 30 Nov 2015 18:16:01 GMT Received: from d06av02.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id tAUIG1cY001003; Mon, 30 Nov 2015 11:16:01 -0700 Received: from smtp.lab.toulouse-stg.fr.ibm.com (srv01.lab.toulouse-stg.fr.ibm.com [9.101.4.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id tAUIG0v3000999; Mon, 30 Nov 2015 11:16:00 -0700 Received: from [9.101.4.42] (hermes.lab.toulouse-stg.fr.ibm.com [9.101.4.42]) by smtp.lab.toulouse-stg.fr.ibm.com (Postfix) with ESMTP id 5F5C4220553; Mon, 30 Nov 2015 19:16:00 +0100 (CET) Message-ID: <565C925F.60306@fr.ibm.com> Date: Mon, 30 Nov 2015 19:15:59 +0100 From: =?UTF-8?B?Q8OpZHJpYyBMZSBHb2F0ZXI=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.8.0 MIME-Version: 1.0 To: Benjamin Herrenschmidt , Alexander Graf , Alexey Kardashevskiy , Eric Blake , qemu-ppc@nongnu.org References: <1447201710-10229-1-git-send-email-benh@kernel.crashing.org> <564290E1.3090205@redhat.com> <1447203387.31884.126.camel@kernel.crashing.org> <5642B59E.2070101@ozlabs.ru> <1447213139.31884.136.camel@kernel.crashing.org> <5642BEF9.90406@ozlabs.ru> <1447215397.31884.140.camel@kernel.crashing.org> <5642C6F0.9040200@ozlabs.ru> <56582EAF.40103@suse.de> <1448697599.3172.1.camel@kernel.crashing.org> In-Reply-To: <1448697599.3172.1.camel@kernel.crashing.org> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15113018-0037-0000-0000-000004CF5BB5 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.75.94.105 Cc: qemu-devel@nongnu.org Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH 00/77] ppc: Add "native" POWER8 platform 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 On 11/28/2015 08:59 AM, Benjamin Herrenschmidt wrote: > On Fri, 2015-11-27 at 11:21 +0100, Alexander Graf wrote: >> >> How does real hardware store petitboot? If it's flash, you could pass it >> in using -pflash and thus model things even more closely and allow users >> to just take the ROM image as is. > > It is a flash image, we could use an Open Power machine flash image "as-is" > provided we taught qemu to extract skiboot (aka OPAL) from it. Couldn't we add an offset argument to load_image_targphys() or make that an extra routine ? If so, we could then load directly from an openpower pnor file. I gave it a quick (and dirty) try and a powernv guest runs fine up to petitboot with just : qemu-system-ppc64 -m 2G -M powernv -bios ~/work/open-power/images/palmetto.pnor -nographic -nodefaults -serial stdio The pnor file is compiled from github. The patch is below (without the dirty cut and paste I did in loader.c). The offset for the PAYLOAD and BOOTKERNEL partitions are hard coded but I guess we don't need to read the flash partition table in qemu, not yet. Cheers, C. Index: qemu-powernv.git/hw/ppc/pnv.c =================================================================== --- qemu-powernv.git.orig/hw/ppc/pnv.c +++ qemu-powernv.git/hw/ppc/pnv.c @@ -69,7 +69,7 @@ #define FDT_ADDR 0x01000000 #define FDT_MAX_SIZE 0x00100000 -#define FW_MAX_SIZE 0x00400000 +#define FW_MAX_SIZE 0x04000000 #define FW_FILE_NAME "skiboot.lid" #define KERNEL_FILE_NAME "skiroot.lid" #define KERNEL_LOAD_ADDR 0x20000000 @@ -902,7 +902,9 @@ static void ppc_powernv_init(MachineStat { ram_addr_t ram_size = machine->ram_size; const char *cpu_model = machine->cpu_model; +#if 0 const char *kernel_filename = machine->kernel_filename; +#endif const char *initrd_filename = machine->initrd_filename; uint32_t initrd_base = 0; long initrd_size = 0; @@ -998,19 +1000,20 @@ static void ppc_powernv_init(MachineStat bios_name = FW_FILE_NAME; } filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); - fw_size = load_image_targphys(filename, 0, FW_MAX_SIZE); + fw_size = load_image_targphys_offset(filename, 0, FW_MAX_SIZE, 0x961000); if (fw_size < 0) { hw_error("qemu: could not load OPAL '%s'\n", filename); exit(1); } +#if 0 g_free(filename); if (kernel_filename == NULL) { kernel_filename = KERNEL_FILE_NAME; } filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, kernel_filename); - fw_size = load_image_targphys(filename, 0x20000000, 0x2000000); +#endif + fw_size = load_image_targphys_offset(filename, 0x20000000, 0x2000000, 0xa61000); if (fw_size < 0) { hw_error("qemu: could not load kernel'%s'\n", filename); exit(1);