coreboot/tests/lib
Arthur Heymans 2d99da12a9 commonlib/bsd: Add zstd support
This adds the option to compress ramstage and payloads with zstd.

zstd compressed ramstages are typically +5% bigger than lzma compressed
ramstages. The decompressor .text section grows by 20KiB and the
decompressor needs 16KiB more heap than the lzma decompressor.

To use less heap inside the zstd decompressor the build time define
ZSTD_DECODER_INTERNAL_BUFFER is used.

Quote:
 The build macro `ZSTD_DECODER_INTERNAL_BUFFER` can be set to control
 the amount of extra memory used during decompression to store
 literals. This defaults to 64kB.  Reducing this value reduces the
 memory footprint of `ZSTD_DCtx` decompression contexts, but might
 also result in a small decompression speed cost

TEST=Booted on Lenovo X220 with zstd ramstage showed no disadvantage
     over a bigger internal buffer used.
TEST=Booted on Lenovo X220. The zstd decompressor is twice as fast
     as the lzma decompressor.
     cbmem -t shows:
   - finished ZSTD decompress (ignore for x86)         79,444 (24,494)
   - finished LZMA decompress (ignore for x86)         94,971 (45,545)

TEST=Booted on QEMU Q35, QEMU aarch64 virt, QEMU riscv RV64 with
     zstd compressed ramstage.

Change-Id: Ic1b1f53327c598d07bd83d4391e8012d41696a16
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/69893
Reviewed-by: Julius Werner <jwerner@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2025-12-20 17:36:01 +00:00
..
b64_decode-test.c b64_decode-test: Properly terminate strings before comparison 2024-08-26 18:49:54 +00:00
bootmem-test.c tree: Drop duplicated <device/{path,resource}.h> 2024-04-12 04:24:20 +00:00
cbfs-lookup-test.c commonlib/bsd: Add zstd support 2025-12-20 17:36:01 +00:00
cbfs-verification-test.c commonlib/bsd: Add zstd support 2025-12-20 17:36:01 +00:00
cbmem_console-test.c tests: Fix tests code and comments style 2022-01-14 14:29:29 +00:00
cbmem_stage_cache-test.c tests: Fix tests code and comments style 2022-01-14 14:29:29 +00:00
coreboot_table-test.c coreboot_tables: Make existing alignment conventions more explicit 2022-12-22 15:34:28 +00:00
crc_byte-test.c tests: Fix tests code and comments style 2022-01-14 14:29:29 +00:00
dimm_info_util-test.c dram/ddr5: Use the same naming convention as DDR{2,3,4} 2024-05-07 10:53:18 +00:00
edid-test.c tests: Fix tests code and comments style 2022-01-14 14:29:29 +00:00
fmap-test.c treewide: Assume FMAP_SECTION_FLASH_START = 0 2025-04-18 14:57:05 +00:00
hexstrtobin-test.c tests: Fix tests code and comments style 2022-01-14 14:29:29 +00:00
imd-test.c tests/imd: Fix invalid NULL comparison on uintptr_t 2025-09-30 11:55:53 +00:00
imd_cbmem-test.c tree: Fix cast an object of type 'nullptr_t' to 'uintptr_t' error 2024-10-29 01:41:41 +00:00
lib-test.c lib: Add __fls() (Find Last Set) 2021-12-13 02:57:07 +00:00
libgcc-test.c tests: Fix tests code and comments style 2022-01-14 14:29:29 +00:00
lzma-test.c tree: Use <stdio.h> for snprintf 2024-05-29 10:33:54 +00:00
Makefile.mk include/fmap.h: Require FMAP_SECTION_FLASH_START == 0 2025-04-18 14:56:59 +00:00
malloc-test.c malloc/memalign: Return NULL if the request is too large 2024-01-29 19:12:43 +00:00
memchr-test.c tests: Fix tests code and comments style 2022-01-14 14:29:29 +00:00
memcmp-test.c tests: Improve test output readability 2021-09-01 19:38:09 +00:00
memcpy-test.c tests: Fix tests code and comments style 2022-01-14 14:29:29 +00:00
memmove-test.c tests: Fix tests code and comments style 2022-01-14 14:29:29 +00:00
memrange-test.c tree: Drop duplicated <device/{path,resource}.h> 2024-04-12 04:24:20 +00:00
memset-test.c tests: Fix tests code and comments style 2022-01-14 14:29:29 +00:00
region_file-test.c region: Turn region_end() into an inclusive region_last() 2024-08-23 01:08:16 +00:00
rtc-test.c tree: Drop repeated words 2023-02-07 04:37:31 +00:00
spd_cache-test.c test/lib: Add non-existent DIMMs test case in spd_cache-test 2022-11-03 13:00:15 +00:00
stack-test.c tests: Fix tests code and comments style 2022-01-14 14:29:29 +00:00
string-test.c commonlib/bsd: Add strlen() and strnlen() functions 2024-08-14 03:09:03 +00:00
timestamp-test.c timestamps: Rename timestamps to make names more consistent 2022-03-08 16:06:33 +00:00
uuid-test.c tests: Improve test output readability 2021-09-01 19:38:09 +00:00
ux_locales-test.c lib: Add low battery UX locale message 2025-02-15 18:58:48 +00:00