Contributed by mbalmer on from the good-bits-come-in-groups-of-eight dept.
AMD64 and SPARC64, two of the 64-bit architectures supported by OpenBSD, contain a device called the IOMMU (Input/Output Memory Management Unit). The IOMMU allows 32-bit devices to see all of the (64-bit addressed) main memory although with a 32-bit address bus you can only address a 32-bit address space. It is a MMU that translates DMA virtual addresses to real physical addresses.
Sounds weird? Well, here is some background information by OpenBSD developer Jason Wright (jason@)
In an i386 machine with less than 4GB of memory, a 32bit device can address all of main memory with no translation assistance. The problem comes when there is more than 4GB of memory. Two solutions exist for this problem.
The more simplistic approach is to use bounce buffers. This is precisely what is done for isadma devices. isadma has a maximum address space of 16MB in the lowest physical addresses. When a buffer needs to be transferred to one of these devices, a bounce buffer is allocated from the low 16MB, the original buffer is copied into the bounce buffer, and the bounce buffer is sent to the device. This same technique will work in 32bit PCI as well where the physical address limitation is a little less tight: 0 - 4GB, but copies are expensive.
The other approach is to take advantage of the hardware address translation services of an IOMMU. When a buffer exists in physical memory outside the range addressable by the device, some adddress space is allocated from the region managed by the IOMMU. This IOMMU DVA, DMA virtual addresses, is then given to the device, and the DVA is entered into the page table of the IOMMU to point to the "real" physical address.
When the device goes to transfer the buffer, the IOMMU intercepts the transfer, finds the real physical address and puts that on the bus instead. The device is completely oblivious to the translation taking place. When the device is done, the translation entry is removed from the table.
IOMMU is present in all "real" AMD64 machines, but not the Intel clones. Unfortunately, OpenBSD support for IOMMU on the AMD machines is not quite ready for primetime (code exists, but "real life" has consorted against me finishing it). IOMMU is also present on sparc and sparc64, and has been working there since the ports were brought up. Similiar translation mechanisms exist on HPPA64 and the 64bit PowerPC's.
(Comments are closed)