From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43031) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c63tx-0002Q0-5g for qemu-devel@nongnu.org; Sun, 13 Nov 2016 18:09:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c63ts-0000Ry-VL for qemu-devel@nongnu.org; Sun, 13 Nov 2016 18:09:29 -0500 Received: from mail-out.m-online.net ([2001:a60:0:28:0:1:25:1]:36177) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c63ts-0000RP-K2 for qemu-devel@nongnu.org; Sun, 13 Nov 2016 18:09:24 -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: Marek Vasut Message-ID: Date: Sun, 13 Nov 2016 23:58:03 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 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: Guenter Roeck Cc: qemu-devel@nongnu.org, Jeff Da Silva , Chris Wulff , Sandra Loosemore , Yves Vandervennet , Ley Foon Tan , Richard Henderson On 11/13/2016 05:09 PM, Guenter Roeck wrote: > 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. I was looking through that initcode today and through the Nios2 DTS, it looks like quite an inconsistent mess of User and Kernel addresses used there. -- Best regards, Marek Vasut