Re: RPI4: fail too boot with an initrd

2020-02-18 Thread Jaehoon Chung
On 2/18/20 7:36 PM, Matthias Brugger wrote:
> 
> 
> On 18/02/2020 11:01, LABBE Corentin wrote:
>> On Mon, Feb 17, 2020 at 02:07:09PM +0100, Matthias Brugger wrote:
>>>
>>>
>>> On 17/02/2020 13:53, LABBE Corentin wrote:
 On Mon, Feb 17, 2020 at 11:50:04AM +0100, Matthias Brugger wrote:
>
>
> On 17/02/2020 11:37, LABBE Corentin wrote:
>> On Fri, Feb 14, 2020 at 06:15:27PM +, James Morse wrote:
>>> Hi Corentin,
>>>
>>> On 14/02/2020 13:27, LABBE Corentin wrote:
 Since the inclusion of the "enable network support in RPi4 config" 
 serie on uboot, I
 have started to work on adding the rpi4 in kernelCI.
 But I fail to succeed in using a kernel/dtb/ramdisk downloaded via 
 tftp.

 Using booti I hit:
 [0.00] Linux version 5.6.0-rc1-next-20200212 
 (clabbe@build2-bionic-1804) (gcc version 7.4.1 20181213 
 [linaro-7.4-2019.02 revision 56ec6f6b99cc167ff0c2f8e1a2eed33b1edc85d4] 
 (LinaroGCC 7.4-2019.02)) #66 SMP PREEMPT Wed Feb 12 10:14:20 UTC 
 2020
 [0.00] Machine model: Raspberry Pi 4 Model B
 [0.00] earlycon: uart0 at MMIO32 0xfe215040 (options 
 '')
 [0.00] printk: bootconsole [uart0] enabled
 [0.00] efi: Getting EFI parameters from FDT:
 [0.00] efi: UEFI not found.
>>>
>>> So no EFI,
>>>
 [0.00] OF: reserved mem: failed to allocate memory for node 
 'linux,cma'
>>>
>>> Out of memory.
>>>
 [0.00] cma: Failed to reserve 32 MiB
 [0.00] Kernel panic - not syncing: Failed to allocate page 
 table page
>>>
>>> Out of memory...
>>>
 [0.00] CPU: 0 PID: 0 Comm: swapper Not tainted 
 5.6.0-rc1-next-20200212 #66
 [0.00] Hardware name: Raspberry Pi 4 Model B (DT)
 [0.00] Call trace:
 [0.00]  dump_backtrace+0x0/0x1a0
 [0.00]  show_stack+0x14/0x20
 [0.00]  dump_stack+0xbc/0x104
 [0.00]  panic+0x16c/0x37c
 [0.00]  early_pgtable_alloc+0x30/0xa0
>>>
>>> ... really early!
>>>
 [0.00]  __create_pgd_mapping+0x36c/0x588
 [0.00]  map_kernel_segment+0x70/0xa4
 [0.00]  paging_init+0xf4/0x528
 [0.00]  setup_arch+0x250/0x5d8
 [0.00]  start_kernel+0x90/0x6d8

  
 Since the same kernel boot with bootefi and that bootefi lack ramdisk 
 address,
>>>
>>> Booting with EFI will cause linux to use the EFI memory map.
>>>
>>> Does your DT have a memory node? (or does it expect EFI to provide the 
>>> information)
>>>
>>>
 I tried to add the address in the dtb via:
 fdt addr 0x0240; fdt resize; fdt set /chosen linux,initrd-start 
 0x0270; fdt set /chosen linux,initrd-end 0x1000; bootefi 
 0x0008 0x0240
 But with that, I get:
 initrd not fully accessible via the linear mapping -- please check 
 your bootloader ...
>>>
>>> So this one is an EFI boot, but you can't find where to put the 
>>> initramfs such that the
>>> kernel agrees its in memory.
>>>
>>> If you boot with 'efi=debug', linux will print the EFI memory map. 
>>> Could you compare that
>>> to where U-Boot thinks memory is?
>>>
>>> (it sounds like your DT memory node is missing, and your EFI memory map 
>>> is surprisingly small)
>>
>> Hello
>>
>> Thanks for your advices.
>>
>> In the dtb of mainline linux:
>>  /* Will be filled by the bootloader */
>>  memory@0 {
>>  device_type = "memory";
>>  reg = <0 0 0>;
>>  };
>>
>> In uboot I have:
>> static struct mm_region bcm2711_mem_map[] = {
>> {
>> .virt = 0xUL,
>> .phys = 0xUL,
>> .size = 0xfe00UL,
>> .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
>>  PTE_BLOCK_INNER_SHARE
>> }, {
>> .virt = 0xfc00UL,
>> .phys = 0xfc00UL,
>> .size = 0x0380UL,
>> .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
>>  PTE_BLOCK_NON_SHARE |
>>  PTE_BLOCK_PXN | PTE_BLOCK_UXN
>> }, {
>> /* List terminator */
>> 0,
>> }
>> };
>> But I dont know if uboot use that for filling the memory node.
>
> No it doesn't. U-Boot uses the DT from the firmware and passes this to the
> kernel. But it seems you pass instead your own device-tree to the kernel, 
> so you
> will need to update the memory 

Re: RPI4: fail too boot with an initrd

