u-boot/boot
Sam Protsenko 16b80c93e2 fdt: Fix fdt_pack_reg() on 64-bit platforms
When "memory" node is being processed in fdt_pack_reg() on ARM64
platforms, an unaligned bus access might happen, which leads to
"synchronous abort" CPU exception. Consider next dts example:

    / {
        #address-cells = <2>;
        #size-cells = <1>;

        memory@80000000 {
            device_type = "memory";
            reg = <0x0 0x80000000 0x3ab00000>,
                  <0x0 0xc0000000 0x40000000>,
                  <0x8 0x80000000 0x80000000>;
        };
    };

After fdt_pack_reg() reads the first addr/size entry from such memory
node, the "p" pointer becomes 12 bytes shifted from its original value
(8 bytes for two address cells + 4 bytes for one size cell). So now it's
not 64-bit aligned, and an attempt to do 64-bit bus access to that
address will cause an abort like this:

    "Synchronous Abort" handler, esr 0x96000021, far 0xba235efc

This issue was originally reported by David Virag [1] who observed it
happening on Samsung Exynos7885 SoC (ARM64), and later the same issue
was observed on Samsung Exynos850 (ARM64).

Fix the issue by using put_unaligned_be64() helper, which takes care of
possible unaligned 64-bit accesses. That solution was proposed by Simon
Glass in the original thread [1].

[1] https://lists.denx.de/pipermail/u-boot/2023-July/522074.html

Fixes: 739a01ed8e ("fdt_support: fix an endian bug of fdt_fixup_memory_banks")
Suggested-by: Simon Glass <sjg@google.com>
Reported-by: David Virag <virag.david003@gmail.com>
Closes: https://lists.denx.de/pipermail/u-boot/2023-July/522074.html
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2024-04-12 08:53:31 -06:00
..
android_ab.c android_ab: Fix ANDROID_AB_BACKUP_OFFSET 2024-04-02 09:09:58 +02:00
boot_fit.c
bootdev-uclass.c bootstd: support scanning a single partition 2024-03-04 10:25:47 -05:00
bootflow_internal.h
bootflow_menu.c boot: superfluous assignment in bootflow_menu_new() 2024-01-18 17:50:27 -05:00
bootflow.c bootstd: support scanning a single partition 2024-03-04 10:25:47 -05:00
bootm_os.c Merge patch series "Complete decoupling of bootm logic from commands" 2023-12-21 16:10:00 -05:00
bootm.c boot: fdt: Change type of env_get_bootm_low() to phys_addr_t 2024-04-11 09:38:57 -06:00
bootmeth_cros.c x86: zboot: Rename zboot_start() to zboot_run() 2024-04-10 13:49:16 -06:00
bootmeth_cros.h
bootmeth_efi_mgr.c boot: correct the default sequence of boot methods 2024-04-08 13:03:40 +02:00
bootmeth_efi.c boot: correct finding the default EFI binary 2024-04-08 13:05:21 +02:00
bootmeth_extlinux.c lib: membuff: fix readline not returning line in case of overflow 2024-01-09 14:58:33 +01:00
bootmeth_pxe.c boot: correct the default sequence of boot methods 2024-04-08 13:03:40 +02:00
bootmeth_qfw.c
bootmeth_sandbox.c
bootmeth_script.c bootstd: sata: Add bootstd support for ahci sata 2023-10-23 13:07:12 -04:00
bootmeth-uclass.c
bootretry.c
bootstd-uclass.c
cedit.c expo: Plumb in textline to cedit 2023-10-11 15:43:55 -04:00
common_fit.c
expo_build.c expo: Support building an expo with a textline 2023-10-11 15:43:55 -04:00
expo.c expo: Correct background colour 2023-11-14 20:04:00 -07:00
fdt_region.c
fdt_simplefb.c
fdt_support.c fdt: Fix fdt_pack_reg() on 64-bit platforms 2024-04-12 08:53:31 -06:00
image-android-dt.c
image-android.c
image-board.c boot: fdt: Clean up env_get_bootm_mapsize() 2024-04-11 09:38:57 -06:00
image-cipher.c
image-fdt.c boot: fdt: Move usable variable below updated comment 2024-04-11 09:38:57 -06:00
image-fit-sig.c
image-fit.c global: Restrict use of '#include <linux/kconfig.h>' 2023-12-21 08:54:05 -05:00
image-host.c
image-pre-load.c
image-sig.c boot: Only define checksum algos when the hashes are enabled 2024-03-02 12:26:56 -05:00
image.c global: Restrict use of '#include <linux/kconfig.h>' 2023-12-21 08:54:05 -05:00
Kconfig Merge patch series "pxe: Allow extlinux booting without CMDLINE enabled" 2024-04-10 17:06:27 -06:00
Makefile Merge patch series "pxe: Allow extlinux booting without CMDLINE enabled" 2024-04-10 17:06:27 -06:00
prog_boot.c bootstd: Introduce programmatic boot 2023-12-13 11:51:24 -05:00
pxe_utils.c Merge patch series "pxe: Allow extlinux booting without CMDLINE enabled" 2024-04-10 17:06:27 -06:00
scene_internal.h expo: Plumb in textlines to a scene 2023-10-11 15:43:55 -04:00
scene_menu.c expo: Allow rendering the background of any object 2023-10-11 15:43:55 -04:00
scene_textline.c expo: Support opening a textline 2023-10-11 15:43:55 -04:00
scene.c expo: Plumb in textlines to a scene 2023-10-11 15:43:55 -04:00
vbe_request.c dm: core: Reverse the argument order in ofnode_copy_props() 2023-10-06 14:38:12 -04:00
vbe_simple_fw.c
vbe_simple_os.c dm: core: Reverse the argument order in ofnode_copy_props() 2023-10-06 14:38:12 -04:00
vbe_simple.c
vbe_simple.h
vbe.c