public inbox for dri-devel@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Paul Mundt <lethal@linux-sh.org>
To: Thomas Hellstrom <thomas@shipmail.org>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Dave Airlie <airlied@redhat.com>,
	Konrad Rzeszutek Wilk <konrad@kernel.org>
Subject: Re: [PATCH] cleanup: Add 'struct dev' in the TTM layer to be passed in for DMA API calls.
Date: Wed, 23 Mar 2011 02:39:50 +0900	[thread overview]
Message-ID: <20110322173950.GA5190@linux-sh.org> (raw)
In-Reply-To: <4D769726.2030307@shipmail.org>

On Tue, Mar 08, 2011 at 09:52:54PM +0100, Thomas Hellstrom wrote:
> Is passing a struct device to the DMA api really *strictly* necessary?
> 
Yes.

> I'd like to avoid that at all cost, since we don't want pages that are 
> backing buffer objects
> (coherent pages) to be associated with a specific device.
> 
And what do you do when coherent memory for a given device can only be
obtained from that bus or that device alone?

This API permits for cases where system memory is non-coherent or you are
handling transactions across busses lacking coherency protocols between
each other and so on. There are plenty of cases where coherent DMA
buffers for PCI devices need to be allocated within the context of the
PCI bus and no other coherent memory is possible. More complex examples
exist as well. There are MFDs where DMA transactions are only coherent
with regards to local SRAM that in turn is mapped in and out of an 8051
microcontroller's address space, and so on. The kernel deals with all of
these sorts of cases by way of that dev pointer in the DMA API, and any
attempt to move beyond that scope makes non-portable assumptions about
the nature of coherent memory pools.

> The reason for this is that we probably soon will want to move ttm 
> buffer objects between devices, and that should ideally be a simple 
> operation: If the memory type the buffer object currently resides in is 
> not shared between two devices, then move it out to system memory and 
> change its struct bo_device pointer.
> 
> If pages are associated with a specific device, this will become much 
> harder. Basically we need to change backing pages and copy all the data.
> 
That won't work if a device has consistent buffers locally but system
memory is non-coherent. A not too uncommon situation for embedded
platforms with a PCI bus hanging off of the CPU local bus.

      parent reply	other threads:[~2011-03-22 17:40 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-08 15:39 [PATCH] cleanup: Add 'struct dev' in the TTM layer to be passed in for DMA API calls Konrad Rzeszutek Wilk
2011-03-08 15:39 ` [PATCH 1/2] ttm: Include the 'struct dev' when using the DMA API Konrad Rzeszutek Wilk
2011-03-08 15:39 ` [PATCH 2/2] ttm: Pass in 'struct device' to TTM so it can do DMA API on behalf of device Konrad Rzeszutek Wilk
2011-03-08 20:52 ` [PATCH] cleanup: Add 'struct dev' in the TTM layer to be passed in for DMA API calls Thomas Hellstrom
2011-03-09  0:47   ` Konrad Rzeszutek Wilk
2011-03-22 14:31   ` Konrad Rzeszutek Wilk
2011-03-23  8:13     ` Thomas Hellstrom
2011-03-23 12:51       ` Konrad Rzeszutek Wilk
2011-03-23 13:17         ` Thomas Hellstrom
2011-03-23 14:52           ` Konrad Rzeszutek Wilk
2011-03-24  7:52             ` Thomas Hellstrom
2011-03-24 14:25               ` Konrad Rzeszutek Wilk
2011-03-24 16:06                 ` Jerome Glisse
2011-03-24 16:21                   ` Konrad Rzeszutek Wilk
2011-03-25 20:00                     ` Thomas Hellstrom
2011-03-31 15:49                       ` Konrad Rzeszutek Wilk
2011-04-08 14:57                         ` Thomas Hellstrom
2011-04-08 14:58                           ` Thomas Hellstrom
2011-04-08 15:12                           ` Konrad Rzeszutek Wilk
2011-04-08 15:29                             ` Thomas Hellstrom
2011-03-23 16:19         ` Alex Deucher
2011-03-22 17:39   ` Paul Mundt [this message]

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=20110322173950.GA5190@linux-sh.org \
    --to=lethal@linux-sh.org \
    --cc=airlied@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=konrad.wilk@oracle.com \
    --cc=konrad@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thomas@shipmail.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