KMDF DMA Question

I’m about to embark on a KDMF project for a DMA-based PCI board, and I
have a question.

In the PLX9x5x sample, which seems like a good place to start for me,
the EvtIoWrite handler creates a DMA transaction, and then executes it
with WdfDmaTransactionExecute. That eventually calls the EvtProgramDma
handler.

Is there any serialization there? That is, does
WdfDmaTransactionExecute use a queue internally to make sure there’s
only one DMA running at any given time, or does a call to
WdfDmaTransactionExecute always call EvtProgramDma? Is it the
serialization of EvtIoWrite that makes sure I don’t start a new DMA
while the last one is still running?


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Yes, the serialization is done by the WDFQUEUE. The DMA objects do not
serialize their callbacks.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Friday, May 12, 2006 10:09 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] KMDF DMA Question

I’m about to embark on a KDMF project for a DMA-based PCI board, and I
have a question.

In the PLX9x5x sample, which seems like a good place to start for me,
the EvtIoWrite handler creates a DMA transaction, and then executes it
with WdfDmaTransactionExecute. That eventually calls the EvtProgramDma
handler.

Is there any serialization there? That is, does
WdfDmaTransactionExecute use a queue internally to make sure there’s
only one DMA running at any given time, or does a call to
WdfDmaTransactionExecute always call EvtProgramDma? Is it the
serialization of EvtIoWrite that makes sure I don’t start a new DMA
while the last one is still running?


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Am I correct that, in usual Windows (no KMDF), I cannot call the
next ->AllocateAdapterChannel or the scatter-gather list routine before the
execution callback from the previous one was completed?

I always saw the calls to ->AllocateAdapterChannel guarded by StartIo or
some other kind of queue, and the next request is only delivered after return
from ->AllocateAdapterChannel. Is it a mandatory requirement?

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Doron Holan”
To: “Windows System Software Devs Interest List”
Sent: Friday, May 12, 2006 10:27 PM
Subject: RE: [ntdev] KMDF DMA Question

Yes, the serialization is done by the WDFQUEUE. The DMA objects do not
serialize their callbacks.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Friday, May 12, 2006 10:09 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] KMDF DMA Question

I’m about to embark on a KDMF project for a DMA-based PCI board, and I
have a question.

In the PLX9x5x sample, which seems like a good place to start for me,
the EvtIoWrite handler creates a DMA transaction, and then executes it
with WdfDmaTransactionExecute. That eventually calls the EvtProgramDma
handler.

Is there any serialization there? That is, does
WdfDmaTransactionExecute use a queue internally to make sure there’s
only one DMA running at any given time, or does a call to
WdfDmaTransactionExecute always call EvtProgramDma? Is it the
serialization of EvtIoWrite that makes sure I don’t start a new DMA
while the last one is still running?


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

You are correct with AllocateAdapterChannel - it tracks map register
allocation requests using slots in the device object.

GetScatterGatherList allocates he tracking information as part of the SG
list, so it can handle multiple overlapping calls.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
Sent: Friday, May 12, 2006 10:05 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] KMDF DMA Question

Am I correct that, in usual Windows (no KMDF), I cannot call the
next ->AllocateAdapterChannel or the scatter-gather list routine before
the execution callback from the previous one was completed?

I always saw the calls to ->AllocateAdapterChannel guarded by
StartIo or some other kind of queue, and the next request is only
delivered after return from ->AllocateAdapterChannel. Is it a mandatory
requirement?

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Doron Holan”
To: “Windows System Software Devs Interest List”
Sent: Friday, May 12, 2006 10:27 PM
Subject: RE: [ntdev] KMDF DMA Question

Yes, the serialization is done by the WDFQUEUE. The DMA objects do not
serialize their callbacks.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Friday, May 12, 2006 10:09 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] KMDF DMA Question

I’m about to embark on a KDMF project for a DMA-based PCI board, and I
have a question.

In the PLX9x5x sample, which seems like a good place to start for me,
the EvtIoWrite handler creates a DMA transaction, and then executes it
with WdfDmaTransactionExecute. That eventually calls the EvtProgramDma
handler.

Is there any serialization there? That is, does
WdfDmaTransactionExecute use a queue internally to make sure there’s
only one DMA running at any given time, or does a call to
WdfDmaTransactionExecute always call EvtProgramDma? Is it the
serialization of EvtIoWrite that makes sure I don’t start a new DMA
while the last one is still running?


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Is it possible to:

  • in StartIo, call ->AllocateAdapterChannel
  • and just after this, call IoStartNextPacket, without delaying this
    till the first IRP completion, and without even delaying this till the DMA
    callback?

