All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Filippov <jcmvbkbc@gmail.com>
To: qemu-devel@nongnu.org
Cc: Max Filippov <jcmvbkbc@gmail.com>,
	Waldemar Brodkorb <mail@waldemar-brodkorb.de>,
	qemu-stable@nongnu.org
Subject: [Qemu-devel] [PATCH 3/3] target-xtensa: treat uImage load address as virtual
Date: Tue, 12 Aug 2014 08:22:22 +0400	[thread overview]
Message-ID: <1407817342-1373-4-git-send-email-jcmvbkbc@gmail.com> (raw)
In-Reply-To: <1407817342-1373-1-git-send-email-jcmvbkbc@gmail.com>

U-boot for xtensa always treats uImage load address as virtual address.
This is important when booting uImage on xtensa core with MMUv2, because
MMUv2 has fixed non-identity virtual-to-physical mapping after reset.

Always do virtual-to-physical translation of uImage load address and
load uImage at the translated address. This fixes booting uImage kernels
on dc232b and other MMUv2 cores.

Cc: qemu-stable@nongnu.org
Reported-by: Waldemar Brodkorb <mail@waldemar-brodkorb.de>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
 hw/xtensa/xtfpga.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c
index a2dff5a..71be863 100644
--- a/hw/xtensa/xtfpga.c
+++ b/hw/xtensa/xtfpga.c
@@ -323,9 +323,16 @@ static void lx_init(const LxBoardDesc *board, MachineState *machine)
         if (success > 0) {
             entry_point = elf_entry;
         } else {
+            uboot_image_header_t hdr;
             hwaddr ep;
             int is_linux;
-            success = load_uimage(kernel_filename, &ep, NULL, &is_linux);
+
+            success = load_uboot_image_header(kernel_filename, &hdr);
+            if (success == 0) {
+                success = load_uimage_at(kernel_filename, &ep,
+                                         translate_phys_addr(cpu, hdr.ih_load),
+                                         &is_linux);
+            }
             if (success > 0 && is_linux) {
                 entry_point = ep;
             } else {
-- 
1.8.1.4

  parent reply	other threads:[~2014-08-12  4:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-12  4:22 [Qemu-devel] [PATCH 0/3] target-xtensa: fix loading uImage kernels on MMUv2 cores Max Filippov
2014-08-12  4:22 ` [Qemu-devel] [PATCH 1/3] hw/core/loader: implement load_uboot_image_header Max Filippov
2014-08-12  4:22 ` [Qemu-devel] [PATCH 2/3] hw/core/loader: implement load_uimage_at Max Filippov
2014-08-21  9:16   ` Alexander Graf
2014-08-21 20:56     ` Max Filippov
2014-08-21 21:21       ` Alexander Graf
2014-08-12  4:22 ` Max Filippov [this message]
2014-08-16  1:30 ` [Qemu-devel] [PATCH 0/3] target-xtensa: fix loading uImage kernels on MMUv2 cores Max Filippov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1407817342-1373-4-git-send-email-jcmvbkbc@gmail.com \
    --to=jcmvbkbc@gmail.com \
    --cc=mail@waldemar-brodkorb.de \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.