2020-02-18 Thread Matthias Brugger



On 18/02/2020 11:01, LABBE Corentin wrote:
> On Mon, Feb 17, 2020 at 02:07:09PM +0100, Matthias Brugger wrote:
>>
>>
>> On 17/02/2020 13:53, LABBE Corentin wrote:
>>> On Mon, Feb 17, 2020 at 11:50:04AM +0100, Matthias Brugger wrote:


 On 17/02/2020 11:37, LABBE Corentin wrote:
> On Fri, Feb 14, 2020 at 06:15:27PM +, James Morse wrote:
>> Hi Corentin,
>>
>> On 14/02/2020 13:27, LABBE Corentin wrote:
>>> Since the inclusion of the "enable network support in RPi4 config" 
>>> serie on uboot, I
>>> have started to work on adding the rpi4 in kernelCI.
>>> But I fail to succeed in using a kernel/dtb/ramdisk downloaded via tftp.
>>>
>>> Using booti I hit:
>>> [0.00] Linux version 5.6.0-rc1-next-20200212 
>>> (clabbe@build2-bionic-1804) (gcc version 7.4.1 20181213 
>>> [linaro-7.4-2019.02 revision 56ec6f6b99cc167ff0c2f8e1a2eed33b1edc85d4] 
>>> (LinaroGCC 7.4-2019.02)) #66 SMP PREEMPT Wed Feb 12 10:14:20 UTC 
>>> 2020
>>> [0.00] Machine model: Raspberry Pi 4 Model B
>>> [0.00] earlycon: uart0 at MMIO32 0xfe215040 (options '')
>>> [0.00] printk: bootconsole [uart0] enabled
>>> [0.00] efi: Getting EFI parameters from FDT:
>>> [0.00] efi: UEFI not found.
>>
>> So no EFI,
>>
>>> [0.00] OF: reserved mem: failed to allocate memory for node 
>>> 'linux,cma'
>>
>> Out of memory.
>>
>>> [0.00] cma: Failed to reserve 32 MiB
>>> [0.00] Kernel panic - not syncing: Failed to allocate page 
>>> table page
>>
>> Out of memory...
>>
>>> [0.00] CPU: 0 PID: 0 Comm: swapper Not tainted 
>>> 5.6.0-rc1-next-20200212 #66
>>> [0.00] Hardware name: Raspberry Pi 4 Model B (DT)
>>> [0.00] Call trace:
>>> [0.00]  dump_backtrace+0x0/0x1a0
>>> [0.00]  show_stack+0x14/0x20
>>> [0.00]  dump_stack+0xbc/0x104
>>> [0.00]  panic+0x16c/0x37c
>>> [0.00]  early_pgtable_alloc+0x30/0xa0
>>
>> ... really early!
>>
>>> [0.00]  __create_pgd_mapping+0x36c/0x588
>>> [0.00]  map_kernel_segment+0x70/0xa4
>>> [0.00]  paging_init+0xf4/0x528
>>> [0.00]  setup_arch+0x250/0x5d8
>>> [0.00]  start_kernel+0x90/0x6d8
>>>
>>>  
>>> Since the same kernel boot with bootefi and that bootefi lack ramdisk 
>>> address,
>>
>> Booting with EFI will cause linux to use the EFI memory map.
>>
>> Does your DT have a memory node? (or does it expect EFI to provide the 
>> information)
>>
>>
>>> I tried to add the address in the dtb via:
>>> fdt addr 0x0240; fdt resize; fdt set /chosen linux,initrd-start 
>>> 0x0270; fdt set /chosen linux,initrd-end 0x1000; bootefi 
>>> 0x0008 0x0240
>>> But with that, I get:
>>> initrd not fully accessible via the linear mapping -- please check your 
>>> bootloader ...
>>
>> So this one is an EFI boot, but you can't find where to put the 
>> initramfs such that the
>> kernel agrees its in memory.
>>
>> If you boot with 'efi=debug', linux will print the EFI memory map. Could 
>> you compare that
>> to where U-Boot thinks memory is?
>>
>> (it sounds like your DT memory node is missing, and your EFI memory map 
>> is surprisingly small)
>
> Hello
>
> Thanks for your advices.
>
> In the dtb of mainline linux:
>   /* Will be filled by the bootloader */
>   memory@0 {
>   device_type = "memory";
>   reg = <0 0 0>;
>   };
>
> In uboot I have:
> static struct mm_region bcm2711_mem_map[] = {
> {
> .virt = 0xUL,
> .phys = 0xUL,
> .size = 0xfe00UL,
> .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
>  PTE_BLOCK_INNER_SHARE
> }, {
> .virt = 0xfc00UL,
> .phys = 0xfc00UL,
> .size = 0x0380UL,
> .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
>  PTE_BLOCK_NON_SHARE |
>  PTE_BLOCK_PXN | PTE_BLOCK_UXN
> }, {
> /* List terminator */
> 0,
> }
> };
> But I dont know if uboot use that for filling the memory node.

 No it doesn't. U-Boot uses the DT from the firmware and passes this to the
 kernel. But it seems you pass instead your own device-tree to the kernel, 
 so you
 will need to update the memory node to show the available memory on you 
 board.

