memory-to-memory DMA

Hi all,

Is it possible to do memory-to-memory copy using system DMA controller?

Is any windows system API supporting this feature? Or we have to do our
own assembly language coding for that?

I think, first of all the DMA controller is capable to support this
feature. Intel 8237 support this features. But today’s PC comes with
8237 DMA controller?
Can anyone provide me with some source code to do this?

Thank you
Raja

memory-to-memory DMAOf course it is possible. Search the web. Go for it. It should slow you down rather nicely.
“Kannan, Raja” wrote in message news:xxxxx@ntdev…

Hi all,

Is it possible to do memory-to-memory copy using system DMA controller?

Is any windows system API supporting this feature? Or we have to do our own assembly language coding for that?

I think, first of all the DMA controller is capable to support this feature. Intel 8237 support this features. But today’s PC comes with 8237 DMA controller?

Can anyone provide me with some source code to do this?

Thank you
Raja

So you meant that there is a (un)documented API to support this feature?


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of David J. Craig
Sent: Wednesday, November 23, 2005 12:46 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] memory-to-memory DMA

Of course it is possible. Search the web. Go for it. It should slow
you down rather nicely.

“Kannan, Raja” wrote in message
news:xxxxx@ntdev…

Hi all,

Is it possible to do memory-to-memory copy using system DMA
controller?

Is any windows system API supporting this feature? Or we have to
do our own assembly language coding for that?

I think, first of all the DMA controller is capable to support
this feature. Intel 8237 support this features. But today’s PC comes
with 8237 DMA controller?

Can anyone provide me with some source code to do this?

Thank you
Raja


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

You are currently subscribed to ntdev as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

I read some pages from web regarding this. But every where I can only
find out the code that was implemented in mnemonics :frowning:
I think it is not possible to include assembly code(like asm block) in
driver-code. Am I right?


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of David J. Craig
Sent: Wednesday, November 23, 2005 12:46 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] memory-to-memory DMA

Of course it is possible. Search the web. Go for it. It should slow
you down rather nicely.

“Kannan, Raja” wrote in message
news:xxxxx@ntdev…

Hi all,

Is it possible to do memory-to-memory copy using system DMA
controller?

Is any windows system API supporting this feature? Or we have to
do our own assembly language coding for that?

I think, first of all the DMA controller is capable to support
this feature. Intel 8237 support this features. But today’s PC comes
with 8237 DMA controller?

Can anyone provide me with some source code to do this?

Thank you
Raja


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

You are currently subscribed to ntdev as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

You can freely use inline assembler in driver code.
You can even use privileged instructions as the kernel driver code is executed
at privilege level 0.

Dmitry

On Wednesday 23 November 2005 11:29, Kannan, Raja wrote:

I read some pages from web regarding this. But every where I can only
find out the code that was implemented in mnemonics :frowning:
I think it is not possible to include assembly code(like asm block) in
driver-code. Am I right?


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of David J. Craig
Sent: Wednesday, November 23, 2005 12:46 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] memory-to-memory DMA

Of course it is possible. Search the web. Go for it. It should slow
you down rather nicely.

“Kannan, Raja” wrote in message
> news:xxxxx@ntdev…
>
>
> Hi all,
>
> Is it possible to do memory-to-memory copy using system DMA
> controller?
>
> Is any windows system API supporting this feature? Or we have to
> do our own assembly language coding for that?
>
> I think, first of all the DMA controller is capable to support
> this feature. Intel 8237 support this features. But today’s PC comes
> with 8237 DMA controller?
>
> Can anyone provide me with some source code to do this?
>
> Thank you
> Raja
>
>
>
>
>
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag argument:
> ‘’
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
> To unsubscribe send a blank email to xxxxx@lists.osr.com

>Is it possible to do memory-to-memory copy using system DMA controller?

I think no, but even is yes - “system DMA” (in fact, ISA DMA) is a
slow-like-a-turtle legacy feature, which is used only to support the legacy
hardware like floppy, LPT port in ECP mode and ancient SoundBlaster 16.

memcpy() is surely better.

Is any windows system API supporting this feature? Or we have to do our
own assembly language coding for that?

Forget this. This DMA logic is obsolete and slow (due to sitting 2 bridges away
from the memory).

memcpy() is better.

feature. Intel 8237 support this features. But today’s PC comes with
8237 DMA controller?

