From aedc177f000a3fd62c75f555c116ad956443ab1e Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Wed, 21 May 2025 16:51:26 -0700 Subject: [PATCH] libpayload: arm64: Reduce DMA allocator space to 1MB On arm64 device libpayload reserves 32MB of space for the DMA allocator. DMA allocators are usually just used for small bounce buffers or DMA descriptors for SPI, I2C or USB transfers, nothing that should get anywhere near the size of megabytes. Presumably the original number was just made arbitrarily large because it didn't matter. But more recently we have had security applications (guarding secrets that get received over SPI/I2C from firmware and must not be visible to the OS after handoff) that made us want to erase the entire DMA heap just to be sure no driver left a copy of any secret lying around there. This means the size is no longer fully harmless because erasing a larger heap takes more time. Change the default to 1MB which should still be more than more than enough for any real applications, but should bring the time required to erase it back into negligible territory. BUG=b:418942992 TEST=Booted Trogdor from USB. Change-Id: Id56486203c512d7ff08909cac1a016adc44d8e68 Signed-off-by: Julius Werner Reviewed-on: https://review.coreboot.org/c/coreboot/+/87780 Tested-by: build bot (Jenkins) Reviewed-by: Yu-Ping Wu --- payloads/libpayload/include/arm64/arch/mmu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/payloads/libpayload/include/arm64/arch/mmu.h b/payloads/libpayload/include/arm64/arch/mmu.h index 2b1e9e120c..9ed951d336 100644 --- a/payloads/libpayload/include/arm64/arch/mmu.h +++ b/payloads/libpayload/include/arm64/arch/mmu.h @@ -161,7 +161,7 @@ extern char _start[], _end[]; #define TCR_TBI_USED (0x0 << TCR_TBI_SHIFT) #define TCR_TBI_IGNORED (0x1 << TCR_TBI_SHIFT) -#define DMA_DEFAULT_SIZE (32 * MiB) +#define DMA_DEFAULT_SIZE (1 * MiB) #define TTB_DEFAULT_SIZE 0x100000 #define MB_SIZE (1UL << 20)