u-boot/include/linux
Brandon Maier 4b9b25d943 lib: zstd: update to latest Linux zstd 1.5.2
Update the zstd implementation to match Linux zstd 1.5.2 from commit
2aa14b1ab2.

This was motivated by running into decompression corruption issues when
trying to uncompress files compressed with newer versions of zstd. zstd
users also claim significantly improved decompression times with newer
zstd versions which is a side benefit.

Original zstd code was copied from Linux commit 2aa14b1ab2 which is a
custom-built implementation based on zstd 1.3.1. Linux switched to an
implementation that is a copy of the upstream zstd code in Linux commit
e0c1b49f5b, this results in a large code diff. However this should make
future updates easier along with other benefits[1].

This commit is a straight mirror of the Linux zstd code, except to:
- update a few #include that do not translate cleanly
  - linux/swab.h -> asm/byteorder.h
  - linux/limits.h -> linux/kernel.h
  - linux/module.h -> linux/compat.h
- remove assert() from debug.h so it doesn't conflict with u-boot's
  assert()
- strip out the compressor code as was done in the previous u-boot zstd
- update existing zstd users to the new Linux zstd API
- change the #define for MEM_STATIC to use INLINE_KEYWORD for codesize
- add a new KConfig option that sets zstd build options to minify code
  based on zstd's ZSTD_LIB_MINIFY[2].

These changes were tested by booting a zstd 1.5.2 compressed kernel inside a
FIT. And the squashfs changes by loading a file from zstd compressed squashfs
with sqfsload. buildman was used to compile test other boards and check for
binary bloat, as follows:

> $ buildman -b zstd2 --boards dh_imx6,m53menlo,mvebu_espressobin-88f3720,sandbox,sandbox64,stm32mp15_dhcom_basic,stm32mp15_dhcor_basic,turris_mox,turris_omnia -sS
> Summary of 6 commits for 9 boards (8 threads, 1 job per thread)
> 01: Merge branch '2023-01-10-platform-updates'
>        arm:  w+   m53menlo dh_imx6
> 02: lib: zstd: update to latest Linux zstd 1.5.2
>    aarch64: (for 2/2 boards) all -3186.0 rodata +920.0 text -4106.0
>        arm: (for 5/5 boards) all +1254.4 rodata +940.0 text +314.4
>    sandbox: (for 2/2 boards) all -4452.0 data -16.0 rodata +640.0 text -5076.0

[1] e0c1b49f5b
[2] f302ad8811/lib/libzstd.mk (L31)