The 8237-compatible logic is now a part of the PCI-to-ISA (or PCI-to-LPC)
bridge, which is in turn the part of the chipset’s “south bridge” chip.

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

No. The DMA APIs in Windows kernel do not support this, since this is a
very bad idea (slow).

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

----- Original Message -----
From: “Kannan, Raja”
To: “Windows System Software Devs Interest List”
Sent: Wednesday, November 23, 2005 11:24 AM
Subject: RE: [ntdev] memory-to-memory DMA

So you meant that there is a (un)documented API to support this feature?

________________________________

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of David J. Craig
Sent: Wednesday, November 23, 2005 12:46 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] memory-to-memory DMA

Of course it is possible. Search the web. Go for it. It should slow
you down rather nicely.

“Kannan, Raja” wrote in message
news:xxxxx@ntdev…

Hi all,

Is it possible to do memory-to-memory copy using system DMA
controller?

Is any windows system API supporting this feature? Or we have to
do our own assembly language coding for that?

I think, first of all the DMA controller is capable to support
this feature. Intel 8237 support this features. But today’s PC comes
with 8237 DMA controller?

Can anyone provide me with some source code to do this?

Thank you
Raja


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

You are currently subscribed to ntdev as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com


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

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

> You can freely use inline assembler in driver code.

You can even use privileged instructions as the kernel driver code is
executed
at privilege level 0.

In a build for a 386 machine. Not for anything else. Like x64, for
instance.

It may be slow latencywise, but if you need the processor for
other things - such as industry strength scientific
computation - you don’t want it to be wasting cycles doing rep
movs unless they’re response-time-critical. Hardwarewise, being
able to do memory to memory dma will depend on how the bridge
works; The bridge talks directly to memory, so, in theory the
bridge should be able to move data inside the memory at maximum
memory throughput. The situation is not very different from
moving data inside video memory: yes the host can see it, yes it
can use rep movs, but no the cpu can’t beat the speed of a
chip-managed bitblt.

Now, the question is, why do it unless there’s real need ? But
think, streaming video can be reduced to memory-to-memory dma,
only that the target memory is chip-managed and not
bridge-managed.

Alberto.

----- Original Message -----
From: “Maxim S. Shatskih”
To: “Windows System Software Devs Interest List”

Sent: Wednesday, November 23, 2005 5:19 AM
Subject: Re: [ntdev] memory-to-memory DMA

> No. The DMA APIs in Windows kernel do not support this,
> since this is a
> very bad idea (slow).
>
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
> ----- Original Message -----
> From: “Kannan, Raja”
> To: “Windows System Software Devs Interest List”
>
> Sent: Wednesday, November 23, 2005 11:24 AM
> Subject: RE: [ntdev] memory-to-memory DMA
>
>
> So you meant that there is a (un)documented API to support
> this feature?
>
> ________________________________
>
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of David
> J. Craig
> Sent: Wednesday, November 23, 2005 12:46 PM
> To: Windows System Software Devs Interest List
> Subject: Re:[ntdev] memory-to-memory DMA
>
>
> Of course it is possible. Search the web. Go for it. It
> should slow
> you down rather nicely.
>
> “Kannan, Raja” wrote in
> message
> news:xxxxx@ntdev…
>
>
> Hi all,
>
> Is it possible to do memory-to-memory copy using system DMA
> controller?
>
> Is any windows system API supporting this feature? Or we have
> to
> do our own assembly language coding for that?
>
> I think, first of all the DMA controller is capable to support
> this feature. Intel 8237 support this features. But today’s PC
> comes
> with 8237 DMA controller?
>
> Can anyone provide me with some source code to do this?
>
> Thank you
> Raja
>
>
>
>
>
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag
> argument:
> ‘’
> To unsubscribe send a blank email to
> xxxxx@lists.osr.com
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag
> argument: ‘’
> To unsubscribe send a blank email to
> xxxxx@lists.osr.com
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@ieee.org
> To unsubscribe send a blank email to
> xxxxx@lists.osr.com

You can use Masm. Or you can write your own special-purpose
assembler, that’s half a day’s work at best. The linker’s not
that picky…

Alberto.

----- Original Message -----
From: “Loren Wilton”
To: “Windows System Software Devs Interest List”

Sent: Wednesday, November 23, 2005 6:13 AM
Subject: Re: [ntdev] memory-to-memory DMA

