From f0b67aae6978c2d5f55e4b1d9e0eee20e6af2fad Mon Sep 17 00:00:00 2001 From: "Isaac J. Manjarres" Date: Fri, 13 Oct 2023 09:09:47 -0700 Subject: [PATCH] ANDROID: GKI: Enable CONFIG_SWIOTLB_DYNAMIC Newer kernels use SWIOTLB bounce buffers for DMA transactions involving kmalloc'ed buffers that are sub-cacheline aligned. This allows the minimum alignment for kmalloc'ed buffers to be reduced beyond the cacheline size, as long as SWIOTLB is enabled. Currently, a single SWIOTLB buffer is allocated at boot and is used for bounce buffering for the lifetime of the device. This means that the worse case SWIOTLB usage must be known and allocated up-front at boot, which makes enabling SWIOTLB cumbersome. Instead, CONFIG_SWIOTLB_DYNAMIC can be used to dynamically allocate SWIOTLB buffers for bounce buffering as needed. This allows the kernel to boot with a small sized SWIOTLB buffer, and continue to function by allocating memory for bounce buffers as needed. Bug: 296282294 Change-Id: If19ae55ee302f1bf97d11d8bcd0d72987939b79a Signed-off-by: Isaac J. Manjarres --- arch/arm64/configs/gki_defconfig | 1 + arch/riscv/configs/gki_defconfig | 1 + arch/x86/configs/gki_defconfig | 1 + 3 files changed, 3 insertions(+) diff --git a/arch/arm64/configs/gki_defconfig b/arch/arm64/configs/gki_defconfig index 058f8b3ea096..93853791f10c 100644 --- a/arch/arm64/configs/gki_defconfig +++ b/arch/arm64/configs/gki_defconfig @@ -680,6 +680,7 @@ CONFIG_CRYPTO_AES_ARM64_CE_BLK=y CONFIG_TRACE_MMIO_ACCESS=y CONFIG_CRC_CCITT=y CONFIG_XZ_DEC=y +CONFIG_SWIOTLB_DYNAMIC=y CONFIG_DMA_CMA=y CONFIG_PRINTK_TIME=y CONFIG_PRINTK_CALLER=y diff --git a/arch/riscv/configs/gki_defconfig b/arch/riscv/configs/gki_defconfig index e9aa70c39034..bf752ecac34f 100644 --- a/arch/riscv/configs/gki_defconfig +++ b/arch/riscv/configs/gki_defconfig @@ -621,6 +621,7 @@ CONFIG_CRYPTO_ANSI_CPRNG=y CONFIG_CRC_CCITT=y CONFIG_CRC8=y CONFIG_XZ_DEC=y +CONFIG_SWIOTLB_DYNAMIC=y CONFIG_DMA_CMA=y CONFIG_PRINTK_TIME=y CONFIG_PRINTK_CALLER=y diff --git a/arch/x86/configs/gki_defconfig b/arch/x86/configs/gki_defconfig index d29dee4058d3..509ec2ea2125 100644 --- a/arch/x86/configs/gki_defconfig +++ b/arch/x86/configs/gki_defconfig @@ -632,6 +632,7 @@ CONFIG_CRYPTO_SHA512_SSSE3=y CONFIG_CRC_CCITT=y CONFIG_CRC8=y CONFIG_XZ_DEC=y +CONFIG_SWIOTLB_DYNAMIC=y CONFIG_DMA_CMA=y CONFIG_PRINTK_TIME=y CONFIG_DYNAMIC_DEBUG_CORE=y