CVSROOT: /cvs Module name: src Changes by: bl...@cvs.openbsd.org 2024/08/14 12:31:33
Modified files: sys/arch/amd64/amd64: bus_dma.c sys/arch/amd64/include: bus.h Log message: Implement bounce buffering for AMD SEV in amd64 bus dma. When running as SEV guest, as indicated by variable cpu_sev_guestmode, allocate additional pages for each segment on dma map creation. These pages are mapped with the PMAP_NOCRYPT attribute, i.e. the crypt bit is not set in the PTE. Thus, these pages are shared with the hypervisor. When the map is loaded with actual pages, the address in the descriptor is replaced by the corresponding bounce buffer. Using bus_dmamap_sync(), data is copied from the encrypted pages used by guest drivers to the unencrypted bounce buffers shared with the hypervisor, and vice versa. If the kernel is not running in SEV guest mode, which means as normal host or non-SEV guest, no bounce buffers are used. from hshoexer@; based on ancient code of mickey@; OK kettenis@