>> You can freely use inline assembler in driver code.
>> You can even use privileged instructions as the kernel driver
>> code is
> executed
>> at privilege level 0.
>
> In a build for a 386 machine. Not for anything else. Like
> x64, for
> instance.
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@ieee.org
> To unsubscribe send a blank email to
> xxxxx@lists.osr.com

That’s absurd. If the DMA hardware is busy reading/writing system memory,
then the processor will have little or no access to system memory. And on
processors where the memory manager is integrated into the processor itself
(including most current AMD parts), the DMA controller is going to
essentially be asking the processor to do what the processor can already do,
and to do it much more slowly.

This also ignores the processor cache, both for coherency and for data
locality. Caching effects have a huge impact on performance. The read
portion of memcpy() will be able to make use of the processor cache. It
will also fill the cache on writes, which may not be what you want.
Fortunately, x86 (and x64, and probably most other archs) provides a
“non-temporal” instruction prefix. This prefix allows the processor to read
from cache (use existing data in the cache), but not to store data in the
cache during writes. This prevents a large block-copy from flushing data
from the processor cache(s).

In all cases, memcpy() preserves cache coherency.

Also, the front-end instruction decoders on most modern processors recognize
REP MOV sequences, and convert these into burst reads/write cycles.

Maxim is right. memcpy() is best. At least until you (original poster)
have proven otherwise, with real data from performance analysis.

– arlie

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Alberto Moreira
Sent: Wednesday, November 23, 2005 9:56 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] memory-to-memory DMA

It may be slow latencywise, but if you need the processor for other things -
such as industry strength scientific computation - you don’t want it to be
wasting cycles doing rep movs unless they’re response-time-critical.
Hardwarewise, being able to do memory to memory dma will depend on how the
bridge works; The bridge talks directly to memory, so, in theory the bridge
should be able to move data inside the memory at maximum memory throughput.
The situation is not very different from moving data inside video memory:
yes the host can see it, yes it can use rep movs, but no the cpu can’t beat
the speed of a chip-managed bitblt.

Now, the question is, why do it unless there’s real need ? But think,
streaming video can be reduced to memory-to-memory dma, only that the target
memory is chip-managed and not bridge-managed.

Alberto.

----- Original Message -----
From: “Maxim S. Shatskih”
To: “Windows System Software Devs Interest List”

Sent: Wednesday, November 23, 2005 5:19 AM
Subject: Re: [ntdev] memory-to-memory DMA

> No. The DMA APIs in Windows kernel do not support this,
> since this is a
> very bad idea (slow).
>
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
> ----- Original Message -----
> From: “Kannan, Raja”
> To: “Windows System Software Devs Interest List”
>
> Sent: Wednesday, November 23, 2005 11:24 AM
> Subject: RE: [ntdev] memory-to-memory DMA
>
>
> So you meant that there is a (un)documented API to support
> this feature?
>
> ________________________________
>
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of David
> J. Craig
> Sent: Wednesday, November 23, 2005 12:46 PM
> To: Windows System Software Devs Interest List
> Subject: Re:[ntdev] memory-to-memory DMA
>
>
> Of course it is possible. Search the web. Go for it. It
> should slow
> you down rather nicely.
>
> “Kannan, Raja” wrote in
> message
> news:xxxxx@ntdev…
>
>
> Hi all,
>
> Is it possible to do memory-to-memory copy using system DMA
> controller?
>
> Is any windows system API supporting this feature? Or we have
> to
> do our own assembly language coding for that?
>
> I think, first of all the DMA controller is capable to support
> this feature. Intel 8237 support this features. But today’s PC
> comes
> with 8237 DMA controller?
>
> Can anyone provide me with some source code to do this?
>
> Thank you
> Raja
>
>
>
>
>
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag
> argument:
> ‘’
> To unsubscribe send a blank email to
> xxxxx@lists.osr.com
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag
> argument: ‘’
> To unsubscribe send a blank email to
> xxxxx@lists.osr.com
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@ieee.org
> To unsubscribe send a blank email to
> xxxxx@lists.osr.com


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

You are currently subscribed to ntdev as: xxxxx@stonestreetone.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Kannan, Raja wrote:

Is it possible to do memory-to-memory copy using system DMA controller?

Why? Using the PC’s DMA controller to copy memory to memory is
significantly slower than copying memory using “rep movsd”.


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

> Why? Using the PC’s DMA controller to copy memory to memory is

