[iobuf] Ensure I/O buffer data sits within unshared cachelines

On platforms where DMA devices are not in the same coherency domain as
the CPU cache, we must ensure that DMA I/O buffers do not share
cachelines with other data.

Align the start and end of I/O buffers to IOB_ZLEN, which is larger
than any cacheline size we expect to encounter.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2025-07-07 13:21:24 +01:00
parent c21443f0b9
commit 19f1407ad9
3 changed files with 31 additions and 21 deletions

View File

@@ -15,11 +15,15 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <ipxe/dma.h>
/**
* Minimum I/O buffer length
* Minimum I/O buffer length and alignment
*
* alloc_iob() will round up the allocated length to this size if
* necessary. This is used on behalf of hardware that is not capable
* of auto-padding.
*
* This length must be at least as large as the largest cacheline size
* that we expect to encounter, to allow for platforms where DMA
* devices are not in the same coherency domain as the CPU cache.
*/
#define IOB_ZLEN 128