Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "MIPS: Octeon: Remove special handling of CONFIG_MIPS_ELF_APPENDED_DTB=y"

This reverts commit d9df9fb901d25b941ab2cfb5b570d91fb2abf7a3.

For the OCTEON boards, it need to patch the built-in DTB before using
it. Previously it judges if it is a built-in DTB by checking
fw_passed_dtb. But after commit 37e5c69ffd41 ("MIPS: head.S: Init
fw_passed_dtb to builtin DTB", the fw_passed_dtb is initialized even
when using built-in DTB. This causes the OCTEON boards boot broken due
to an unpatched built-in DTB is used. Revert the commit d9df9fb901d2 to
restore the codes before the fw_passed_dtb is used and then fix this
issue.

Fixed: 37e5c69ffd41 ("MIPS: head.S: Init fw_passed_dtb to builtin DTB")
Cc: stable@vger.kernel.org
Suggested-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Kevin Hao <haokexin@gmail.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>

authored by

Kevin Hao and committed by
Thomas Bogendoerfer
fe82de91 d9e84fb1

+6 -3
+6 -3
arch/mips/cavium-octeon/setup.c
··· 1149 1149 bool do_prune; 1150 1150 bool fill_mac; 1151 1151 1152 - if (fw_passed_dtb) { 1153 - fdt = (void *)fw_passed_dtb; 1152 + #ifdef CONFIG_MIPS_ELF_APPENDED_DTB 1153 + if (!fdt_check_header(&__appended_dtb)) { 1154 + fdt = &__appended_dtb; 1154 1155 do_prune = false; 1155 1156 fill_mac = true; 1156 1157 pr_info("Using appended Device Tree.\n"); 1157 - } else if (octeon_bootinfo->minor_version >= 3 && octeon_bootinfo->fdt_addr) { 1158 + } else 1159 + #endif 1160 + if (octeon_bootinfo->minor_version >= 3 && octeon_bootinfo->fdt_addr) { 1158 1161 fdt = phys_to_virt(octeon_bootinfo->fdt_addr); 1159 1162 if (fdt_check_header(fdt)) 1160 1163 panic("Corrupt Device Tree passed to kernel.");