qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] QEMU: ARM: boot: Load kernel at an Image friendly address
@ 2014-03-25  3:34 Joel Fernandes
  2014-03-25 12:29 ` Christopher Covington
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Joel Fernandes @ 2014-03-25  3:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Joel Fernandes, Linux ARM Kernel List

Loading kernel at offset 0x10000 works only for zImage, but not for Image,
because the kernel expect the start of decompressed kernel (.head.text) to be
at an address that's a distance that's 16MB aligned from  PAGE_OFFSET +
TEXT_OFFSET (see vmlinux.lds.S). This check is enfornced in __fixup_pv_table in
arch/arm/kernel/head.S TEXT_OFFSET is 0x00008000, so a 16MB alignment needs to
have a "0x8000" in the lower 16 bits so that they cancel out. Currently the
offset Qemu loads it at is 0x10000.

With zImage, this need is met because zImage loads the uncompressed Image
correctly, however when loading an Image and executing directly Qemu is
required it to load it at the correct location. Doing so, doesn't break Qemu's
zImage loading. With this patch, both zImage and Image work correctly.

Signed-off-by: Joel Fernandes <joelf@ti.com>
---
 hw/arm/boot.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/arm/boot.c b/hw/arm/boot.c
index dc62918..566b5c2 100644
--- a/hw/arm/boot.c
+++ b/hw/arm/boot.c
@@ -23,7 +23,7 @@
  * They have different preferred image load offsets from system RAM base.
  */
 #define KERNEL_ARGS_ADDR 0x100
-#define KERNEL_LOAD_ADDR 0x00010000
+#define KERNEL_LOAD_ADDR 0x00008000
 #define KERNEL64_LOAD_ADDR 0x00080000
 
 typedef enum {
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PATCH] QEMU: ARM: boot: Load kernel at an Image friendly address
  2014-03-25  3:34 [Qemu-devel] [PATCH] QEMU: ARM: boot: Load kernel at an Image friendly address Joel Fernandes
@ 2014-03-25 12:29 ` Christopher Covington
  2014-03-25 13:43   ` Joel Fernandes
  2014-03-25 13:13 ` Peter Maydell
  2014-04-01 17:10 ` Peter Maydell
  2 siblings, 1 reply; 11+ messages in thread
From: Christopher Covington @ 2014-03-25 12:29 UTC (permalink / raw)
  To: Joel Fernandes; +Cc: qemu-devel, Linux ARM Kernel List

Hi Joel,

On 03/24/2014 11:34 PM, Joel Fernandes wrote:
> Loading kernel at offset 0x10000 works only for zImage, but not for Image,
> because the kernel expect the start of decompressed kernel (.head.text) to be

Nit: expects

> at an address that's a distance that's 16MB aligned from  PAGE_OFFSET +
> TEXT_OFFSET (see vmlinux.lds.S). This check is enfornced in __fixup_pv_table in

Nit: enforced

> arch/arm/kernel/head.S TEXT_OFFSET is 0x00008000, so a 16MB alignment needs to
> have a "0x8000" in the lower 16 bits so that they cancel out. Currently the
> offset Qemu loads it at is 0x10000.
> 
> With zImage, this need is met because zImage loads the uncompressed Image
> correctly, however when loading an Image and executing directly Qemu is
> required it to load it at the correct location. Doing so, doesn't break Qemu's
> zImage loading. With this patch, both zImage and Image work correctly.

I had just been playing with my own version of this change. Glad to see it
going upstream.

Tested-by: Christopher Covington <cov@codeaurora.org>

Thanks,
Christopher

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by the Linux Foundation.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PATCH] QEMU: ARM: boot: Load kernel at an Image friendly address
  2014-03-25  3:34 [Qemu-devel] [PATCH] QEMU: ARM: boot: Load kernel at an Image friendly address Joel Fernandes
  2014-03-25 12:29 ` Christopher Covington
