* [Qemu-devel] [PATCH] pseries: Fix loading of little endian kernels
@ 2013-09-25 7:40 Anton Blanchard
2013-09-25 12:38 ` Alexander Graf
0 siblings, 1 reply; 2+ messages in thread
From: Anton Blanchard @ 2013-09-25 7:40 UTC (permalink / raw)
To: agraf; +Cc: qemu-ppc, qemu-devel
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Try loading the kernel as little endian if it fails big endian.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: Anton Blanchard <anton@samba.org>
---
Index: b/hw/ppc/spapr.c
===================================================================
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -273,6 +273,7 @@ static void *spapr_create_fdt_skel(const
hwaddr initrd_base,
hwaddr initrd_size,
hwaddr kernel_size,
+ bool little_endian,
const char *boot_device,
const char *kernel_cmdline,
uint32_t epow_irq)
@@ -326,6 +327,9 @@ static void *spapr_create_fdt_skel(const
cpu_to_be64(kernel_size) };
_FDT((fdt_property(fdt, "qemu,boot-kernel", &kprop, sizeof(kprop))));
+ if (little_endian) {
+ _FDT((fdt_property(fdt, "qemu,boot-kernel-le", NULL, 0)));
+ }
}
if (boot_device) {
_FDT((fdt_property_string(fdt, "qemu,boot-device", boot_device)));
@@ -1102,6 +1106,7 @@ static void ppc_spapr_init(QEMUMachineIn
uint32_t initrd_base = 0;
long kernel_size = 0, initrd_size = 0;
long load_limit, rtas_limit, fw_size;
+ bool kernel_le = false;
char *filename;
msi_supported = true;
@@ -1282,6 +1287,12 @@ static void ppc_spapr_init(QEMUMachineIn
kernel_size = load_elf(kernel_filename, translate_kernel_address, NULL,
NULL, &lowaddr, NULL, 1, ELF_MACHINE, 0);
if (kernel_size < 0) {
+ kernel_size = load_elf(kernel_filename,
+ translate_kernel_address, NULL,
+ NULL, &lowaddr, NULL, 0, ELF_MACHINE, 0);
+ kernel_le = kernel_size > 0;
+ }
+ if (kernel_size < 0) {
kernel_size = load_image_targphys(kernel_filename,
KERNEL_LOAD_ADDR,
load_limit - KERNEL_LOAD_ADDR);
@@ -1331,7 +1342,7 @@ static void ppc_spapr_init(QEMUMachineIn
/* Prepare the device tree */
spapr->fdt_skel = spapr_create_fdt_skel(cpu_model,
initrd_base, initrd_size,
- kernel_size,
+ kernel_size, kernel_le,
boot_device, kernel_cmdline,
spapr->epow_irq);
assert(spapr->fdt_skel != NULL);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] pseries: Fix loading of little endian kernels
2013-09-25 7:40 [Qemu-devel] [PATCH] pseries: Fix loading of little endian kernels Anton Blanchard
@ 2013-09-25 12:38 ` Alexander Graf
0 siblings, 0 replies; 2+ messages in thread
From: Alexander Graf @ 2013-09-25 12:38 UTC (permalink / raw)
To: Anton Blanchard; +Cc: qemu-ppc, qemu-devel
On 25.09.2013, at 09:40, Anton Blanchard wrote:
> From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>
> Try loading the kernel as little endian if it fails big endian.
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Reviewed-by: Anton Blanchard <anton@samba.org>
Thanks, applied to ppc-next.
Alex
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-09-25 12:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-25 7:40 [Qemu-devel] [PATCH] pseries: Fix loading of little endian kernels Anton Blanchard
2013-09-25 12:38 ` Alexander Graf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).