Next: Kernel-Level Initiation of DMA
Up: User-Level DMA - Early
Previous: User-Level DMA - Early
A DMA operation has (at least) three arguments:
DMA (vsource, vdestination, size). Its function is
to transfer size number of bytes from
virtual address vsource, to virtual address vdestination.
To simplify their operation, DMA engines usually
operate only on physical addresses. Sometimes they are able to operate on
virtual addresses, but this functionality makes both hardware and software
more complicated: the DMA hardware would need to include translation tables
to translate virtual to physical addresses, while the operating system software
would need to keep these tables up to date. Thus, most DMA engines
require physical addresses as arguments.
Hence, the problem with starting a DMA operation from user-level
is twofold:
-
Protection: Users should not be allowed to pass physical addresses
directly to the hardware without any protection checking.
Otherwise, an erroneous or malicious application may
start DMA operations to physical addresses
on which it has no access rights, compromising security,
or damaging memory contents.
-
Atomicity: since two addresses are needed for each DMA operation,
these two addresses should be passed atomically to the DMA engine.
Otherwise, a random interleaving of processes that want to start DMA's
may result in a mix up of arguments and may start data transfers
from (to) wrong addresses.
Evangelos Markatos
Fri Nov 8 12:27:33 EET 1996