xxxxx@gmail.com wrote:
> That doesn’t mean a different kind of memory. If you’re worried about this, you just need to use GetScatterGatherList in the DMA_ADAPTER to get the page physical addresses.
GetScatterGatherList is for packet-based transfers
No, GetScatterGatherList is for discontiguous buffers.
the “problem” is when you need a static common buffer that can be discontiguous (so as to prevent allocation failures as much as possible, for example). I know that I can hoard system resources with GetScatterGatherList (well, theoretically - 64-bit hardware so bounce buffers won’t be utilized) but this is abusing the API.
No, it’s not. Look, the problem is that you have invented a category
that does not exist. There are two types of DMA transfers: common
buffer and packet. Common buffers are contiguous. If you have a
discontiguous common buffer, then it’s not a common buffer. It’s just
memory, and you will do packet DMA. SOMEHOW you have to get a
scatter/gather list for that buffer so you can do DMA, and for that
you’ll use GetScatterGatherList.
Now, if you really feel guilty about it, then I suppose you’ll free the
scatter/gather list after every use, but that seems like a waste of
resources.
I’m aware that it’s the same kind of memory and that on current hardware and versions of Windows (with disabled IOMMUs) there’s no difference between device-logical and physical addresses - I was just wondering why the DMA API hasn’t included a function that’s analogue to MmAllocatePagesForMdlEx or something similar (exallocatepool/etc),
Because it’s totally unnecessary. What would such a function do? How
would it differ from ExAllocatePool? There is no alternate pool of
memory you could use. You’ll still need a scatter/gather list at some
point. The only detail is when you create that list.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.