significantly slower than copying memory using “rep movsd”.

System DMA controller runs at 8MHz, while the memory bandwidth is 800MHz :slight_smile:

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

Thank you all who responded to my questions.

I asked this question just only for my study purpose. One thing I can’t
understand; If the system DMA is legacy feature, then most of the
peripherals (PCI / ISA) should come with the bus-master DMA. Or the PCI
bus itself will not support system DMA handshakes.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S.
Shatskih
Sent: Wednesday, November 23, 2005 3:47 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] memory-to-memory DMA

Is it possible to do memory-to-memory copy using system DMA controller?

I think no, but even is yes - “system DMA” (in fact, ISA DMA) is a
slow-like-a-turtle legacy feature, which is used only to support the
legacy hardware like floppy, LPT port in ECP mode and ancient
SoundBlaster 16.

memcpy() is surely better.

Is any windows system API supporting this feature? Or we have to do our

own assembly language coding for that?

Forget this. This DMA logic is obsolete and slow (due to sitting 2
bridges away from the memory).

memcpy() is better.

feature. Intel 8237 support this features. But today’s PC comes with
8237 DMA controller?

The 8237-compatible logic is now a part of the PCI-to-ISA (or
PCI-to-LPC) bridge, which is in turn the part of the chipset’s “south
bridge” chip.

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


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

You are currently subscribed to ntdev as: xxxxx@networkgeneral.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Almost all pci devices, at this point in time, perform bus master DMA.

For your studies you should spend as little time as possible on ‘system dma’
as it is obsolete legacy pc dos crap, a relic from the 16bit platform era.

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

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Kannan, Raja
Sent: Thursday, November 24, 2005 3:48 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] memory-to-memory DMA

Thank you all who responded to my questions.

I asked this question just only for my study purpose. One
thing I can’t understand; If the system DMA is legacy
feature, then most of the peripherals (PCI / ISA) should come
with the bus-master DMA. Or the PCI bus itself will not
support system DMA handshakes.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S.
Shatskih
Sent: Wednesday, November 23, 2005 3:47 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] memory-to-memory DMA

>Is it possible to do memory-to-memory copy using system DMA
controller?

I think no, but even is yes - “system DMA” (in fact, ISA DMA)
is a slow-like-a-turtle legacy feature, which is used only to
support the legacy hardware like floppy, LPT port in ECP mode
and ancient SoundBlaster 16.

memcpy() is surely better.

>Is any windows system API supporting this feature? Or we
have to do our

>own assembly language coding for that?

Forget this. This DMA logic is obsolete and slow (due to
sitting 2 bridges away from the memory).

memcpy() is better.

>feature. Intel 8237 support this features. But today’s PC comes with
>8237 DMA controller?

The 8237-compatible logic is now a part of the PCI-to-ISA (or
PCI-to-LPC) bridge, which is in turn the part of the
chipset’s “south bridge” chip.

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


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

You are currently subscribed to ntdev as:
xxxxx@networkgeneral.com To unsubscribe send a blank
email to xxxxx@lists.osr.com


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

You are currently subscribed to ntdev as: unknown lmsubst tag
argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

>I asked this question just only for my study purpose. One thing I can’t

understand; If the system DMA is legacy feature, then most of the
peripherals (PCI / ISA) should come with the bus-master DMA. Or the PCI
bus itself will not support system DMA handshakes.

Generally, PCI hardware do not use system DMA. All PCI DMA-capable hardware are
busmasters.

Nevertheless, there was a legacy-compatibility feature called “distributed
DMA”, which allowed the PCI busmaster to impose itself as port-compatible 8237
logic, thus hiding one of the ISA DMA channels.

The only purpose of the feature was to allow PCI soundcards to be
port-compatible with SB16 (old DOS games support). I do not think whether this
is an issue anymore. The last D-DMA soundcards are around year 1999 I think.

So, 8237 logic sitting on port 0x0 is legacy only. No modern hardware uses it.

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

If you have to move n items from memory to memory, you will have
to do 2kn (for some multiplier k) memory accesses no matter how
you do it. The difference will be, will that be bursted in one
go, or distributed over time ? Will it be done directly memory
to memory, or will you hog the Front-side Bus as well ? Will you
leave your caches alone, or are you going to fill them up as
well ? Caches and memory locations are on opposite sides of the
Front-side Bus, so, any movement of data from memory to cache
may end up costing a fair amount of FSB bandwidth. If the data
being moved won’t be used by a processor, it may be best to
constrain that data movement to the same side of the FSB and not
to involve the processor at all. Also, in a well designed
machine, cache coherency is preserved by the MESI protocol (or
equivalent), which is implemented by the hardware and hence by
and large transparent to the software!

