Skip to contentSkip to conversation

question: malta doesn't use a1 for fdt from bootloader

PATCH [email protected] 2 participants 3 messages Dec 22, 2023 – Jan 3, 2024 MIPS

lore
Share & tools
lore
#0 lore raw

Newbie question:

I noticed while writing some test automation with QEMU and U-Boot that the Malta kernel appears to ignore any DTB provided by the bootloader, in favour of using the one embedded into the kernel image. Is there a reason behind this, or is it just not a thing that's been changed since the board was converted to use device tree?

I patched my own kernel to check $a1 as the "mips generic" kernel does, and it seems to work, but maybe I'm missing something? I did have to rebuild U-Boot with different CONFIG options to make use of it (I don't khow what real hardware Malta uses for a bootloader) so perhaps it has limited use.

If the change is acceptable in principle I'll tidy it up and submit a patch with all the proper procedure.

Opinions welcome

-dan

arch/mips/mti-malta/malta-setup.c +3 -1
index 21cb3ac1237b..52e731f9b4e2 100644
@@ -192,7 +192,9 @@ static void __init bonito_quirks_setup(void)
 
 void __init *plat_get_fdt(void)
 {
-       return (void *)__dtb_start;
+       return (fw_arg0 == -2) ?
+               (void *) (KSEG1ADDR(fw_arg1)) :
+               (void *) __dtb_start;
 }
 
 void __init plat_mem_setup(void)
#1 lore raw
Quoted 8 lines · 在 2023/12/22 17:51, [email protected] 写道:

Newbie question:

I noticed while writing some test automation with QEMU and U-Boot that the Malta kernel appears to ignore any DTB provided by the bootloader, in favour of using the one embedded into the kernel image. Is there a reason behind this, or is it just not a thing that's been changed since the board was converted to use device tree?

Hi,

It's a bit of history that DeviceTree passed by YAMON bootloader to kernel does not compatible with upstream kernel's devicetree bindings, so we decided to just omit it.

Quoted 9 lines

I patched my own kernel to check $a1 as the "mips generic" kernel does, and it seems to work, but maybe I'm missing something? I did have to rebuild U-Boot with different CONFIG options to make use of it (I don't khow what real hardware Malta uses for a bootloader) so perhaps it has limited use.

If the change is acceptable in principle I'll tidy it up and submit a patch with all the proper procedure.

I'm not sure if this is ok for YAMON-DT systems, will check on those systems.

Thanks
- Jiaxun

Quoted 22 lines

Opinions welcome

(quoted diff) +0 -1
-dan
arch/mips/mti-malta/malta-setup.c +3 -1
index 21cb3ac1237b..52e731f9b4e2 100644
@@ -192,7 +192,9 @@ static void __init bonito_quirks_setup(void)
 
  void __init *plat_get_fdt(void)
  {
-       return (void *)__dtb_start;
+       return (fw_arg0 == -2) ?
+               (void *) (KSEG1ADDR(fw_arg1)) :
+               (void *) __dtb_start;
  }
 
  void __init plat_mem_setup(void)
#2 lore raw
Quoted 10 lines · 在2023年12月25日十二月 下午1:33,Jiaxun Yang写道:
Quoted 8 lines · 在 2023/12/22 17:51, [email protected] 写道:

Newbie question:

I noticed while writing some test automation with QEMU and U-Boot that the Malta kernel appears to ignore any DTB provided by the bootloader, in favour of using the one embedded into the kernel image. Is there a reason behind this, or is it just not a thing that's been changed since the board was converted to use device tree?

Quoted 5 lines

Hi,

It's a bit of history that DeviceTree passed by YAMON bootloader to kernel does not compatible with upstream kernel's devicetree bindings, so we decided to just omit it.

Hi Dan,

I checked malta YAMON firmware release and can confirm that it is safe on to do so. These firmwares won't set fw_arg0 to -2.

I think you can make it a patch.

Thanks
- Jiaxun

Quoted 38 lines
Quoted 10 lines

I patched my own kernel to check $a1 as the "mips generic" kernel does, and it seems to work, but maybe I'm missing something? I did have to rebuild U-Boot with different CONFIG options to make use of it (I don't khow what real hardware Malta uses for a bootloader) so perhaps it has limited use.

If the change is acceptable in principle I'll tidy it up and submit a patch with all the proper procedure.

I'm not sure if this is ok for YAMON-DT systems, will check on those systems.

Thanks
- Jiaxun

Quoted 22 lines

Opinions welcome

(quoted diff) +0 -1
-dan
arch/mips/mti-malta/malta-setup.c +3 -1
index 21cb3ac1237b..52e731f9b4e2 100644
@@ -192,7 +192,9 @@ static void __init bonito_quirks_setup(void)
 
  void __init *plat_get_fdt(void)
  {
-       return (void *)__dtb_start;
+       return (fw_arg0 == -2) ?
+               (void *) (KSEG1ADDR(fw_arg1)) :
+               (void *) __dtb_start;
  }
 
  void __init plat_mem_setup(void)
Signature · 1 line
- Jiaxun