>>>
>>> I dont understand, in the Linux commit "ARM: dts: Add minimal Raspberry Pi 
>>> 4 support" I read:
>>> The RPi 4 is 

Re: RPI4: fail too boot with an initrd

2020-02-18 Thread LABBE Corentin
On Mon, Feb 17, 2020 at 02:07:09PM +0100, Matthias Brugger wrote:
> 
> 
> On 17/02/2020 13:53, LABBE Corentin wrote:
> > On Mon, Feb 17, 2020 at 11:50:04AM +0100, Matthias Brugger wrote:
> >>
> >>
> >> On 17/02/2020 11:37, LABBE Corentin wrote:
> >>> On Fri, Feb 14, 2020 at 06:15:27PM +, James Morse wrote:
>  Hi Corentin,
> 
>  On 14/02/2020 13:27, LABBE Corentin wrote:
> > Since the inclusion of the "enable network support in RPi4 config" 
> > serie on uboot, I
> > have started to work on adding the rpi4 in kernelCI.
> > But I fail to succeed in using a kernel/dtb/ramdisk downloaded via tftp.
> >
> > Using booti I hit:
> > [0.00] Linux version 5.6.0-rc1-next-20200212 
> > (clabbe@build2-bionic-1804) (gcc version 7.4.1 20181213 
> > [linaro-7.4-2019.02 revision 56ec6f6b99cc167ff0c2f8e1a2eed33b1edc85d4] 
> > (LinaroGCC 7.4-2019.02)) #66 SMP PREEMPT Wed Feb 12 10:14:20 UTC 
> > 2020
> > [0.00] Machine model: Raspberry Pi 4 Model B
> > [0.00] earlycon: uart0 at MMIO32 0xfe215040 (options '')
> > [0.00] printk: bootconsole [uart0] enabled
> > [0.00] efi: Getting EFI parameters from FDT:
> > [0.00] efi: UEFI not found.
> 
>  So no EFI,
> 
> > [0.00] OF: reserved mem: failed to allocate memory for node 
> > 'linux,cma'
> 
>  Out of memory.
> 
> > [0.00] cma: Failed to reserve 32 MiB
> > [0.00] Kernel panic - not syncing: Failed to allocate page 
> > table page
> 
>  Out of memory...
> 
> > [0.00] CPU: 0 PID: 0 Comm: swapper Not tainted 
> > 5.6.0-rc1-next-20200212 #66
> > [0.00] Hardware name: Raspberry Pi 4 Model B (DT)
> > [0.00] Call trace:
> > [0.00]  dump_backtrace+0x0/0x1a0
> > [0.00]  show_stack+0x14/0x20
> > [0.00]  dump_stack+0xbc/0x104
> > [0.00]  panic+0x16c/0x37c
> > [0.00]  early_pgtable_alloc+0x30/0xa0
> 
>  ... really early!
> 
> > [0.00]  __create_pgd_mapping+0x36c/0x588
> > [0.00]  map_kernel_segment+0x70/0xa4
> > [0.00]  paging_init+0xf4/0x528
> > [0.00]  setup_arch+0x250/0x5d8
> > [0.00]  start_kernel+0x90/0x6d8
> >
> >  
> > Since the same kernel boot with bootefi and that bootefi lack ramdisk 
> > address,
> 
>  Booting with EFI will cause linux to use the EFI memory map.
> 
>  Does your DT have a memory node? (or does it expect EFI to provide the 
>  information)
> 
> 
> > I tried to add the address in the dtb via:
> > fdt addr 0x0240; fdt resize; fdt set /chosen linux,initrd-start 
> > 0x0270; fdt set /chosen linux,initrd-end 0x1000; bootefi 
> > 0x0008 0x0240
> > But with that, I get:
> > initrd not fully accessible via the linear mapping -- please check your 
> > bootloader ...
> 
>  So this one is an EFI boot, but you can't find where to put the 
>  initramfs such that the
>  kernel agrees its in memory.
> 
>  If you boot with 'efi=debug', linux will print the EFI memory map. Could 
>  you compare that
>  to where U-Boot thinks memory is?
> 
>  (it sounds like your DT memory node is missing, and your EFI memory map 
>  is surprisingly small)
> >>>
> >>> Hello
> >>>
> >>> Thanks for your advices.
> >>>
> >>> In the dtb of mainline linux:
> >>>   /* Will be filled by the bootloader */
> >>>   memory@0 {
> >>>   device_type = "memory";
> >>>   reg = <0 0 0>;
> >>>   };
> >>>
> >>> In uboot I have:
> >>> static struct mm_region bcm2711_mem_map[] = {
> >>> {
> >>> .virt = 0xUL,
> >>> .phys = 0xUL,
> >>> .size = 0xfe00UL,
> >>> .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
> >>>  PTE_BLOCK_INNER_SHARE
> >>> }, {
> >>> .virt = 0xfc00UL,
> >>> .phys = 0xfc00UL,
> >>> .size = 0x0380UL,
> >>> .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
> >>>  PTE_BLOCK_NON_SHARE |
> >>>  PTE_BLOCK_PXN | PTE_BLOCK_UXN
> >>> }, {
> >>> /* List terminator */
> >>> 0,
> >>> }
> >>> };
> >>> But I dont know if uboot use that for filling the memory node.
> >>
> >> No it doesn't. U-Boot uses the DT from the firmware and passes this to the
> >> kernel. But it seems you pass instead your own device-tree to the kernel, 
> >> so you
> >> will need to update the memory node to show the available memory on you 
> >> board.
> >>
> > 
> > I dont understand, in the Linux commit "ARM: dts: Add minimal Raspberry Pi 
> > 4 support" I read:
> > The RPi 4 is available in 3 different variants (1, 2 and 4 GB RAM), 

