]> git.ipfire.org Git - thirdparty/ipxe.git/commit
[riscv] Invalidate data cache on completed RX DMA buffers
authorMichael Brown <mcb30@ipxe.org>
Thu, 10 Jul 2025 13:33:34 +0000 (14:33 +0100)
committerMichael Brown <mcb30@ipxe.org>
Thu, 10 Jul 2025 13:39:07 +0000 (14:39 +0100)
commitbbabde8ff8182fcef738893c29a698783758a489
tree2cf11a67941a992ccedfce0390169fcf9d7b683e
parent634d9abefbb896e0c563ede4b6a7df40d0948501
[riscv] Invalidate data cache on completed RX DMA buffers

The data cache must be invalidated twice for RX DMA buffers: once
before passing ownership to the DMA device (in case the cache happens
to contain dirty data that will be written back at an undefined future
point), and once after receiving ownership from the DMA device (in
case the CPU happens to have speculatively accessed data in the buffer
while it was owned by the hardware).

Only the used portion of the buffer needs to be invalidated after
completion, since we do not care about data within the unused portion.

Update the DMA API to include the used length as an additional
parameter to dma_unmap(), and add the necessary second cache
invalidation pass to the RISC-V DMA API implementation.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/arch/riscv/core/riscv_dma.c
src/arch/riscv/include/ipxe/riscv_dma.h
src/core/dma.c
src/drivers/net/intelxl.c
src/include/ipxe/dma.h
src/include/ipxe/iobuf.h
src/interface/efi/efi_pci.c