Skip to contentSkip to conversation

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

DISCUSSION Julien Grall 5 participants 7 messages Sep 16, 2020 – Sep 18, 2020 3 messages not in the archive

lore
Share & tools
lore
#3 lore raw
In reply to a message not in the archive
Quoted 1 line · 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.

Quoted 50 lines
Quoted 6 lines
Quoted 5 lines

this is the full version of the fdt that threw the error:
https://pastebin.com/63TZ9z3k
The problematic memory node appears in line 126

Quoted 7 lines

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

Quoted 1 line

DTB. I don't have a Colibri IMX8QXP. However, given this is an early

parsing

Quoted 3 lines

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

Quoted 3 lines

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.

Quoted 15 lines

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

Quoted 3 lines

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).

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?

Cheers,

Signature · 1 line
Julien Grall
#4 lore raw
Quoted 96 lines · Julien Grall
Quoted 1 line · 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.

Quoted 50 lines
Quoted 6 lines
Quoted 5 lines

this is the full version of the fdt that threw the error:
https://pastebin.com/63TZ9z3k
The problematic memory node appears in line 126

Quoted 7 lines

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

Quoted 1 line

DTB. I don't have a Colibri IMX8QXP. However, given this is an early

parsing

Quoted 3 lines

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

Quoted 3 lines

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.

Quoted 15 lines

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

Quoted 3 lines

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).

Quoted 7 lines

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 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.

#5 lore raw

On 17/09/2020 01:31, Stefano Stabellini wrote:

Hi,

Quoted 92 lines · Julien Grall
Quoted 91 lines · On 14/09/2020 15:26, Daniel Wagner2 wrote:
Quoted 1 line

Hi Julien,

Hi Daniel,

I am moving the thread to xen-devel and adding a couple of more folks.

Quoted 50 lines
Quoted 6 lines
Quoted 5 lines

this is the full version of the fdt that threw the error:
https://pastebin.com/63TZ9z3k
The problematic memory node appears in line 126

Quoted 7 lines

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

Quoted 1 line

DTB. I don't have a Colibri IMX8QXP. However, given this is an early

parsing

Quoted 3 lines

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

Quoted 3 lines

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.

Quoted 15 lines

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

Quoted 1 line
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

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 ...

Quoted 9 lines
Quoted 7 lines

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.

Quoted 2 lines

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

#7 lore raw
In reply to Stefano Stabellini
Quoted 11 lines

-----Ursprüngliche Nachricht-----
Von: Stefano Stabellini <[email protected]>
Gesendet: Donnerstag, 17. September 2020 02:31
An: Julien Grall <[email protected]>
Cc: Daniel Wagner2 <[email protected]>; xen- [email protected]; Stefano Stabellini <[email protected]>; Bertrand Marquis <[email protected]>; Andre Przywara <[email protected]>
Betreff: Re: DT with memory bank of size 0 (WAS: Re: AW: AW: Colibri

imx8qxp:

Quoted 17 lines

Missing kernel boot module)

Quoted 14 lines · Julien Grall
Quoted 1 line · 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.

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

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:

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

fsl,pins = * 0x000000009300184c [0x00000048];

Although, I am not sure if it is just U-boot dumping the DTB

differently.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

Anyway, after removing the "corrupted" line, I managed to get a compile

the

Quoted 2 lines

DTB. I don't have a Colibri IMX8QXP. However, given this is an early

Quoted 81 lines
Quoted 7 lines
Quoted 7 lines

parsing

Quoted 4 lines

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

Quoted 1 line

corrupted or Xen doesn't access the DTB with the correct memory

attribute.

Quoted 73 lines
Quoted 29 lines
Quoted 2 lines

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/1jbpnz35sC0NbCyEjrkLqelBsKBzt
W1S6?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.

Quoted 15 lines

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

Quoted 3 lines

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).

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?

I do have linux running on baremetal on the plattform. Created dtb and dts with devicetree-compiler:
dtc -I fs -O dtb -o ~/dtb-dump /proc/device-tree dtc -I dtb -O dts -o ~/dts-dump ~/dtb-dump

