Received: from eggs.gnu.org ([2001:4830:134:3::10]:38539) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c5xLQ-0006jW-NA for qemu-devel@nongnu.org; Sun, 13 Nov 2016 11:09:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c5xLN-0001LQ-II for qemu-devel@nongnu.org; Sun, 13 Nov 2016 11:09:24 -0500 Received: from bh-25.webhostbox.net ([208.91.199.152]:46036) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c5xLN-0001KQ-Ap for qemu-devel@nongnu.org; Sun, 13 Nov 2016 11:09:21 -0500 References: <20161025195743.4558-1-marex@denx.de> <20161107035825.GA26942@roeck-us.net> <142d063a-4061-803d-b12c-0d17c8832c11@denx.de> <4ad504d5-9ba3-5216-8693-c731ce5b0bc9@roeck-us.net> <0419991c-a23f-8f2e-77c3-0401503dae17@denx.de> <62733dfe-5ccc-4d84-cc6e-92c100a1447e@roeck-us.net> From: Guenter Roeck Message-ID: Date: Sun, 13 Nov 2016 08:09:16 -0800 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [V6, 2/7] nios2: Add architecture emulation support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marek Vasut Cc: qemu-devel@nongnu.org, Jeff Da Silva , Chris Wulff , Sandra Loosemore , Yves Vandervennet , Ley Foon Tan , Richard Henderson Hi Marek, On 11/13/2016 04:01 AM, Marek Vasut wrote: >> >> diff --git a/hw/nios2/boot.c b/hw/nios2/boot.c >> index 564dbae..e0a9aff 100644 >> --- a/hw/nios2/boot.c >> +++ b/hw/nios2/boot.c >> @@ -73,6 +73,11 @@ static void main_cpu_reset(void *opaque) >> } >> } >> >> +static uint64_t translate_kernel_address(void *opaque, uint64_t addr) >> +{ >> + return addr - 0xc0000000LL; >> +} >> + >> static int nios2_load_dtb(struct nios2_boot_info bi, const uint32_t >> ramsize, >> const char *kernel_cmdline, const char >> *dtb_filename) >> { >> @@ -97,21 +102,16 @@ static int nios2_load_dtb(struct nios2_boot_info >> bi, const uint32_t ramsize, >> >> if (bi.initrd_start) { >> qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-start", >> - bi.initrd_start); >> + translate_kernel_address(NULL, >> bi.initrd_start)); >> >> qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-end", >> - bi.initrd_end); >> + translate_kernel_address(NULL, >> bi.initrd_end)); >> } >> >> cpu_physical_memory_write(bi.fdt, fdt, fdt_size); >> return fdt_size; >> } >> >> -static uint64_t translate_kernel_address(void *opaque, uint64_t addr) >> -{ >> - return addr - 0xc0000000LL; >> -} >> - >> void nios2_load_kernel(Nios2CPU *cpu, hwaddr ddr_base, >> >> >> This is my command line, running your patch series plus the above fixup >> on top of >> the qemu master branch: > > Uhm, how could that patch fix the DT passing for you ? I am still > looking into the DT passing, that's quite odd. > The problem isn't that much that dtb passing fails without the above fix, the problem is that memory initialization fails if wrong addresses are passed in the initrd properties (probably because the kernel tries to access or free memory that does not exist). This results in a kernel hang (endless loop) in memory initialization code. Guenter