From mboxrd@z Thu Jan 1 00:00:00 1970 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 Message-ID: <565C925F.60306@fr.ibm.com> Date: Mon, 30 Nov 2015 19:15:59 +0100 From: =?UTF-8?B?Q8OpZHJpYyBMZSBHb2F0ZXI=?= MIME-Version: 1.0 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> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH 00/77] ppc: Add "native" POWER8 platform List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Benjamin Herrenschmidt , Alexander Graf , Alexey Kardashevskiy , Eric Blake , qemu-ppc@nongnu.org Cc: qemu-devel@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);