Alberto.

----- Original Message -----
From: “Arlie Davis”
To: “Windows System Software Devs Interest List”

Sent: Wednesday, November 23, 2005 1:17 PM
Subject: RE: [ntdev] memory-to-memory DMA

> That’s absurd. If the DMA hardware is busy reading/writing
> system memory,
> then the processor will have little or no access to system
> memory. And on
> processors where the memory manager is integrated into the
> processor itself
> (including most current AMD parts), the DMA controller is
> going to
> essentially be asking the processor to do what the processor
> can already do,
> and to do it much more slowly.
>
> This also ignores the processor cache, both for coherency and
> for data
> locality. Caching effects have a huge impact on performance.
> The read
> portion of memcpy() will be able to make use of the processor
> cache. It
> will also fill the cache on writes, which may not be what you
> want.
> Fortunately, x86 (and x64, and probably most other archs)
> provides a
> “non-temporal” instruction prefix. This prefix allows the
> processor to read
> from cache (use existing data in the cache), but not to store
> data in the
> cache during writes. This prevents a large block-copy from
> flushing data
> from the processor cache(s).
>
> In all cases, memcpy() preserves cache coherency.
>
> Also, the front-end instruction decoders on most modern
> processors recognize
> REP MOV sequences, and convert these into burst reads/write
> cycles.
>
> Maxim is right. memcpy() is best. At least until you
> (original poster)
> have proven otherwise, with real data from performance
> analysis.
>
> – arlie
>
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of
> Alberto Moreira
> Sent: Wednesday, November 23, 2005 9:56 AM
> To: Windows System Software Devs Interest List
> Subject: Re: [ntdev] memory-to-memory DMA
>
> It may be slow latencywise, but if you need the processor for
> other things -
> such as industry strength scientific computation - you don’t
> want it to be
> wasting cycles doing rep movs unless they’re
> response-time-critical.
> Hardwarewise, being able to do memory to memory dma will
> depend on how the
> bridge works; The bridge talks directly to memory, so, in
> theory the bridge
> should be able to move data inside the memory at maximum
> memory throughput.
> The situation is not very different from moving data inside
> video memory:
> yes the host can see it, yes it can use rep movs, but no the
> cpu can’t beat
> the speed of a chip-managed bitblt.
>
> Now, the question is, why do it unless there’s real need ? But
> think,
> streaming video can be reduced to memory-to-memory dma, only
> that the target
> memory is chip-managed and not bridge-managed.
>
> Alberto.
>
>
>
> ----- Original Message -----
> From: “Maxim S. Shatskih”
> To: “Windows System Software Devs Interest List”
>
> Sent: Wednesday, November 23, 2005 5:19 AM
> Subject: Re: [ntdev] memory-to-memory DMA
>
>
>> No. The DMA APIs in Windows kernel do not support this,
>> since this is a
>> very bad idea (slow).
>>
>> Maxim Shatskih, Windows DDK MVP
>> StorageCraft Corporation
>> xxxxx@storagecraft.com
>> http://www.storagecraft.com
>>
>> ----- Original Message -----
>> From: “Kannan, Raja”
>> To: “Windows System Software Devs Interest List”
>>
>> Sent: Wednesday, November 23, 2005 11:24 AM
>> Subject: RE: [ntdev] memory-to-memory DMA
>>
>>
>> So you meant that there is a (un)documented API to support
>> this feature?
>>
>> ________________________________
>>
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of David
>> J. Craig
>> Sent: Wednesday, November 23, 2005 12:46 PM
>> To: Windows System Software Devs Interest List
>> Subject: Re:[ntdev] memory-to-memory DMA
>>
>>
>> Of course it is possible. Search the web. Go for it. It
>> should slow
>> you down rather nicely.
>>
>> “Kannan, Raja” wrote in
>> message
>> news:xxxxx@ntdev…
>>
>>
>> Hi all,
>>
>> Is it possible to do memory-to-memory copy using system DMA
>> controller?
>>
>> Is any windows system API supporting this feature? Or we have
>> to
>> do our own assembly language coding for that?
>>
>> I think, first of all the DMA controller is capable to
>> support
>> this feature. Intel 8237 support this features. But today’s
>> PC
>> comes
>> with 8237 DMA controller?
>>
>> Can anyone provide me with some source code to do this?
>>
>> Thank you
>> Raja
>>
>>
>>
>>
>>
>>
>>
>>
>> —
>> Questions? First check the Kernel Driver FAQ at
>> http://www.osronline.com/article.cfm?id=256
>>
>> You are currently subscribed to ntdev as: unknown lmsubst tag
>> argument:
>> ‘’
>> To unsubscribe send a blank email to
>> xxxxx@lists.osr.com
>>
>> —
>> Questions? First check the Kernel Driver FAQ at
>> http://www.osronline.com/article.cfm?id=256
>>
>> You are currently subscribed to ntdev as: unknown lmsubst tag
>> argument: ‘’
>> To unsubscribe send a blank email to
>> xxxxx@lists.osr.com
>>
>>
>>
>> —
>> Questions? First check the Kernel Driver FAQ at
>> http://www.osronline.com/article.cfm?id=256
>>
>> You are currently subscribed to ntdev as: xxxxx@ieee.org
>> To unsubscribe send a blank email to
>> xxxxx@lists.osr.com
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as:
> xxxxx@stonestreetone.com
> To unsubscribe send a blank email to
> xxxxx@lists.osr.com
>
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@ieee.org
> To unsubscribe send a blank email to
> xxxxx@lists.osr.com

