Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Jul 2009 11:53:06 -0700
From:      Marcel Moolenaar <xcllnt@mac.com>
To:        arm@freebsd.org, usb@freebsd.org
Subject:   About the "USB Cache and busdma usage in USB" thread
Message-ID:  <3E1658AF-67C6-4E61-B6E7-BEF528C3FF4D@mac.com>

next in thread | raw e-mail | index | archive | help
All,

I went over the thread and this is what I have to say about it:

Using busdma to manage/control CPU caches is wrong for the
following simple reason: bus_dmamap_sync() has the side-effect
of copying to and from the bounce buffer (if applicable).

CPU caches should be kept coherent by using an appropriate API.
We already have cpu_flush_dcache(). All we have to do is add
cpu_inval_dcache() and let the MD code determine how best to
do this -- even if they decide to use busdma.

In general: D-cache and I-cache control/handling should not be
hidden from MI code. It should not be treated as an artifact of
some platform. It should not be implemented by banking on some
side-effect of other function(s). We only achieve efficient
cache control if MI code calls appropriate APIs so that we can
precisely express what we need to achieve at that point.

For example: when we write a breakpoint into the text segment
of some process by using ptrace(2), the ptrace(2) code must
call an appropriate API to make sure that the I-cache is made
coherent with memory. This may require a previous D-cache
flush! We should not kluge uiomove(9) like we did on PowerPC
to deal with this. Note ARM and ia64 are still broken in this
respect.

My $0.02...

-- 
Marcel Moolenaar
xcllnt@mac.com






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3E1658AF-67C6-4E61-B6E7-BEF528C3FF4D>