public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Russell King <rmk@arm.linux.org.uk>
To: Matt Porter <porter@cox.net>
Cc: linux-kernel@vger.kernel.org, Dave Miller <davem@redhat.com>
Subject: Re: *dma_sync_single API change to support non-coherent cpus
Date: Mon, 3 Mar 2003 19:58:25 +0000	[thread overview]
Message-ID: <20030303195825.C17997@flint.arm.linux.org.uk> (raw)
In-Reply-To: <20030303111848.A31278@home.com>; from porter@cox.net on Mon, Mar 03, 2003 at 11:18:48AM -0700

On Mon, Mar 03, 2003 at 11:18:48AM -0700, Matt Porter wrote:
> On non cache coherent processors, it is necessary to perform
> cache operations on the virtual address associated with the
> buffer to ensure consistency.  There is one problem, however,
> the current API does not provide the virtual address for the
> buffer.  It only provides the bus address in the dma_addr_t.
> On arm and mips, this is dealt with by simply doing bus_to_virt().
> However, bus_to_virt() isn't valid for all addresses that could
> have been passed into *map_single().

I find myself thinking, in passing, why we don't have these
architectures define something like the following in architecture
specific code:

	struct dma_addr {
		unsigned long cpu;
		unsigned long bus;
		unsigned long size;
	};

	#define dma_bus_addr(x)	((x).bus)
	#define dma_cpu_addr(x)	((x).cpu)

and have:

	dma_map_single(dev, &dma_addr, addr, size);

	dma_sync_single(dev, &dma_addr);

Architectures which only need the CPU address can place only that in
their structure definition, and make dma_map_single and friends no-ops.
I feel that this would get rid of all the shouting DMA_* macros found
in various pci.h header files.

This may be something considering for 2.7 though.

DaveM, as the author of the original PCI DMA API, any comments on this
(probably ill-thoughtout) idea?

-- 
Russell King (rmk@arm.linux.org.uk)                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html


  reply	other threads:[~2003-03-03 19:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-03 18:18 *dma_sync_single API change to support non-coherent cpus Matt Porter
2003-03-03 19:58 ` Russell King [this message]
2003-03-03 19:47   ` David S. Miller
2003-03-03 21:40     ` Matt Porter
2003-03-03 21:34   ` Matt Porter

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=20030303195825.C17997@flint.arm.linux.org.uk \
    --to=rmk@arm.linux.org.uk \
    --cc=davem@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=porter@cox.net \
    /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