qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [Qemu-ppc] [PATCH 00/77] ppc: Add "native" POWER8 platf


From: Cédric Le Goater
Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH 00/77] ppc: Add "native" POWER8 platform
Date: Mon, 30 Nov 2015 19:15:59 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.8.0

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);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]