@ 2014-03-25 13:13 ` Peter Maydell
  2014-03-25 13:46   ` Joel Fernandes
  2014-04-01 17:10 ` Peter Maydell
  2 siblings, 1 reply; 11+ messages in thread
From: Peter Maydell @ 2014-03-25 13:13 UTC (permalink / raw)
  To: Joel Fernandes; +Cc: QEMU Developers, Linux ARM Kernel List

On 25 March 2014 03:34, Joel Fernandes <joelf@ti.com> wrote:
> Loading kernel at offset 0x10000 works only for zImage, but not for Image,
> because the kernel expect the start of decompressed kernel (.head.text) to be
> at an address that's a distance that's 16MB aligned from  PAGE_OFFSET +
> TEXT_OFFSET (see vmlinux.lds.S). This check is enfornced in __fixup_pv_table in
> arch/arm/kernel/head.S TEXT_OFFSET is 0x00008000, so a 16MB alignment needs to
> have a "0x8000" in the lower 16 bits so that they cancel out. Currently the
> offset Qemu loads it at is 0x10000.
>
> With zImage, this need is met because zImage loads the uncompressed Image
> correctly, however when loading an Image and executing directly Qemu is
> required it to load it at the correct location. Doing so, doesn't break Qemu's
> zImage loading. With this patch, both zImage and Image work correctly.
>
> Signed-off-by: Joel Fernandes <joelf@ti.com>
> ---
>  hw/arm/boot.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/arm/boot.c b/hw/arm/boot.c
> index dc62918..566b5c2 100644
> --- a/hw/arm/boot.c
> +++ b/hw/arm/boot.c
> @@ -23,7 +23,7 @@
>   * They have different preferred image load offsets from system RAM base.
>   */
>  #define KERNEL_ARGS_ADDR 0x100
> -#define KERNEL_LOAD_ADDR 0x00010000
> +#define KERNEL_LOAD_ADDR 0x00008000
>  #define KERNEL64_LOAD_ADDR 0x00080000

The patch and rationale seem plausible, but I'm a bit
reluctant to apply this this close to 2.0 release, because
QEMU has loaded images at this address for 8 years without
anybody complaining, and I worry that we might accidentally
break some other use case somehow.

thanks
-- PMM

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PATCH] QEMU: ARM: boot: Load kernel at an Image friendly address
  2014-03-25 12:29 ` Christopher Covington
@ 2014-03-25 13:43   ` Joel Fernandes
  0 siblings, 0 replies; 11+ messages in thread
From: Joel Fernandes @ 2014-03-25 13:43 UTC (permalink / raw)
  To: Christopher Covington; +Cc: Joel Fernandes, qemu-devel, Linux ARM Kernel List

On Tue, Mar 25, 2014 at 7:29 AM, Christopher Covington
<cov@codeaurora.org> wrote:
> Hi Joel,
>
> On 03/24/2014 11:34 PM, Joel Fernandes wrote:
>> Loading kernel at offset 0x10000 works only for zImage, but not for Image,
>> because the kernel expect the start of decompressed kernel (.head.text) to be
>
> Nit: expects
>
>> at an address that's a distance that's 16MB aligned from  PAGE_OFFSET +
>> TEXT_OFFSET (see vmlinux.lds.S). This check is enfornced in __fixup_pv_table in
>
> Nit: enforced
>
>> arch/arm/kernel/head.S TEXT_OFFSET is 0x00008000, so a 16MB alignment needs to
>> have a "0x8000" in the lower 16 bits so that they cancel out. Currently the
>> offset Qemu loads it at is 0x10000.
>>
>> With zImage, this need is met because zImage loads the uncompressed Image
>> correctly, however when loading an Image and executing directly Qemu is
>> required it to load it at the correct location. Doing so, doesn't break Qemu's
>> zImage loading. With this patch, both zImage and Image work correctly.
>
> I had just been playing with my own version of this change. Glad to see it
> going upstream.
>
> Tested-by: Christopher Covington <cov@codeaurora.org>
>

Thanks, I updated the patch with these changes.

-Joel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PATCH] QEMU: ARM: boot: Load kernel at an Image friendly address
  2014-03-25 13:13 ` Peter Maydell