Signed-off-by: Brandon Maier <brandon.maier@collins.com>
[trini: Set ret to -EINVAL for the error of "failed to detect
compressed" to fix warning, drop ZSTD_SRCSIZEHINT_MAX for non-Linux host
tool builds]
Signed-off-by: Tom Rini <trini@konsulko.com>
2023-01-18 19:04:17 -05:00
..
byteorder include/linux/byteorder: fix cpu_to_be32_array() 2022-04-12 08:02:54 -04:00
clk clk: at91: add pre-requisite headers for AT91 clock architecture 2020-09-22 11:27:18 +03:00
mfd/syscon mfd: syscon: atmel-smc: Add new helpers to ease SMC regs manipulation 2022-12-08 18:06:27 +02:00
mtd mtd: rawnand: omap_elm: u-boot driver model support 2023-01-08 10:38:50 +01:00
soc/ti firmware: ti_sci: Include linux/err.h in ti_sci_protocol.h 2021-09-17 14:47:03 -04:00
unaligned
usb usb: common: move urb code to common 2022-07-12 21:59:54 +02:00
apm_bios.h WS cleanup: remove SPACE(s) followed by TAB 2021-09-30 09:08:16 -04:00
apple-mailbox.h mailbox: apple: Add driver for Apple IOP mailbox 2022-02-10 16:44:23 -05:00
arm-smccc.h firmware: psci: bind arm smccc features when discovered 2022-06-23 13:12:56 -04:00
asn1.h cmd: add asn1_compiler 2019-12-06 16:44:20 -05:00
asn1_ber_bytecode.h cmd: add asn1_compiler 2019-12-06 16:44:20 -05:00
asn1_decoder.h cmd: add asn1_compiler 2019-12-06 16:44:20 -05:00
bch.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
bitfield.h linux/bitfield.h: Add primitives for manipulating bitfields both in host- and fixed-endian 2020-07-10 11:47:12 +02:00
bitmap.h linux: bitmap.h: Add find_next_zero_area function 2022-02-08 11:00:03 -05:00
bitops.h log: convert pr_*() to logging 2021-03-01 09:54:11 -05:00
bitrev.h lib: bitrev: Sync with Linux kernel v4.17 2018-09-18 00:01:18 -06:00
bug.h bug.h: introduce WARN_ONCE 2018-06-07 17:08:06 -04:00
build_bug.h build_bug.h: add wrapper for _Static_assert 2021-07-01 16:34:32 -04:00
clk-provider.h clk: ccf: Add some helper functions for clock ops 2022-03-30 13:03:29 -04:00
compat.h cyclic: Use schedule() instead of WATCHDOG_RESET() 2022-09-18 10:26:33 +02:00
compiler-clang.h compiler*.h: sync include/linux/compiler*.h with Linux 5.7-rc5 2020-07-01 11:48:05 -04:00
compiler-gcc.h compiler*.h: sync include/linux/compiler*.h with Linux 5.7-rc5 2020-07-01 11:48:05 -04:00
compiler-intel.h compiler*.h: sync include/linux/compiler*.h with Linux 5.7-rc5 2020-07-01 11:48:05 -04:00
compiler.h WS cleanup: remove SPACE(s) followed by TAB 2021-09-30 09:08:16 -04:00
compiler_attributes.h treewide: Convert macro and uses of __section(foo) to __section("foo") 2021-05-24 14:21:30 -04:00
compiler_types.h compilers: Introduce options for forcing inlining on SPL/TPL 2020-07-01 11:48:05 -04:00
completion.h compat linux: import completion from linux 4.18 2019-04-22 11:55:58 -04:00
const.h linux/const.h: import from kernel 2018-11-20 13:08:15 +01:00
crc7.h
crc16.h crc16: Rename fs/ubifs/crc16.h to include/linux/crc16.h 2022-04-21 14:32:40 -04:00
crc32.h
ctype.h
delay.h time: Update mdelay() to delay in one large chunk 2018-12-05 06:01:35 -07:00
dma-direction.h
dma-mapping.h dma-mapping: Add header file for ARCH_DMA_MINALIGN 2020-06-02 13:06:11 -04:00
drm_dp_helper.h
edd.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
err.h linux err: make ERR_PTR/PTR_ERR architecture specific 2019-11-07 18:01:13 -05:00
errno.h
ethtool.h net: ethtool: Add ethernet speed macros for higher speeds 2021-07-26 09:18:45 +02:00
fb.h
if_ether.h linux/if_ether.h: Add VLAN related macros 2018-10-10 12:28:53 -05:00
if_vlan.h include: import if_vlan.h from Linux 2021-11-23 09:57:55 +02:00
immap_qe.h powerpc: remove support for kmtergr1 and MPC8309 2022-08-20 22:45:00 -04:00
input.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
intel-smc.h arm: socfpga: smc: Add function to get usercode 2021-04-08 17:29:13 +08:00
io.h include: linux: io: define devm_ioremap on board with ioremap 2019-04-22 11:55:58 -04:00
ioctl.h
iopoll.h iopoll: Extend read_poll_timeout macro to support variable parameters 2022-04-12 19:10:44 +02:00
ioport.h WS cleanup: remove SPACE(s) followed by TAB 2021-09-30 09:08:16 -04:00
kbuild.h
kconfig.h Introduce Verifying Program Loader (VPL) 2022-05-02 09:58:13 -04:00
kernel.h include: kernel.h: define SSIZE_MAX 2020-08-24 16:37:53 +02:00
libfdt.h libfdt: split fdt_region declarations out to <fdt_region.h> 2020-04-26 14:24:08 -06:00
libfdt_env.h fdt: Add INT32_MAX to kernel.h for libfdt 2019-11-04 18:15:32 -07:00
linkage.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
linux_string.h
list.h list.h: synchronize hlist_for_each_entry* iterators with linux 2022-11-02 08:41:49 +01:00
list_sort.h
litex.h liteeth: LiteX Ethernet device 2022-11-28 10:25:17 -05:00
log2.h include: update log2 header from the Linux kernel 2018-05-10 20:38:34 -04:00
lzo.h
math64.h lib: div64: Add support for round up of div64_u64 2022-03-09 12:34:47 +01:00
mbus.h arm: mvebu: mbus: Fix mbus driver to work also after U-Boot relocation 2022-08-23 12:35:37 +02:00
mc146818rtc.h
mdio.h linux/mdio.h: Sync with Linux kernel v4.17 2018-10-09 14:18:12 -05:00
mii.h common: Move mii_init() function out of common.h 2019-12-02 18:23:13 -05:00
netdevice.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
oid_registry.h lib: add oid registry utility 2019-12-06 16:44:20 -05:00
poison.h
posix_types.h
printk.h log: convert pr_*() to logging 2021-03-01 09:54:11 -05:00
pruss_driver.h soc: ti: pruss: Add a platform driver for PRUSS in TI SoCs 2021-07-15 17:56:04 +05:30
psci.h firmware: psci: bind arm smccc features when discovered 2022-06-23 13:12:56 -04:00
rational.h lib: rational: copy the rational fraction lib routines from Linux 2021-06-11 16:34:52 +05:30
rbtree.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
rbtree_augmented.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
screen_info.h WS cleanup: remove SPACE(s) followed by TAB 2021-09-30 09:08:16 -04:00
serial_reg.h WS cleanup: remove SPACE(s) followed by TAB 2021-09-30 09:08:16 -04:00
sizes.h linux/sizes.h: sync from kernel 2018-11-20 13:08:15 +01:00
stat.h
stddef.h stddef: Avoid warning with clang with offsetof() 2022-01-13 09:13:41 -07:00
string.h doc: replace @return by Return: 2022-01-19 18:11:34 +01:00
stringify.h
time.h lib/date: Make rtc_mktime and mktime64 Y2038-ready 2022-05-05 15:06:02 -04:00
typecheck.h
types.h common: Move type declarations to linux/types.h 2020-01-17 13:27:25 -05:00
utf.h usb: gadget: move utf8_to_utf16le to header file 2021-01-31 14:08:56 +01:00
xxhash.h lib: Add xxhash support 2019-05-05 08:48:50 -04:00
zstd.h lib: zstd: update to latest Linux zstd 1.5.2 2023-01-18 19:04:17 -05:00
zstd_errors.h lib: zstd: update to latest Linux zstd 1.5.2 2023-01-18 19:04:17 -05:00
zstd_lib.h lib: zstd: update to latest Linux zstd 1.5.2 2023-01-18 19:04:17 -05:00