That’s good, but the 8237 logic runs on pathetic ISA speed of 8Mhz, which
is surely worse then the frontside bus.

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

----- Original Message -----
From: “Alberto Moreira”
To: “Windows System Software Devs Interest List”
Sent: Friday, November 25, 2005 12:59 AM
Subject: Re: [ntdev] memory-to-memory DMA

> If you have to move n items from memory to memory, you will have
> to do 2kn (for some multiplier k) memory accesses no matter how
> you do it. The difference will be, will that be bursted in one
> go, or distributed over time ? Will it be done directly memory
> to memory, or will you hog the Front-side Bus as well ? Will you
> leave your caches alone, or are you going to fill them up as
> well ? Caches and memory locations are on opposite sides of the
> Front-side Bus, so, any movement of data from memory to cache
> may end up costing a fair amount of FSB bandwidth. If the data
> being moved won’t be used by a processor, it may be best to
> constrain that data movement to the same side of the FSB and not
> to involve the processor at all. Also, in a well designed
> machine, cache coherency is preserved by the MESI protocol (or
> equivalent), which is implemented by the hardware and hence by
> and large transparent to the software!
>
> Alberto.
>
>
> ----- Original Message -----
> From: “Arlie Davis”
> To: “Windows System Software Devs Interest List”
>
> Sent: Wednesday, November 23, 2005 1:17 PM
> Subject: RE: [ntdev] memory-to-memory DMA
>
>
> > That’s absurd. If the DMA hardware is busy reading/writing
> > system memory,
> > then the processor will have little or no access to system
> > memory. And on
> > processors where the memory manager is integrated into the
> > processor itself
> > (including most current AMD parts), the DMA controller is
> > going to
> > essentially be asking the processor to do what the processor
> > can already do,
> > and to do it much more slowly.
> >
> > This also ignores the processor cache, both for coherency and
> > for data
> > locality. Caching effects have a huge impact on performance.
> > The read
> > portion of memcpy() will be able to make use of the processor
> > cache. It
> > will also fill the cache on writes, which may not be what you
> > want.
> > Fortunately, x86 (and x64, and probably most other archs)
> > provides a
> > “non-temporal” instruction prefix. This prefix allows the
> > processor to read
> > from cache (use existing data in the cache), but not to store
> > data in the
> > cache during writes. This prevents a large block-copy from
> > flushing data
> > from the processor cache(s).
> >
> > In all cases, memcpy() preserves cache coherency.
> >
> > Also, the front-end instruction decoders on most modern
> > processors recognize
> > REP MOV sequences, and convert these into burst reads/write
> > cycles.
> >
> > Maxim is right. memcpy() is best. At least until you
> > (original poster)
> > have proven otherwise, with real data from performance
> > analysis.
> >
> > – arlie
> >
> >
> >
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of
> > Alberto Moreira
> > Sent: Wednesday, November 23, 2005 9:56 AM
> > To: Windows System Software Devs Interest List
> > Subject: Re: [ntdev] memory-to-memory DMA
> >
> > It may be slow latencywise, but if you need the processor for
> > other things -
> > such as industry strength scientific computation - you don’t
> > want it to be
> > wasting cycles doing rep movs unless they’re
> > response-time-critical.
> > Hardwarewise, being able to do memory to memory dma will
> > depend on how the
> > bridge works; The bridge talks directly to memory, so, in
> > theory the bridge
> > should be able to move data inside the memory at maximum
> > memory throughput.
> > The situation is not very different from moving data inside
> > video memory:
> > yes the host can see it, yes it can use rep movs, but no the
> > cpu can’t beat
> > the speed of a chip-managed bitblt.
> >
> > Now, the question is, why do it unless there’s real need ? But
> > think,
> > streaming video can be reduced to memory-to-memory dma, only
> > that the target
> > memory is chip-managed and not bridge-managed.
> >
> > Alberto.
> >
> >
> >
> > ----- Original Message -----
> > From: “Maxim S. Shatskih”
> > To: “Windows System Software Devs Interest List”
> >
> > Sent: Wednesday, November 23, 2005 5:19 AM
> > Subject: Re: [ntdev] memory-to-memory DMA
> >
> >
> >> No. The DMA APIs in Windows kernel do not support this,
> >> since this is a
> >> very bad idea (slow).
> >>
> >> Maxim Shatskih, Windows DDK MVP
> >> StorageCraft Corporation
> >> xxxxx@storagecraft.com
> >> http://www.storagecraft.com
> >>
> >> ----- Original Message -----
> >> From: “Kannan, Raja”
> >> To: “Windows System Software Devs Interest List”
> >>
> >> Sent: Wednesday, November 23, 2005 11:24 AM
> >> Subject: RE: [ntdev] memory-to-memory DMA
> >>
> >>
> >> So you meant that there is a (un)documented API to support
> >> this feature?
> >>
> >> ________________________________
> >>
> >> From: xxxxx@lists.osr.com
> >> [mailto:xxxxx@lists.osr.com] On Behalf Of David
> >> J. Craig
> >> Sent: Wednesday, November 23, 2005 12:46 PM
> >> To: Windows System Software Devs Interest List
> >> Subject: Re:[ntdev] memory-to-memory DMA
> >>
> >>
> >> Of course it is possible. Search the web. Go for it. It
> >> should slow
> >> you down rather nicely.
> >>
> >> “Kannan, Raja” wrote in
> >> message
> >> news:xxxxx@ntdev…
> >>
> >>
> >> Hi all,
> >>
> >> Is it possible to do memory-to-memory copy using system DMA
> >> controller?
> >>
> >> Is any windows system API supporting this feature? Or we have
> >> to
> >> do our own assembly language coding for that?
> >>
> >> I think, first of all the DMA controller is capable to
> >> support
> >> this feature. Intel 8237 support this features. But today’s
> >> PC
> >> comes
> >> with 8237 DMA controller?
> >>
> >> Can anyone provide me with some source code to do this?
> >>
> >> Thank you
> >> Raja
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> —
> >> Questions? First check the Kernel Driver FAQ at
> >> http://www.osronline.com/article.cfm?id=256
> >>
> >> You are currently subscribed to ntdev as: unknown lmsubst tag
> >> argument:
> >> ‘’
> >> To unsubscribe send a blank email to
> >> xxxxx@lists.osr.com
> >>
> >> —
> >> Questions? First check the Kernel Driver FAQ at
> >> http://www.osronline.com/article.cfm?id=256
> >>
> >> You are currently subscribed to ntdev as: unknown lmsubst tag
> >> argument: ‘’
> >> To unsubscribe send a blank email to
> >> xxxxx@lists.osr.com
> >>
> >>
> >>
> >> —
> >> Questions? First check the Kernel Driver FAQ at
> >> http://www.osronline.com/article.cfm?id=256
> >>
> >> You are currently subscribed to ntdev as: xxxxx@ieee.org
> >> To unsubscribe send a blank email to
> >> xxxxx@lists.osr.com
> >
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as:
> > xxxxx@stonestreetone.com
> > To unsubscribe send a blank email to
> > xxxxx@lists.osr.com
> >
> >
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@ieee.org
> > To unsubscribe send a blank email to
> > xxxxx@lists.osr.com
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com

HAL uses map registers to translate a device or logical address to a
physical address. Since the system DMA controllers also in the same
system bus where the physical memory is connected, it may not need this
translation. But bus-master DMA controller need this because it can only
generate logical/device address.

My assumption is right?

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Mark Roddy
Sent: Thursday, November 24, 2005 6:10 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] memory-to-memory DMA

Almost all pci devices, at this point in time, perform bus master DMA.

For your studies you should spend as little time as possible on ‘system
dma’
as it is obsolete legacy pc dos crap, a relic from the 16bit platform
era.

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

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Kannan, Raja
Sent: Thursday, November 24, 2005 3:48 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] memory-to-memory DMA

Thank you all who responded to my questions.

I asked this question just only for my study purpose. One thing I
can’t understand; If the system DMA is legacy feature, then most of
the peripherals (PCI / ISA) should come with the bus-master DMA. Or
the PCI bus itself will not support system DMA handshakes.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S.
Shatskih
Sent: Wednesday, November 23, 2005 3:47 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] memory-to-memory DMA

>Is it possible to do memory-to-memory copy using system DMA
controller?

I think no, but even is yes - “system DMA” (in fact, ISA DMA) is a
slow-like-a-turtle legacy feature, which is used only to support the
legacy hardware like floppy, LPT port in ECP mode and ancient
SoundBlaster 16.

memcpy() is surely better.

>Is any windows system API supporting this feature? Or we
have to do our

>own assembly language coding for that?

Forget this. This DMA logic is obsolete and slow (due to sitting 2
bridges away from the memory).

memcpy() is better.

>feature. Intel 8237 support this features. But today’s PC comes with
>8237 DMA controller?

The 8237-compatible logic is now a part of the PCI-to-ISA (or
PCI-to-LPC) bridge, which is in turn the part of the chipset’s “south
bridge” chip.

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


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

You are currently subscribed to ntdev as:
xxxxx@networkgeneral.com To unsubscribe send a blank email to
xxxxx@lists.osr.com


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

You are currently subscribed to ntdev as: unknown lmsubst tag
argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com


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

You are currently subscribed to ntdev as: xxxxx@networkgeneral.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

To access the device register, all the device register should be mapped
with system’s register/port address space. How the other way is
possible, i.e. how the bus-master DMA can access the system memory. If
it will generate logical address in PCI bus then bus specific address
(Raw address) and logical address space are the same?

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Mark Roddy
Sent: Thursday, November 24, 2005 6:10 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] memory-to-memory DMA

Almost all pci devices, at this point in time, perform bus master DMA.

For your studies you should spend as little time as possible on ‘system
dma’
as it is obsolete legacy pc dos crap, a relic from the 16bit platform
era.

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

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Kannan, Raja
Sent: Thursday, November 24, 2005 3:48 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] memory-to-memory DMA

Thank you all who responded to my questions.

I asked this question just only for my study purpose. One thing I
can’t understand; If the system DMA is legacy feature, then most of
the peripherals (PCI / ISA) should come with the bus-master DMA. Or
the PCI bus itself will not support system DMA handshakes.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S.
Shatskih
Sent: Wednesday, November 23, 2005 3:47 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] memory-to-memory DMA

>Is it possible to do memory-to-memory copy using system DMA
controller?

I think no, but even is yes - “system DMA” (in fact, ISA DMA) is a
slow-like-a-turtle legacy feature, which is used only to support the
legacy hardware like floppy, LPT port in ECP mode and ancient
SoundBlaster 16.

memcpy() is surely better.

>Is any windows system API supporting this feature? Or we
have to do our

>own assembly language coding for that?

Forget this. This DMA logic is obsolete and slow (due to sitting 2
bridges away from the memory).

memcpy() is better.

>feature. Intel 8237 support this features. But today’s PC comes with
>8237 DMA controller?

The 8237-compatible logic is now a part of the PCI-to-ISA (or
PCI-to-LPC) bridge, which is in turn the part of the chipset’s “south
bridge” chip.

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


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

You are currently subscribed to ntdev as:
xxxxx@networkgeneral.com To unsubscribe send a blank email to
xxxxx@lists.osr.com


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

You are currently subscribed to ntdev as: unknown lmsubst tag
argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com


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

You are currently subscribed to ntdev as: xxxxx@networkgeneral.com
To unsubscribe send a blank email to xxxxx@lists.osr.com