[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DT with memory bank of size 0 (WAS: Re: AW: AW: Colibri imx8qxp: Missing kernel boot module)


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>
  • From: André Przywara <andre.przywara@xxxxxxx>
  • Date: Thu, 17 Sep 2020 10:46:20 +0100
  • Autocrypt: addr=andre.przywara@xxxxxxx; 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 7qeU08Hqqh4ui8SSeUp7+yie9zBhJB5vVBJoO5D0MikZAODIDwARAQABzS1BbmRyZSBQcnp5 d2FyYSAoQVJNKSA8YW5kcmUucHJ6eXdhcmFAYXJtLmNvbT7CwXsEEwECACUCGwMGCwkIBwMC BhUIAgkKCwQWAgMBAh4BAhe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XCH3Wv6K
  • Cc: Daniel Wagner2 <Daniel.Wagner2@xxxxxxxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Delivery-date: Thu, 17 Sep 2020 09:47:05 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.