Re: RPI4: fail too boot with an initrd

2020-02-17 Thread Matthias Brugger



On 17/02/2020 13:53, LABBE Corentin wrote:
> On Mon, Feb 17, 2020 at 11:50:04AM +0100, Matthias Brugger wrote:
>>
>>
>> On 17/02/2020 11:37, LABBE Corentin wrote:
>>> On Fri, Feb 14, 2020 at 06:15:27PM +, James Morse wrote:
 Hi Corentin,

 On 14/02/2020 13:27, LABBE Corentin wrote:
> Since the inclusion of the "enable network support in RPi4 config" serie 
> on uboot, I
> have started to work on adding the rpi4 in kernelCI.
> But I fail to succeed in using a kernel/dtb/ramdisk downloaded via tftp.
>
> Using booti I hit:
> [0.00] Linux version 5.6.0-rc1-next-20200212 
> (clabbe@build2-bionic-1804) (gcc version 7.4.1 20181213 
> [linaro-7.4-2019.02 revision 56ec6f6b99cc167ff0c2f8e1a2eed33b1edc85d4] 
> (LinaroGCC 7.4-2019.02)) #66 SMP PREEMPT Wed Feb 12 10:14:20 UTC 2020
> [0.00] Machine model: Raspberry Pi 4 Model B
> [0.00] earlycon: uart0 at MMIO32 0xfe215040 (options '')
> [0.00] printk: bootconsole [uart0] enabled
> [0.00] efi: Getting EFI parameters from FDT:
> [0.00] efi: UEFI not found.

 So no EFI,

> [0.00] OF: reserved mem: failed to allocate memory for node 
> 'linux,cma'

 Out of memory.

> [0.00] cma: Failed to reserve 32 MiB
> [0.00] Kernel panic - not syncing: Failed to allocate page table 
> page

 Out of memory...

> [0.00] CPU: 0 PID: 0 Comm: swapper Not tainted 
> 5.6.0-rc1-next-20200212 #66
> [0.00] Hardware name: Raspberry Pi 4 Model B (DT)
> [0.00] Call trace:
> [0.00]  dump_backtrace+0x0/0x1a0
> [0.00]  show_stack+0x14/0x20
> [0.00]  dump_stack+0xbc/0x104
> [0.00]  panic+0x16c/0x37c
> [0.00]  early_pgtable_alloc+0x30/0xa0

 ... really early!

> [0.00]  __create_pgd_mapping+0x36c/0x588
> [0.00]  map_kernel_segment+0x70/0xa4
> [0.00]  paging_init+0xf4/0x528
> [0.00]  setup_arch+0x250/0x5d8
> [0.00]  start_kernel+0x90/0x6d8
>
>  
> Since the same kernel boot with bootefi and that bootefi lack ramdisk 
> address,

 Booting with EFI will cause linux to use the EFI memory map.

 Does your DT have a memory node? (or does it expect EFI to provide the 
 information)


> I tried to add the address in the dtb via:
> fdt addr 0x0240; fdt resize; fdt set /chosen linux,initrd-start 
> 0x0270; fdt set /chosen linux,initrd-end 0x1000; bootefi 
> 0x0008 0x0240
> But with that, I get:
> initrd not fully accessible via the linear mapping -- please check your 
> bootloader ...

 So this one is an EFI boot, but you can't find where to put the initramfs 
 such that the
 kernel agrees its in memory.

 If you boot with 'efi=debug', linux will print the EFI memory map. Could 
 you compare that
 to where U-Boot thinks memory is?

 (it sounds like your DT memory node is missing, and your EFI memory map is 
 surprisingly small)
>>>
>>> Hello
>>>
>>> Thanks for your advices.
>>>
>>> In the dtb of mainline linux:
>>> /* Will be filled by the bootloader */
>>> memory@0 {
>>> device_type = "memory";
>>> reg = <0 0 0>;
>>> };
>>>
>>> In uboot I have:
>>> static struct mm_region bcm2711_mem_map[] = {
>>> {
>>> .virt = 0xUL,
>>> .phys = 0xUL,
>>> .size = 0xfe00UL,
>>> .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
>>>  PTE_BLOCK_INNER_SHARE
>>> }, {
>>> .virt = 0xfc00UL,
>>> .phys = 0xfc00UL,
>>> .size = 0x0380UL,
>>> .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
>>>  PTE_BLOCK_NON_SHARE |
>>>  PTE_BLOCK_PXN | PTE_BLOCK_UXN
>>> }, {
>>> /* List terminator */
>>> 0,
>>> }
>>> };
>>> But I dont know if uboot use that for filling the memory node.
>>
>> No it doesn't. U-Boot uses the DT from the firmware and passes this to the
>> kernel. But it seems you pass instead your own device-tree to the kernel, so 
>> you
>> will need to update the memory node to show the available memory on you 
>> board.
>>
> 
> I dont understand, in the Linux commit "ARM: dts: Add minimal Raspberry Pi 4 
> support" I read:
> The RPi 4 is available in 3 different variants (1, 2 and 4 GB RAM), so leave 
> the memory size to zero and let the bootloader take care of it.
> But if uboot dont fill that...
> So the DTB in mainline is wrong, right ?
> 

