From: Christoph Hellwig <hch@lst.de>
To: BjoernRiemerriemer@fokus.fraunhofer.de,
Matt Porter <mporter@kernel.crashing.org>,
Herbert Valerio Riedel <hvr@gnu.org>
Cc: linux-mips@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: DMA API usage in au1000_eth.c
Date: Tue, 25 Jun 2019 14:34:33 +0200 [thread overview]
Message-ID: <20190625123433.GA4607@lst.de> (raw)
Hi all,
you are the persons that have their names listed in the driver,
hope you all remember what you did 15 years ago :)
The au1000_eth driver uses the DMA API somewhat oddly. For one
it uses the DMA_ATTR_NON_CONSISTENT flag to allocate memory that
is not DMA coherent, accompanied by a comment say:
/* Allocate the data buffers
* Snooping works fine with eth on all au1xxx
*/
which suggests that it actually is DMA coherent. As far as I can
tell many amd mips platforms are DMA coherent, in which case
DMA_ATTR_NON_CONSISTENT is no-op and everything is fine here. But
it seems some are not, in which case DMA_ATTR_NON_CONSISTENT will
give us not coherent memory, in which case something would be
broken? Removing DMA_ATTR_NON_CONSISTENT would be no-op on
coherent platforms, but return an address in the cache segement
on those that are non-coherent. Do you know if the hardware
event cares?
The next issue is that it calls virt_to_phys on the return value
from dma_alloc_attrs. Why would the hardware care about the physical
address and not the DMA address (in general those are the same in
mips)?
Last but not least it stores the kernel address return from
dma_alloc_attrs in a u32 instead of a pointer, which is a little
odd and not type safe, but not otherwise dramatic.
I can prepare a patch to fix these up, but I'd like to confirm my
theory about coherent of the platform and device first.
reply other threads:[~2019-06-25 12:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190625123433.GA4607@lst.de \
--to=hch@lst.de \
--cc=BjoernRiemerriemer@fokus.fraunhofer.de \
--cc=hvr@gnu.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=mporter@kernel.crashing.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).