@ 2014-03-25 13:46   ` Joel Fernandes
  0 siblings, 0 replies; 11+ messages in thread
From: Joel Fernandes @ 2014-03-25 13:46 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Developers, Linux ARM Kernel List

On 03/25/2014 08:13 AM, Peter Maydell wrote:
> On 25 March 2014 03:34, Joel Fernandes <joelf@ti.com> wrote:
>> Loading kernel at offset 0x10000 works only for zImage, but not for Image,
>> because the kernel expect the start of decompressed kernel (.head.text) to be
>> at an address that's a distance that's 16MB aligned from  PAGE_OFFSET +
>> TEXT_OFFSET (see vmlinux.lds.S). This check is enfornced in __fixup_pv_table in
>> arch/arm/kernel/head.S TEXT_OFFSET is 0x00008000, so a 16MB alignment needs to
>> have a "0x8000" in the lower 16 bits so that they cancel out. Currently the
>> offset Qemu loads it at is 0x10000.
>>
>> With zImage, this need is met because zImage loads the uncompressed Image
>> correctly, however when loading an Image and executing directly Qemu is
>> required it to load it at the correct location. Doing so, doesn't break Qemu's
>> zImage loading. With this patch, both zImage and Image work correctly.
>>
>> Signed-off-by: Joel Fernandes <joelf@ti.com>
>> ---
>>  hw/arm/boot.c |    2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/hw/arm/boot.c b/hw/arm/boot.c
>> index dc62918..566b5c2 100644
>> --- a/hw/arm/boot.c
>> +++ b/hw/arm/boot.c
>> @@ -23,7 +23,7 @@
>>   * They have different preferred image load offsets from system RAM base.
>>   */
>>  #define KERNEL_ARGS_ADDR 0x100
>> -#define KERNEL_LOAD_ADDR 0x00010000
>> +#define KERNEL_LOAD_ADDR 0x00008000
>>  #define KERNEL64_LOAD_ADDR 0x00080000
> 
> The patch and rationale seem plausible, but I'm a bit
> reluctant to apply this this close to 2.0 release, because
> QEMU has loaded images at this address for 8 years without
> anybody complaining, and I worry that we might accidentally
> break some other use case somehow.

I understand.
FWIW, I also tested with a15-vexpress and zImage.

thanks,

-Joel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PATCH] QEMU: ARM: boot: Load kernel at an Image friendly address
  2014-03-25  3:34 [Qemu-devel] [PATCH] QEMU: ARM: boot: Load kernel at an Image friendly address Joel Fernandes
  2014-03-25 12:29 ` Christopher Covington
  2014-03-25 13:13 ` Peter Maydell
@ 2014-04-01 17:10 ` Peter Maydell
  2014-04-02 12:11   ` Peter Crosthwaite
  2 siblings, 1 reply; 11+ messages in thread
From: Peter Maydell @ 2014-04-01 17:10 UTC (permalink / raw)
  To: Joel Fernandes; +Cc: QEMU Developers, Linux ARM Kernel List

On 25 March 2014 03:34, Joel Fernandes <joelf@ti.com> wrote:
> Loading kernel at offset 0x10000 works only for zImage, but not for Image,
> because the kernel expect the start of decompressed kernel (.head.text) to be
> at an address that's a distance that's 16MB aligned from  PAGE_OFFSET +
> TEXT_OFFSET (see vmlinux.lds.S). This check is enfornced in __fixup_pv_table in
> arch/arm/kernel/head.S TEXT_OFFSET is 0x00008000, so a 16MB alignment needs to
> have a "0x8000" in the lower 16 bits so that they cancel out. Currently the
> offset Qemu loads it at is 0x10000.
>
> With zImage, this need is met because zImage loads the uncompressed Image
> correctly, however when loading an Image and executing directly Qemu is
> required it to load it at the correct location. Doing so, doesn't break Qemu's
> zImage loading. With this patch, both zImage and Image work correctly.
>
> Signed-off-by: Joel Fernandes <joelf@ti.com>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

I'll put this in target-arm.next after 2.0 has released.

thanks
-- PMM

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PATCH] QEMU: ARM: boot: Load kernel at an Image friendly address
  2014-04-01 17:10 ` Peter Maydell
@ 2014-04-02 12:11   ` Peter Crosthwaite
  2014-04-02 12:47     ` Peter Maydell
  0 siblings, 1 reply; 11+ messages in thread
From: Peter Crosthwaite @ 2014-04-02 12:11 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Joel Fernandes, QEMU Developers, Linux ARM Kernel List

On Wed, Apr 2, 2014 at 3:10 AM, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 25 March 2014 03:34, Joel Fernandes <joelf@ti.com> wrote:
>> Loading kernel at offset 0x10000 works only for zImage, but not for Image,
>> because the kernel expect the start of decompressed kernel (.head.text) to be
>> at an address that's a distance that's 16MB aligned from  PAGE_OFFSET +
>> TEXT_OFFSET (see vmlinux.lds.S). This check is enfornced in __fixup_pv_table in
>> arch/arm/kernel/head.S TEXT_OFFSET is 0x00008000, so a 16MB alignment needs to
>> have a "0x8000" in the lower 16 bits so that they cancel out. Currently the
>> offset Qemu loads it at is 0x10000.
>>
>> With zImage, this need is met because zImage loads the uncompressed Image
>> correctly, however when loading an Image and executing directly Qemu is
>> required it to load it at the correct location. Doing so, doesn't break Qemu's
>> zImage loading. With this patch, both zImage and Image work correctly.
>>
>> Signed-off-by: Joel Fernandes <joelf@ti.com>
>
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
>

Like others, I have been carrying this change locally. Good to see it up!

Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Tested-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

> I'll put this in target-arm.next after 2.0 has released.
>
> thanks
> -- PMM
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PATCH] QEMU: ARM: boot: Load kernel at an Image friendly address
  2014-04-02 12:11   ` Peter Crosthwaite
@ 2014-04-02 12:47     ` Peter Maydell
  2014-04-02 12:58       ` Peter Crosthwaite
                         ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Peter Maydell @ 2014-04-02 12:47 UTC (permalink / raw)
  To: Peter Crosthwaite; +Cc: Joel Fernandes, QEMU Developers, Linux ARM Kernel List

On 2 April 2014 13:11, Peter Crosthwaite <peter.crosthwaite@xilinx.com> wrote:
> Like others, I have been carrying this change locally. Good to see it up!

Why are you all booting raw Images anyway (just out of curiosity)? All my
test cases boot either a zImage or a uImage, or occasionally a full SD card
image, or I'd have noticed this earlier...

thanks
-- PMM

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PATCH] QEMU: ARM: boot: Load kernel at an Image friendly address
  2014-04-02 12:47     ` Peter Maydell
@ 2014-04-02 12:58       ` Peter Crosthwaite
  2014-04-02 15:04       ` Christopher Covington
  2014-04-02 16:06       ` Joel Fernandes
  2 siblings, 0 replies; 11+ messages in thread
From: Peter Crosthwaite @ 2014-04-02 12:58 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Joel Fernandes, QEMU Developers, Linux ARM Kernel List

On Wed, Apr 2, 2014 at 10:47 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 2 April 2014 13:11, Peter Crosthwaite <peter.crosthwaite@xilinx.com> wrote:
>> Like others, I have been carrying this change locally. Good to see it up!
>
> Why are you all booting raw Images anyway (just out of curiosity)? All my
> test cases boot either a zImage or a uImage, or occasionally a full SD card
> image, or I'd have noticed this earlier...
>

Simplicity more than anything. It is much easier to debug against
head.S (esp. with the -d in_asm option), when you can see the head.s
asm as the very first thing the CPU executes. Otherwise you gotta
filter out the zImage stuffs. There have also been occasions where I
have broken QEMU locally as part of some random work-in-progress
development such that the zImage head doesnt work and i'd rather just
move my debug efforts to kernel proper. None of them are fantastic
reasons from a user perspective but it's just a little easier on
developing.

Regards,
Peter

> thanks
> -- PMM
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PATCH] QEMU: ARM: boot: Load kernel at an Image friendly address
  2014-04-02 12:47     ` Peter Maydell
  2014-04-02 12:58       ` Peter Crosthwaite
@ 2014-04-02 15:04       ` Christopher Covington
  2014-04-02 16:06       ` Joel Fernandes
  2 siblings, 0 replies; 11+ messages in thread
From: Christopher Covington @ 2014-04-02 15:04 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Joel Fernandes, Peter Crosthwaite, QEMU Developers,
	Linux ARM Kernel List

[On 04/02/2014 08:47 AM, Peter Maydell wrote:
> On 2 April 2014 13:11, Peter Crosthwaite <peter.crosthwaite@xilinx.com> wrote:
>> Like others, I have been carrying this change locally. Good to see it up!
> 
> Why are you all booting raw Images anyway (just out of curiosity)? All my
> test cases boot either a zImage or a uImage, or occasionally a full SD card
> image, or I'd have noticed this earlier...

I do it in part for uniformity with arm64 kernels.

Christopher

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by the Linux Foundation.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PATCH] QEMU: ARM: boot: Load kernel at an Image friendly address
  2014-04-02 12:47     ` Peter Maydell
  2014-04-02 12:58       ` Peter Crosthwaite
  2014-04-02 15:04       ` Christopher Covington
@ 2014-04-02 16:06       ` Joel Fernandes
  2 siblings, 0 replies; 11+ messages in thread
From: Joel Fernandes @ 2014-04-02 16:06 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Joel Fernandes, Peter Crosthwaite, QEMU Developers,
	Linux ARM Kernel List

On Wed, Apr 2, 2014 at 7:47 AM, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 2 April 2014 13:11, Peter Crosthwaite <peter.crosthwaite@xilinx.com> wrote:
>> Like others, I have been carrying this change locally. Good to see it up!
>
> Why are you all booting raw Images anyway (just out of curiosity)? All my
> test cases boot either a zImage or a uImage, or occasionally a full SD card
> image, or I'd have noticed this earlier...

zImage fails for me on OMAP1, which I'm debugging, the errors have
more to do with writing out of memory limits. But I was not sure if
the problem was with decompression or something else, so I wanted to
boot the basic case (Image) first.

Thanks,
-Joel

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-04-02 16:06 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-25  3:34 [Qemu-devel] [PATCH] QEMU: ARM: boot: Load kernel at an Image friendly address Joel Fernandes
2014-03-25 12:29 ` Christopher Covington
2014-03-25 13:43   ` Joel Fernandes
2014-03-25 13:13 ` Peter Maydell
2014-03-25 13:46   ` Joel Fernandes
2014-04-01 17:10 ` Peter Maydell
2014-04-02 12:11   ` Peter Crosthwaite
2014-04-02 12:47     ` Peter Maydell
2014-04-02 12:58       ` Peter Crosthwaite
2014-04-02 15:04       ` Christopher Covington
2014-04-02 16:06       ` Joel Fernandes

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