Re: WDF DMA use



No you shouldn't use MmAllocateContiguousMemory. If you are planning to use common buffer and do the memory copy yourself then you should use AllocateCommonBuffer to allocate memory. Industry is moving towards IOMMU (ask DMA remapping). By using DMA interfaces, you make your driver future proof.

-Eliyas

"Avi Lousky" <AviLousky@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:65221CB2-EA84-4A96-B2D9-53383EF78284@xxxxxxxxxxxxxxxx
So map registers are my bottle neck. Here is a thought: I will use
MmAllocateContiguousMemory with HighestAcceptableAddress of 32 bit address
and configure the dma enabler (WDF_DMA_ENABLER_CONFIG) with 32 bit and
scatter gather. Will then the abstraction ignore the use map registers? Will
I be able to use several hundreds of transactions?
Is there another way to cause the system not to use map registers?
Thanks!



"Eliyas Yakub [MSFT]" wrote:

Yes it will coalesce it using map registers.

For scatter-gather DMA, map registers will be used only if the buffer lies
outside the range of memory your hardware can access.

Yes, map registers are very precious resource. You can think of them as
backup buffers allocated by the system to workaround hardware addressing
limitations. The system can only allocate so many of those. The number of
concurrent DMA transactions is constrained by the number of map registers
system can provide. You can ask for large amount of map registers by
specifying a big value in MaximumLength field, but the system may not
provide everything you ask for. Based on what the system provides, you have
to scale down your concurrency level. Take a look at the PCIDRV sample and
the logic around WdfDmaEnablerCreate call.

Since you are using Packet based DMA, one think you should note is that you
cannot initiate more than one DMA transactions concurrently. This is a
limitation imposed by the DMA sub-system because of the way it waits for the
map-registers to be made available. Framework has logic to enforce this
limitation.

-Eliyas



.



Relevant Pages

  • Re: NdisAllocateMemoryWithTag(Priority) -> Does it ensure Congtiguous physical memory by default
    ... I believe in W2K8 if your device does 64 bit DMA, when you call NdisMAllocateSharedMemory you will get high physical addresses before getting low addresses. ... NDIS does not provide an API to allocate physically contiguous memory outside what HAL DMA APIs provide. ...
    (microsoft.public.development.device.drivers)
  • Re: 1G DMA buffer under XP - how?
    ... system memory, and what is address 0 to the controller could be something ... so only the HAL's DMA routines can allocate ... common buffer correctly in all situations. ... My card is happy with any physical address> below 4G, and I can tell this call to only allocate below the given> HighestAcceptableAddress. ...
    (microsoft.public.development.device.drivers)
  • How to handle a specific DMA configuration ?
    ... My physical memory mapping is a bit special: ... last 128MB are usable for DMA. ... My problem is the allocation of skbuff. ... even if a I allow Linux to allocate memory between ...
    (Linux-Kernel)
  • Re: [PATCH 1/1] Userspace I/O (UIO): Add support for userspace DMA (corrected)
    ... from userspace by extending the Userspace IO driver. ... I consider your idea of having DMA coherent memory allocatable from userspace ... Please don't fill information into the allocated memory. ... Userspace can allocate new DMA memory by using some magic number as the offset ...
    (Linux-Kernel)
  • Re: WDF DMA use
    ... I would like to design a driver that will use DMA abstraction, ... common buffer to allocate memory and copying fragments to a contiguous ... AllocateCommonBuffer to allocate memory. ... Is there another way to cause the system not to use map registers? ...
    (microsoft.public.development.device.drivers)