From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60057) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XH3bo-0006h7-5B for qemu-devel@nongnu.org; Tue, 12 Aug 2014 00:22:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XH3bj-0001AP-67 for qemu-devel@nongnu.org; Tue, 12 Aug 2014 00:22:52 -0400 From: Max Filippov Date: Tue, 12 Aug 2014 08:22:22 +0400 Message-Id: <1407817342-1373-4-git-send-email-jcmvbkbc@gmail.com> In-Reply-To: <1407817342-1373-1-git-send-email-jcmvbkbc@gmail.com> References: <1407817342-1373-1-git-send-email-jcmvbkbc@gmail.com> Subject: [Qemu-devel] [PATCH 3/3] target-xtensa: treat uImage load address as virtual List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Max Filippov , Waldemar Brodkorb , qemu-stable@nongnu.org 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 Signed-off-by: Max Filippov --- 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