How do you pass your DTB to the kernel? Does the FW uses your DTB by putting it
as bcm2711-rpi-4-b.dtb in the first FAT partition? Or do you load it from U-Boot

Re: RPI4: fail too boot with an initrd

2020-02-17 Thread LABBE Corentin
On Mon, Feb 17, 2020 at 11:50:04AM +0100, Matthias Brugger wrote:
> 
> 
> On 17/02/2020 11:37, LABBE Corentin wrote:
> > On Fri, Feb 14, 2020 at 06:15:27PM +, James Morse wrote:
> >> Hi Corentin,
> >>
> >> On 14/02/2020 13:27, LABBE Corentin wrote:
> >>> Since the inclusion of the "enable network support in RPi4 config" serie 
> >>> on uboot, I
> >>> have started to work on adding the rpi4 in kernelCI.
> >>> But I fail to succeed in using a kernel/dtb/ramdisk downloaded via tftp.
> >>>
> >>> Using booti I hit:
> >>> [0.00] Linux version 5.6.0-rc1-next-20200212 
> >>> (clabbe@build2-bionic-1804) (gcc version 7.4.1 20181213 
> >>> [linaro-7.4-2019.02 revision 56ec6f6b99cc167ff0c2f8e1a2eed33b1edc85d4] 
> >>> (LinaroGCC 7.4-2019.02)) #66 SMP PREEMPT Wed Feb 12 10:14:20 UTC 2020
> >>> [0.00] Machine model: Raspberry Pi 4 Model B
> >>> [0.00] earlycon: uart0 at MMIO32 0xfe215040 (options '')
> >>> [0.00] printk: bootconsole [uart0] enabled
> >>> [0.00] efi: Getting EFI parameters from FDT:
> >>> [0.00] efi: UEFI not found.
> >>
> >> So no EFI,
> >>
> >>> [0.00] OF: reserved mem: failed to allocate memory for node 
> >>> 'linux,cma'
> >>
> >> Out of memory.
> >>
> >>> [0.00] cma: Failed to reserve 32 MiB
> >>> [0.00] Kernel panic - not syncing: Failed to allocate page table 
> >>> page
> >>
> >> Out of memory...
> >>
> >>> [0.00] CPU: 0 PID: 0 Comm: swapper Not tainted 
> >>> 5.6.0-rc1-next-20200212 #66
> >>> [0.00] Hardware name: Raspberry Pi 4 Model B (DT)
> >>> [0.00] Call trace:
> >>> [0.00]  dump_backtrace+0x0/0x1a0
> >>> [0.00]  show_stack+0x14/0x20
> >>> [0.00]  dump_stack+0xbc/0x104
> >>> [0.00]  panic+0x16c/0x37c
> >>> [0.00]  early_pgtable_alloc+0x30/0xa0
> >>
> >> ... really early!
> >>
> >>> [0.00]  __create_pgd_mapping+0x36c/0x588
> >>> [0.00]  map_kernel_segment+0x70/0xa4
> >>> [0.00]  paging_init+0xf4/0x528
> >>> [0.00]  setup_arch+0x250/0x5d8
> >>> [0.00]  start_kernel+0x90/0x6d8
> >>>
> >>>  
> >>> Since the same kernel boot with bootefi and that bootefi lack ramdisk 
> >>> address,
> >>
> >> Booting with EFI will cause linux to use the EFI memory map.
> >>
> >> Does your DT have a memory node? (or does it expect EFI to provide the 
> >> information)
> >>
> >>
> >>> I tried to add the address in the dtb via:
> >>> fdt addr 0x0240; fdt resize; fdt set /chosen linux,initrd-start 
> >>> 0x0270; fdt set /chosen linux,initrd-end 0x1000; bootefi 
> >>> 0x0008 0x0240
> >>> But with that, I get:
> >>> initrd not fully accessible via the linear mapping -- please check your 
> >>> bootloader ...
> >>
> >> So this one is an EFI boot, but you can't find where to put the initramfs 
> >> such that the
> >> kernel agrees its in memory.
> >>
> >> If you boot with 'efi=debug', linux will print the EFI memory map. Could 
> >> you compare that
> >> to where U-Boot thinks memory is?
> >>
> >> (it sounds like your DT memory node is missing, and your EFI memory map is 
> >> surprisingly small)
> > 
> > Hello
> > 
> > Thanks for your advices.
> > 
> > In the dtb of mainline linux:
> > /* Will be filled by the bootloader */
> > memory@0 {
> > device_type = "memory";
> > reg = <0 0 0>;
> > };
> > 
> > In uboot I have:
> > static struct mm_region bcm2711_mem_map[] = {
> > {
> > .virt = 0xUL,
> > .phys = 0xUL,
> > .size = 0xfe00UL,
> > .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
> >  PTE_BLOCK_INNER_SHARE
> > }, {
> > .virt = 0xfc00UL,
> > .phys = 0xfc00UL,
> > .size = 0x0380UL,
> > .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
> >  PTE_BLOCK_NON_SHARE |
> >  PTE_BLOCK_PXN | PTE_BLOCK_UXN
> > }, {
> > /* List terminator */
> > 0,
> > }
> > };
> > But I dont know if uboot use that for filling the memory node.
> 
> No it doesn't. U-Boot uses the DT from the firmware and passes this to the
> kernel. But it seems you pass instead your own device-tree to the kernel, so 
> you
> will need to update the memory node to show the available memory on you board.
> 

