Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0587FC433E2 for ; Thu, 17 Sep 2020 09:47:21 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 749ED20770 for ; Thu, 17 Sep 2020 09:47:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 749ED20770 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kIqVE-0003OD-8l; Thu, 17 Sep 2020 09:46:56 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kIqVD-0003O8-Hv for xen-devel@lists.xenproject.org; Thu, 17 Sep 2020 09:46:55 +0000 X-Inumbo-ID: d6e65f82-bae5-4237-804e-e54c97f15158 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id d6e65f82-bae5-4237-804e-e54c97f15158; Thu, 17 Sep 2020 09:46:54 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BD86912FC; Thu, 17 Sep 2020 02:46:53 -0700 (PDT) Received: from [192.168.2.22] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 136903F68F; Thu, 17 Sep 2020 02:46:52 -0700 (PDT) Subject: Re: DT with memory bank of size 0 (WAS: Re: AW: AW: Colibri imx8qxp: Missing kernel boot module) To: Stefano Stabellini , Julien Grall Cc: Daniel Wagner2 , "xen-devel@lists.xenproject.org" , Bertrand Marquis References: <45400b8b-6379-e00e-50de-941bb2ff423c@xen.org> From: =?UTF-8?Q?Andr=c3=a9_Przywara?= Autocrypt: addr=andre.przywara@arm.com; prefer-encrypt=mutual; keydata= xsFNBFNPCKMBEAC+6GVcuP9ri8r+gg2fHZDedOmFRZPtcrMMF2Cx6KrTUT0YEISsqPoJTKld tPfEG0KnRL9CWvftyHseWTnU2Gi7hKNwhRkC0oBL5Er2hhNpoi8x4VcsxQ6bHG5/dA7ctvL6 kYvKAZw4X2Y3GTbAZIOLf+leNPiF9175S8pvqMPi0qu67RWZD5H/uT/TfLpvmmOlRzNiXMBm kGvewkBpL3R2clHquv7pB6KLoY3uvjFhZfEedqSqTwBVu/JVZZO7tvYCJPfyY5JG9+BjPmr+ REe2gS6w/4DJ4D8oMWKoY3r6ZpHx3YS2hWZFUYiCYovPxfj5+bOr78sg3JleEd0OB0yYtzTT esiNlQpCo0oOevwHR+jUiaZevM4xCyt23L2G+euzdRsUZcK/M6qYf41Dy6Afqa+PxgMEiDto ITEH3Dv+zfzwdeqCuNU0VOGrQZs/vrKOUmU/QDlYL7G8OIg5Ekheq4N+Ay+3EYCROXkstQnf YYxRn5F1oeVeqoh1LgGH7YN9H9LeIajwBD8OgiZDVsmb67DdF6EQtklH0ycBcVodG1zTCfqM AavYMfhldNMBg4vaLh0cJ/3ZXZNIyDlV372GmxSJJiidxDm7E1PkgdfCnHk+pD8YeITmSNyb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lbl/KMR5TQntELfLR4etizLq Xpd2byn96Ivi8C8u9zJruXTueHH8vt7gJ1oax3yKRGU5o2eipCRiKZ0s/T7fvkdq+8beg9ku fDO4SAgJMIl6H5awliCY2zQvLHysS/Wb8QuB09hmhLZ4AifdHyF1J5qeePEhgTA+BaUbiUZf i4aIXCH3Wv6K Organization: ARM Ltd. Message-ID: Date: Thu, 17 Sep 2020 10:46:20 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" On 17/09/2020 01:31, Stefano Stabellini wrote: Hi, > On Wed, 16 Sep 2020, Julien Grall wrote: >> On 14/09/2020 15:26, Daniel Wagner2 wrote: >>> Hi Julien, >> >> Hi Daniel, >> >> I am moving the thread to xen-devel and adding a couple of more folks. >> >>>> >>>>> >>>>> this is the full version of the fdt that threw the error: >>>>> https://pastebin.com/63TZ9z3k >>>>> The problematic memory node appears in line 126 >>>> >>>> Thanks! The output looks corrupted as some of the lines are not valid DTB: >>>> >>>> fsl,pins = * 0x000000009300184c [0x00000048]; >>>> >>>> Although, I am not sure if it is just U-boot dumping the DTB differently. >>>> >>>> Anyway, after removing the "corrupted" line, I managed to get a compile >>> the >>>> DTB. I don't have a Colibri IMX8QXP. However, given this is an early >>> parsing >>>> error, I have just embed the DTB in Xen binary via CONFIG_DTB_FILE. >>>> >>>> Unfortunately I couldn't reproduce your error. This either suggests the >>> DTB gets >>>> corrupted or Xen doesn't access the DTB with the correct memory attribute. >>>> >>>> Do you have the DTB in hand? >>> >>> Sorry for the corrupted version, I've uploaded the DTB >>> (fsl-imx8qxp-colibri-eval-v3.dtb) to >>> https://drive.google.com/drive/folders/1jbpnz35sC0NbCyEjrkLqelBsKBztW1S6?usp >>> =sharing >>> >>> I have also uploaded my modified xen source files. >>> 1. arch/arm/bootfdt.c >>> where I have added the additional printk's seen in the log and >>> 2. arch/arm/setup.c >>> where I rerun the devicetree parser in line 935 to get the logs, since the >>> console is not yet initialised when the function is called for the first >>> time and I >>> didn't manage to enable earlyprintk. >>> >>> I think the breaking point is the second memory bank which appears in the >>> logs (see the output line marked with "!!") with start=0x8 8000 0000 and >>> size=0. >>> It isn't specified in the DTB, so I am not sure where this comes from. >>> It has size=0 so >>> if ( !size ) >>> { >>> printk("invalid size, bank %d\n",i); >>> return -EINVAL; >>> } >>> In bootfdt.c makes the function stop. >>> >>> Log: >>> (XEN) arch/arm/bootfdt.c: early_scan_node >>> (XEN) -> fdt: node `memory@80000000': parsing >>> (XEN) -> process_memory_node >>> (XEN) >>> (XEN) arch/arm/bootfdt.c: process_memory_node >>> (XEN) ->found memory:reg >>> (XEN) ->cell= >>> (XEN) ->banks=2 >>> (XEN) ->mem->nr_banks=1 >>> (XEN) ->NR_MEM_BANKS=128 >>> (XEN) ->start=0x80200000 size=0x7fe00000 >>> !! (XEN) ->start=0x880000000 size=0 >>> (XEN) invalid size, bank 1 >>> (XEN) END of arch/arm/bootfdt.c: process_memory_node >> >> When I tried to run it on the model I get: >> >> (XEN) device_tree_for_each_node: memory@80000000 >> (XEN) >> (XEN) arch/arm/bootfdt.c: early_scan_node >> (XEN) -> fdt: node `memory@80000000': parsing >> (XEN) -> process_memory_node >> (XEN) >> (XEN) arch/arm/bootfdt.c: process_memory_node >> (XEN) ->found memory:reg >> (XEN) ->cell= >> (XEN) ->banks=1 >> (XEN) ->mem->nr_banks=0 >> (XEN) ->NR_MEM_BANKS=128 >> (XEN) ->start=0x80000000 size=0x40000000 >> (XEN) END of arch/arm/bootfdt.c: process_memory_node >> >>> >>> Btw 8_8000_0000 is the start address of this systems DDR Main memory, >>> according to the Reference Manual of the i.MX8QXP. >> I couldn't find this value in the DT. It is possible that U-boot is modifying >> the memory node before jumping to Xen (or Linux). U-Boot almost always rewrites the memory node, filling in its own view of DRAM. It's actually not that easy to avoid that. This is in U-Boot's colibri-imx8x.h: #define CONFIG_SYS_SDRAM_BASE 0x80000000 #define PHYS_SDRAM_1 0x80000000 #define PHYS_SDRAM_2 0x880000000 #define PHYS_SDRAM_1_SIZE SZ_2G /* 2 GB */ #define PHYS_SDRAM_2_SIZE 0x00000000 /* 0 GB */ The Colibri iMX8X SoM seems to support "Up to 2GB LPDDR4", so not sure why we have the upper memory here at all. It could just set CONFIG_NR_DRAM_BANKS to 1 and be done. But anyway ... >> Looking at Linux, they seem to ignore any bank with size == 0. I am starting >> to wonder whether your DT is (ab)using it. >> >> Do you have Linux running on baremetal on this board? If so would you mind to >> dump the DT from the userspace (via /proc/device-tree) this time? >> >> In any case, we may want to relax the check in Xen. Any opinions? > > Yeah, ignoring a bank with size=0 is fine. I checked the epapr and it Not sure you meant this, but the official DT spec replaced ePAPR for a while now: https://www.devicetree.org/specifications/ It has been heavily updated and even got some bug fixes. > doesn't specify that size=0 is invalid, so I think it is actually better > to ignore it and continue even from a spec perspective. Yeah, I don't see any harm as well with ignoring 0 sized banks. Just not sure if that has any implication with the number of memory banks that Xen wants to deal with (it if counts two, but there is only one valid one). Cheers, Andre