I remember some DDK code did this in NT4 time. This only provides that only
1 IRP a time is inside the AllocateAdapterChannel itself, but the next call
to AllocateAdapterChannel can arrive before the DMA callback will be fired for
the first call.

Is it OK?

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Peter Wieland”
To: “Windows System Software Devs Interest List”
Sent: Saturday, May 13, 2006 10:00 AM
Subject: RE: [ntdev] KMDF DMA Question

You are correct with AllocateAdapterChannel - it tracks map register
allocation requests using slots in the device object.

GetScatterGatherList allocates he tracking information as part of the SG
list, so it can handle multiple overlapping calls.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
Sent: Friday, May 12, 2006 10:05 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] KMDF DMA Question

Am I correct that, in usual Windows (no KMDF), I cannot call the
next ->AllocateAdapterChannel or the scatter-gather list routine before
the execution callback from the previous one was completed?

I always saw the calls to ->AllocateAdapterChannel guarded by
StartIo or some other kind of queue, and the next request is only
delivered after return from ->AllocateAdapterChannel. Is it a mandatory
requirement?

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Doron Holan”
To: “Windows System Software Devs Interest List”
Sent: Friday, May 12, 2006 10:27 PM
Subject: RE: [ntdev] KMDF DMA Question

Yes, the serialization is done by the WDFQUEUE. The DMA objects do not
serialize their callbacks.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Friday, May 12, 2006 10:09 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] KMDF DMA Question

I’m about to embark on a KDMF project for a DMA-based PCI board, and I
have a question.

In the PLX9x5x sample, which seems like a good place to start for me,
the EvtIoWrite handler creates a DMA transaction, and then executes it
with WdfDmaTransactionExecute. That eventually calls the EvtProgramDma
handler.

Is there any serialization there? That is, does
WdfDmaTransactionExecute use a queue internally to make sure there’s
only one DMA running at any given time, or does a call to
WdfDmaTransactionExecute always call EvtProgramDma? Is it the
serialization of EvtIoWrite that makes sure I don’t start a new DMA
while the last one is still running?


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

No - you can’t call StartNextPacket until your Transfer callback has
been invoked.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
Sent: Saturday, May 13, 2006 6:22 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] KMDF DMA Question

Is it possible to:

  • in StartIo, call ->AllocateAdapterChannel
  • and just after this, call IoStartNextPacket, without delaying
    this till the first IRP completion, and without even delaying this till
    the DMA callback?

I remember some DDK code did this in NT4 time. This only provides
that only
1 IRP a time is inside the AllocateAdapterChannel itself, but the next
call to AllocateAdapterChannel can arrive before the DMA callback will
be fired for the first call.

Is it OK?

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Peter Wieland”
To: “Windows System Software Devs Interest List”
Sent: Saturday, May 13, 2006 10:00 AM
Subject: RE: [ntdev] KMDF DMA Question

You are correct with AllocateAdapterChannel - it tracks map register
allocation requests using slots in the device object.

GetScatterGatherList allocates he tracking information as part of the SG
list, so it can handle multiple overlapping calls.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
Sent: Friday, May 12, 2006 10:05 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] KMDF DMA Question

Am I correct that, in usual Windows (no KMDF), I cannot call the
next ->AllocateAdapterChannel or the scatter-gather list routine before
the execution callback from the previous one was completed?

I always saw the calls to ->AllocateAdapterChannel guarded by
StartIo or some other kind of queue, and the next request is only
delivered after return from ->AllocateAdapterChannel. Is it a mandatory
requirement?

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Doron Holan”
To: “Windows System Software Devs Interest List”
Sent: Friday, May 12, 2006 10:27 PM
Subject: RE: [ntdev] KMDF DMA Question

Yes, the serialization is done by the WDFQUEUE. The DMA objects do not
serialize their callbacks.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Friday, May 12, 2006 10:09 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] KMDF DMA Question

I’m about to embark on a KDMF project for a DMA-based PCI board, and I
have a question.

In the PLX9x5x sample, which seems like a good place to start for me,
the EvtIoWrite handler creates a DMA transaction, and then executes it
with WdfDmaTransactionExecute. That eventually calls the EvtProgramDma
handler.

Is there any serialization there? That is, does
WdfDmaTransactionExecute use a queue internally to make sure there’s
only one DMA running at any given time, or does a call to
WdfDmaTransactionExecute always call EvtProgramDma? Is it the
serialization of EvtIoWrite that makes sure I don’t start a new DMA
while the last one is still running?


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer