Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Sep 2003 23:54:48 +0200
From:      Maxime Henrion <mux@freebsd.org>
To:        Vincent Jardin <vjardin@free.fr>
Cc:        hackers@freebsd.org
Subject:   Re: BUS DMA sync
Message-ID:  <20030924215448.GF8404@elvis.mu.org>
In-Reply-To: <200309242342.55788.vjardin@free.fr>
References:  <200309242342.55788.vjardin@free.fr>

next in thread | previous in thread | raw e-mail | index | archive | help
Vincent Jardin wrote:
> Hi,
> 
> I try to understand the purpose of the PRE sync (BUS_DMASYNC_PREREAD, 
> BUS_DMASYNC_PREWRITE).
> 
> I understand POST synchronization (BUS_DMASYNC_POSTREAD, 
> BUS_DMASYNC_POSTWRITE)  when a device to memory or a memory to device 
> transfert needs to be synchronized. However, what does a synchronization 
> before a transfert mean ?

With common architectures where FreeBSD runs on, only BUS_DMASYNC_PREWRITE
and BUS_DMASYNC_POSTREAD are actually meaningful and needed.  It's good
style to use the two others where appriopriate though, because some more
exotic architecture might require it some day.

BUS_DMASYNC_PREWRITE is used to synchronize before there's a DMA tranfer
from host memory to a device.  It's needed to ensure the device will
read up-to-date memory, because recent changes to memory might still sit
in a cache, so it actually flushes the memory cache.

BUS_DMASYNC_POSTREAD is used to synchronize after a DMA transfer from
the device to host memory.  It's needed to ensure the software will get
up-to-date memory as written by the device, and not outdated memory sitting
in a cache, so it actually invalidates the memory cache.

Cheers,
Maxime



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030924215448.GF8404>