uploaded both to google drive:
https://drive.google.com/drive/folders/1jbpnz35sC0NbCyEjrkLqelBsKBztW1S6

You were right, after the boot, the memory node contains the second bank with
size=0.

memory@80000000 {
	device_type = "memory";
	reg = < 0x00 0x80200000 0x00 0x7fe00000 0x08 0x80000000 0x00 0x00 >;
};
Quoted 4 lines
Quoted 2 lines

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

doesn't

Quoted 1 line

specify that size=0 is invalid, so I think it is actually better to ignore

it and

Quoted 1 line

continue even from a spec perspective.

#9 lore raw
In reply to Julien Grall
Quoted 92 lines · Julien Grall
Quoted 1 line · 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.

Quoted 45 lines
Quoted 6 lines
Quoted 5 lines

this is the full version of the fdt that threw the error:
https://pastebin.com/63TZ9z3k
The problematic memory node appears in line 126

Quoted 7 lines

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

Quoted 1 line

DTB. I don't have a Colibri IMX8QXP. However, given this is an early

parsing

Quoted 3 lines

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

Quoted 3 lines

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;
    }
Quoted 16 lines

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

Quoted 2 lines

Btw 8_8000_0000 is the start address of this systems DDR Main memory, according to the Reference Manual of the i.MX8QXP.

Quoted 7 lines

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).

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?

It would make sense to ignore entries with size 0 even more if Linux is already doing it.

Bertrand

Quoted 5 lines

Cheers,

Signature · 1 line
Julien Grall
#6 lore raw
In reply to André Przywara

Hi Andre,

Quoted 124 lines · André Przywara

On 17/09/2020 01:31, Stefano Stabellini wrote:

Hi,

Quoted 92 lines · Julien Grall
Quoted 91 lines · On 14/09/2020 15:26, Daniel Wagner2 wrote:
Quoted 1 line

Hi Julien,

Hi Daniel,

I am moving the thread to xen-devel and adding a couple of more folks.

Quoted 50 lines
Quoted 6 lines
Quoted 5 lines

this is the full version of the fdt that threw the error:
https://pastebin.com/63TZ9z3k
The problematic memory node appears in line 126

Quoted 7 lines

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

Quoted 1 line

DTB. I don't have a Colibri IMX8QXP. However, given this is an early

parsing

Quoted 3 lines

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

Quoted 3 lines

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.

Quoted 15 lines

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

Quoted 1 line
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

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 ...

Quoted 9 lines
Quoted 7 lines

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

Quoted 8 lines

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.

Quoted 2 lines

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.

Great! I have sent a patch that should solve this.

Quoted 3 lines

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).

It should not have any impact as we store in memory our representation of the memory.

Cheers,

Signature · 1 line
Julien Grall
#8 lore raw
In reply to Daniel Wagner2

Hi Daniel,

Quoted 20 lines · On 17/09/2020 10:47, Daniel Wagner2 wrote:
Quoted 10 lines
Quoted 10 lines
Quoted 2 lines

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).

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?

I do have linux running on baremetal on the plattform. Created dtb and dts with devicetree-compiler:
dtc -I fs -O dtb -o ~/dtb-dump /proc/device-tree dtc -I dtb -O dts -o ~/dts-dump ~/dtb-dump

uploaded both to google drive:
https://drive.google.com/drive/folders/1jbpnz35sC0NbCyEjrkLqelBsKBztW1S6

Quoted 8 lines

You were right, after the boot, the memory node contains the second bank with
size=0.

memory@80000000 {
	device_type = "memory";
	reg = < 0x00 0x80200000 0x00 0x7fe00000 0x08 0x80000000 0x00 0x00 >;
};

Thank you for the testing. I am glad we finally found the reason!

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

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

doesn't

Quoted 1 line

specify that size=0 is invalid, so I think it is actually better to ignore

it and

Quoted 1 line

continue even from a spec perspective.

I have sent a patch to ignore empty bank ([1]). Would you mind to test it?

The patch is based on unstable, but it should be easy to apply it on older release.

Best regards,

[1] https://lore.kernel.org/xen-devel/[email protected]/

Signature · 1 line
Julien Grall