Re: PCI card transfer with DMA/ busmastering



On 17 Apr 2006 04:33:17 -0700, googlinggoogler@xxxxxxxxxxx wrote:

Hiya,

I have a custom PCI card that I intend on using as a coprocessor to
perform large scale matrix operations on.

As a result I wish to transfer large amounts of data to the PCI device.
Now this is where my basic questions start.

I've read a lot regarding DMA transfer, I assume this is the way to go.
When I create my driver for my PCI card does the DMA stuff need to go
here? or do I effectivly need another driver to handle DMA and
busmastering??


Your pci function driver is where your DMA operations go. You write
one function driver for your device. Might I suggest using KMDF for a
new PCI pnp driver rather than the old DDK interfaces?

About your design (described below:

1) the typical approach is to provide some sort of custom API for your
application that handles the details of communicating with your
driver, and specifically here with transferring the data buffer,
describing and initiating the operations to be performed on the data
buffer, and collecting the results when the operation completes. I
think you more or less outline that in your description. Choosing a
dll works as a way to package your api, as does a simple static
library.

2) the API is typically implemented using custom IOCTL operations that
you define. You provide a functional call interface to your
application, your api implementation uses your custom IOCTLs to
implement the API.

3) you implement the driver end of the api within your
IRP_MJ_DEVICE_CONTROL dispatch routine - which will start the
processing of your custom IOCTLs. As you are going to perform
interrupt driven DMA operations, your driver end of your interface is
going to be asynchronous.

4) the API and its implementation are the easy part. The part where
you are going to spend most of your efforts is creating the DMA
infrastructure in your driver and the asynchronous completion
mechanism for your operations.

The data is transferred to your driver within the IOCTLs you define.
As you are using DMA, you want to use METHOD_OUT_DIRECT data transfer
operations that will describe your data buffer using an MDL, which MDL
will be most useful for performing DMA.

my basic goal is this -

1)load data via CPU and "preprocess"
2) I might have functions like this in my application
DoMatrixMultiplication(buffer A, buffer B, buffer C), where buffer C
returns the result and buffer A and B are the information required
input.

I assume that it would be best to have DoMatrixMultiplication in some
kind of DLL, would this DLL need handle all my DMA stuff or is there a
means of doing this without writing it myself??

I know this is a really general question, and the reason for that is
because I'm slightly unsure at the moment of the best way to go about
achieving this, I do have a driver of sorts for the custom PCI card and
this does work, its just how I go about transfering large buffers to
and from it and where this code needs to go.

Thanks in advance

David


=====================
Mark Roddy DDK MVP
Windows Vista/2003/XP/2000 Consulting
Device and Filesystem Drivers
Hollis Technology Solutions 603-321-1032
www.hollistech.com
.



Relevant Pages

  • Re: [PATCH] PCI and PCI Hotplug update for 2.6.6-rc1
    ... The patch provides the ability for architectures to have custom ... is no way to pass that back to the driver. ... I have pci_set_dma_supported() return failure on full 32-bit DMA, ... 64MB and since this is not something most architectures have to worry ...
    (Linux-Kernel)
  • AMD64 Busmaster DMA failure !
    ... I am porting a working 32 bit driver to amd64. ... The driver does DMA as follows: ... deviceDesc.InterfaceType = PCIBus; \ ... The PCI card is a 32 bit card. ...
    (microsoft.public.development.device.drivers)
  • AMD64 Busmaster DMA failure !
    ... I am porting a working 32 bit driver to amd64. ... The driver does DMA as follows: ... deviceDesc.InterfaceType = PCIBus; \ ... The PCI card is a 32 bit card. ...
    (microsoft.public.development.device.drivers)
  • dma timeout
    ... my *old hdd* got up with dma mode. ... PIIX4: IDE controller at PCI slot 00:04.1 ... ide0 at 0x1f0-0x1f7,0x3f6 on irq 14 ... hda: attached ide-disk driver. ...
    (Debian-User)
  • Re: [RFC v2 2/5] dmaengine: Add slave DMA interface
    ... DMA engine driver is free to decide on its own. ... with, than slave transfers, which may be quite slow depending on the ...
    (Linux-Kernel)