I dont understand, in the Linux commit "ARM: dts: Add minimal Raspberry Pi 4 
support" I read:
The RPi 4 is available in 3 different variants (1, 2 and 4 GB RAM), so leave 
the memory size to zero and let the bootloader take care of it.
But if uboot dont fill that...
So the DTB in mainline is wrong, right ?

Regards


Re: RPI4: fail too boot with an initrd

2020-02-17 Thread Matthias Brugger



On 17/02/2020 11:37, LABBE Corentin wrote:
> On Fri, Feb 14, 2020 at 06:15:27PM +, James Morse wrote:
>> Hi Corentin,
>>
>> On 14/02/2020 13:27, LABBE Corentin wrote:
>>> Since the inclusion of the "enable network support in RPi4 config" serie on 
>>> uboot, I
>>> have started to work on adding the rpi4 in kernelCI.
>>> But I fail to succeed in using a kernel/dtb/ramdisk downloaded via tftp.
>>>
>>> Using booti I hit:
>>> [0.00] Linux version 5.6.0-rc1-next-20200212 
>>> (clabbe@build2-bionic-1804) (gcc version 7.4.1 20181213 [linaro-7.4-2019.02 
>>> revision 56ec6f6b99cc167ff0c2f8e1a2eed33b1edc85d4] (LinaroGCC 
>>> 7.4-2019.02)) #66 SMP PREEMPT Wed Feb 12 10:14:20 UTC 2020
>>> [0.00] Machine model: Raspberry Pi 4 Model B
>>> [0.00] earlycon: uart0 at MMIO32 0xfe215040 (options '')
>>> [0.00] printk: bootconsole [uart0] enabled
>>> [0.00] efi: Getting EFI parameters from FDT:
>>> [0.00] efi: UEFI not found.
>>
>> So no EFI,
>>
>>> [0.00] OF: reserved mem: failed to allocate memory for node 
>>> 'linux,cma'
>>
>> Out of memory.
>>
>>> [0.00] cma: Failed to reserve 32 MiB
>>> [0.00] Kernel panic - not syncing: Failed to allocate page table 
>>> page
>>
>> Out of memory...
>>
>>> [0.00] CPU: 0 PID: 0 Comm: swapper Not tainted 
>>> 5.6.0-rc1-next-20200212 #66
>>> [0.00] Hardware name: Raspberry Pi 4 Model B (DT)
>>> [0.00] Call trace:
>>> [0.00]  dump_backtrace+0x0/0x1a0
>>> [0.00]  show_stack+0x14/0x20
>>> [0.00]  dump_stack+0xbc/0x104
>>> [0.00]  panic+0x16c/0x37c
>>> [0.00]  early_pgtable_alloc+0x30/0xa0
>>
>> ... really early!
>>
>>> [0.00]  __create_pgd_mapping+0x36c/0x588
>>> [0.00]  map_kernel_segment+0x70/0xa4
>>> [0.00]  paging_init+0xf4/0x528
>>> [0.00]  setup_arch+0x250/0x5d8
>>> [0.00]  start_kernel+0x90/0x6d8
>>>
>>>  
>>> Since the same kernel boot with bootefi and that bootefi lack ramdisk 
>>> address,
>>
>> Booting with EFI will cause linux to use the EFI memory map.
>>
>> Does your DT have a memory node? (or does it expect EFI to provide the 
>> information)
>>
>>
>>> I tried to add the address in the dtb via:
>>> fdt addr 0x0240; fdt resize; fdt set /chosen linux,initrd-start 
>>> 0x0270; fdt set /chosen linux,initrd-end 0x1000; bootefi 0x0008 
>>> 0x0240
>>> But with that, I get:
>>> initrd not fully accessible via the linear mapping -- please check your 
>>> bootloader ...
>>
>> So this one is an EFI boot, but you can't find where to put the initramfs 
>> such that the
>> kernel agrees its in memory.
>>
>> If you boot with 'efi=debug', linux will print the EFI memory map. Could you 
>> compare that
>> to where U-Boot thinks memory is?
>>
>> (it sounds like your DT memory node is missing, and your EFI memory map is 
>> surprisingly small)
> 
> Hello
> 
> Thanks for your advices.
> 
> In the dtb of mainline linux:
>   /* Will be filled by the bootloader */
>   memory@0 {
>   device_type = "memory";
>   reg = <0 0 0>;
>   };
> 
> In uboot I have:
> static struct mm_region bcm2711_mem_map[] = {
> {
> .virt = 0xUL,
> .phys = 0xUL,
> .size = 0xfe00UL,
> .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
>  PTE_BLOCK_INNER_SHARE
> }, {
> .virt = 0xfc00UL,
> .phys = 0xfc00UL,
> .size = 0x0380UL,
> .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
>  PTE_BLOCK_NON_SHARE |
>  PTE_BLOCK_PXN | PTE_BLOCK_UXN
> }, {
> /* List terminator */
> 0,
> }
> };
> But I dont know if uboot use that for filling the memory node.

No it doesn't. U-Boot uses the DT from the firmware and passes this to the
kernel. But it seems you pass instead your own device-tree to the kernel, so you
will need to update the memory node to show the available memory on you board.

Regards,
Matthias

> 
> 
> Booting the rpi4 with efi=debug give:
> EFI stub: Booting Linux Kernel...
> EFI stub: EFI_RNG_PROTOCOL unavailable, no randomness supplied
> EFI stub: Using DTB from configuration table
> EFI stub: Exiting boot services and installing virtual address map...
> [0.00] Booting Linux on physical CPU 0x00 [0x410fd083]
> [0.00] Linux version 5.6.0-rc1-next-20200214 
> (clabbe@build2-bionic-1804) (gcc version 7.4.1 20181213 [linaro-7.4-2019.02 
> revision 56ec6f6b99cc167ff0c2f8e1a2eed33b1edc85d4] (Linaro GCC 7.4-2019.02)) 
> #70 SMP PREEMPT Fri Feb 14 10:54:54 UTC 2020
> [0.00] Machine model: Raspberry Pi 4 Model B
> [0.00] earlycon: uart0 at MMIO32 0xfe215040 (options '')
> [0.00] printk: bootconsole [uart0] enabled
> [0.00] efi: Getting EFI 

Re: RPI4: fail too boot with an initrd

2020-02-17 Thread LABBE Corentin
On Fri, Feb 14, 2020 at 06:15:27PM +, James Morse wrote:
> Hi Corentin,
> 
> On 14/02/2020 13:27, LABBE Corentin wrote:
> > Since the inclusion of the "enable network support in RPi4 config" serie on 
> > uboot, I
> > have started to work on adding the rpi4 in kernelCI.
> > But I fail to succeed in using a kernel/dtb/ramdisk downloaded via tftp.
> > 
> > Using booti I hit:
> > [0.00] Linux version 5.6.0-rc1-next-20200212 
> > (clabbe@build2-bionic-1804) (gcc version 7.4.1 20181213 [linaro-7.4-2019.02 
> > revision 56ec6f6b99cc167ff0c2f8e1a2eed33b1edc85d4] (LinaroGCC 
> > 7.4-2019.02)) #66 SMP PREEMPT Wed Feb 12 10:14:20 UTC 2020
> > [0.00] Machine model: Raspberry Pi 4 Model B
> > [0.00] earlycon: uart0 at MMIO32 0xfe215040 (options '')
> > [0.00] printk: bootconsole [uart0] enabled
> > [0.00] efi: Getting EFI parameters from FDT:
> > [0.00] efi: UEFI not found.
> 
> So no EFI,
> 
> > [0.00] OF: reserved mem: failed to allocate memory for node 
> > 'linux,cma'
> 
> Out of memory.
> 
> > [0.00] cma: Failed to reserve 32 MiB
> > [0.00] Kernel panic - not syncing: Failed to allocate page table 
> > page
> 
> Out of memory...
> 
> > [0.00] CPU: 0 PID: 0 Comm: swapper Not tainted 
> > 5.6.0-rc1-next-20200212 #66
> > [0.00] Hardware name: Raspberry Pi 4 Model B (DT)
> > [0.00] Call trace:
> > [0.00]  dump_backtrace+0x0/0x1a0
> > [0.00]  show_stack+0x14/0x20
> > [0.00]  dump_stack+0xbc/0x104
> > [0.00]  panic+0x16c/0x37c
> > [0.00]  early_pgtable_alloc+0x30/0xa0
> 
> ... really early!
> 
> > [0.00]  __create_pgd_mapping+0x36c/0x588
> > [0.00]  map_kernel_segment+0x70/0xa4
> > [0.00]  paging_init+0xf4/0x528
> > [0.00]  setup_arch+0x250/0x5d8
> > [0.00]  start_kernel+0x90/0x6d8
> > 
> >  
> > Since the same kernel boot with bootefi and that bootefi lack ramdisk 
> > address,
> 
> Booting with EFI will cause linux to use the EFI memory map.
> 
> Does your DT have a memory node? (or does it expect EFI to provide the 
> information)
> 
> 
> > I tried to add the address in the dtb via:
> > fdt addr 0x0240; fdt resize; fdt set /chosen linux,initrd-start 
> > 0x0270; fdt set /chosen linux,initrd-end 0x1000; bootefi 0x0008 
> > 0x0240
> > But with that, I get:
> > initrd not fully accessible via the linear mapping -- please check your 
> > bootloader ...
> 
> So this one is an EFI boot, but you can't find where to put the initramfs 
> such that the
> kernel agrees its in memory.
> 
> If you boot with 'efi=debug', linux will print the EFI memory map. Could you 
> compare that
> to where U-Boot thinks memory is?
> 
> (it sounds like your DT memory node is missing, and your EFI memory map is 
> surprisingly small)

Hello

Thanks for your advices.

In the dtb of mainline linux:
/* Will be filled by the bootloader */
memory@0 {
device_type = "memory";
reg = <0 0 0>;
};

In uboot I have:
static struct mm_region bcm2711_mem_map[] = {
{
.virt = 0xUL,
.phys = 0xUL,
.size = 0xfe00UL,
.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
 PTE_BLOCK_INNER_SHARE
}, {
.virt = 0xfc00UL,
.phys = 0xfc00UL,
.size = 0x0380UL,
.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
 PTE_BLOCK_NON_SHARE |
 PTE_BLOCK_PXN | PTE_BLOCK_UXN
}, {
/* List terminator */
0,
}
};
But I dont know if uboot use that for filling the memory node.


Booting the rpi4 with efi=debug give:
EFI stub: Booting Linux Kernel...
EFI stub: EFI_RNG_PROTOCOL unavailable, no randomness supplied
EFI stub: Using DTB from configuration table
EFI stub: Exiting boot services and installing virtual address map...
[0.00] Booting Linux on physical CPU 0x00 [0x410fd083]
[0.00] Linux version 5.6.0-rc1-next-20200214 
(clabbe@build2-bionic-1804) (gcc version 7.4.1 20181213 [linaro-7.4-2019.02 
revision 56ec6f6b99cc167ff0c2f8e1a2eed33b1edc85d4] (Linaro GCC 7.4-2019.02)) 
#70 SMP PREEMPT Fri Feb 14 10:54:54 UTC 2020
[0.00] Machine model: Raspberry Pi 4 Model B
[0.00] earlycon: uart0 at MMIO32 0xfe215040 (options '')
[0.00] printk: bootconsole [uart0] enabled
[0.00] efi: Getting EFI parameters from FDT:
[0.00] efi:   System Table: 0x3b365590
[0.00] efi:   MemMap Address: 0x38484040
[0.00] efi:   MemMap Size: 0x0410
[0.00] efi:   MemMap Desc. Size: 0x0028
[0.00] efi:   MemMap Desc. Version: 0x0001
[0.00] efi: EFI v2.80 by Das U-Boot
[0.00] efi:  SMBIOS=0x39f46000  MEMRESERVE=0x38487040 
[0.00] efi: 

Re: RPI4: fail too boot with an initrd

2020-02-14 Thread James Morse
Hi Corentin,

On 14/02/2020 13:27, LABBE Corentin wrote:
> Since the inclusion of the "enable network support in RPi4 config" serie on 
> uboot, I
> have started to work on adding the rpi4 in kernelCI.
> But I fail to succeed in using a kernel/dtb/ramdisk downloaded via tftp.
> 
> Using booti I hit:
> [0.00] Linux version 5.6.0-rc1-next-20200212 
> (clabbe@build2-bionic-1804) (gcc version 7.4.1 20181213 [linaro-7.4-2019.02 
> revision 56ec6f6b99cc167ff0c2f8e1a2eed33b1edc85d4] (LinaroGCC 
> 7.4-2019.02)) #66 SMP PREEMPT Wed Feb 12 10:14:20 UTC 2020
> [0.00] Machine model: Raspberry Pi 4 Model B
> [0.00] earlycon: uart0 at MMIO32 0xfe215040 (options '')
> [0.00] printk: bootconsole [uart0] enabled
> [0.00] efi: Getting EFI parameters from FDT:
> [0.00] efi: UEFI not found.

So no EFI,

> [0.00] OF: reserved mem: failed to allocate memory for node 
> 'linux,cma'

Out of memory.

> [0.00] cma: Failed to reserve 32 MiB
> [0.00] Kernel panic - not syncing: Failed to allocate page table page

Out of memory...

> [0.00] CPU: 0 PID: 0 Comm: swapper Not tainted 
> 5.6.0-rc1-next-20200212 #66
> [0.00] Hardware name: Raspberry Pi 4 Model B (DT)
> [0.00] Call trace:
> [0.00]  dump_backtrace+0x0/0x1a0
> [0.00]  show_stack+0x14/0x20
> [0.00]  dump_stack+0xbc/0x104
> [0.00]  panic+0x16c/0x37c
> [0.00]  early_pgtable_alloc+0x30/0xa0

... really early!

> [0.00]  __create_pgd_mapping+0x36c/0x588
> [0.00]  map_kernel_segment+0x70/0xa4
> [0.00]  paging_init+0xf4/0x528
> [0.00]  setup_arch+0x250/0x5d8
> [0.00]  start_kernel+0x90/0x6d8
> 
>  
> Since the same kernel boot with bootefi and that bootefi lack ramdisk address,

Booting with EFI will cause linux to use the EFI memory map.

Does your DT have a memory node? (or does it expect EFI to provide the 
information)


> I tried to add the address in the dtb via:
> fdt addr 0x0240; fdt resize; fdt set /chosen linux,initrd-start 
> 0x0270; fdt set /chosen linux,initrd-end 0x1000; bootefi 0x0008 
> 0x0240
> But with that, I get:
> initrd not fully accessible via the linear mapping -- please check your 
> bootloader ...

So this one is an EFI boot, but you can't find where to put the initramfs such 
that the
kernel agrees its in memory.

If you boot with 'efi=debug', linux will print the EFI memory map. Could you 
compare that
to where U-Boot thinks memory is?

(it sounds like your DT memory node is missing, and your EFI memory map is 
surprisingly small)


Thanks,

James