All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Becky Bruce <beckyb@kernel.crashing.org>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
	linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org,
	Ian Campbell <Ian.Campbell@citrix.com>
Subject: Re: [PATCH V2 2/3] powerpc: Add support for swiotlb on 32-bit
Date: Thu, 21 May 2009 10:43:43 -0700	[thread overview]
Message-ID: <4A1592CF.8000208@goop.org> (raw)
In-Reply-To: <19E48A70-3332-423C-ACAD-390F940EE81C@kernel.crashing.org>

Becky Bruce wrote:
>>
>>
>> If we have something like in arch/{x86|ia64|powerpc}/dma-mapping.h:
>>
>> static inline int is_buffer_dma_capable(struct device *dev, 
>> dma_addr_t addr, size_t size)
>>
>> then we don't need two checking functions, address_needs_mapping and
>> range_needs_mapping.
>
> It's never been clear to me *why* we had both in the first place - if 
> you can explain this, I'd be grateful :)

I was about to ask the same thing.  It seems that range_needs_mapping 
should be able to do both jobs.

I think range_needs_mapping came from the Xen swiotlb changes, and 
address_needs_mapping came from your powerpc changes.   Many of the 
changes were exact overlaps; I think this was one of the few instances 
where there was a difference.

We need a range check in Xen (rather than iterating over individual 
pages) because we want to check that the underlying pages are machine 
contiguous, but I think that's also sufficient to do whatever checks you 
need to do.

The other difference is that is_buffer_dma_capable operates on a 
dma_addr_t, which presumes that you can generate a dma address and then 
test for its validity.  For Xen, it doesn't make much sense to talk 
about the dma_addr_t for memory which isn't actually dma-capable; we 
need the test to be in terms of phys_addr_t.  Given that the two 
functions are always called from the same place, that doesn't seem to 
pose a problem.

So I think the unified function would be something like:

    int range_needs_mapping(struct device *hwdev, phys_addr_t addr,
    size_t size);

which would be defined somewhere under asm/*.h.  Would that work for 
powerpc?

    J

  reply	other threads:[~2009-05-21 17:52 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-14 22:42 [PATCH V2 1/3] powerpc: Use sg->dma_length in sg_dma_len() macro on 32-bit Becky Bruce
2009-05-14 22:42 ` [PATCH V2 2/3] powerpc: Add support for swiotlb " Becky Bruce
2009-05-14 22:42   ` [PATCH V2 3/3] powerpc: Add 86xx support for SWIOTLB Becky Bruce
2009-05-15  4:49   ` [PATCH V2 2/3] powerpc: Add support for swiotlb on 32-bit Kumar Gala
2009-05-18  4:49   ` Benjamin Herrenschmidt
2009-05-18 13:25     ` Kumar Gala
2009-05-18 21:49       ` Benjamin Herrenschmidt
2009-05-19 13:04         ` Kumar Gala
2009-05-19 20:06           ` Becky Bruce
2009-05-28  4:42           ` Kumar Gala
2009-05-28  6:11             ` Benjamin Herrenschmidt
2009-05-28 13:06               ` Kumar Gala
2009-05-19  5:27   ` FUJITA Tomonori
2009-05-19  5:27     ` FUJITA Tomonori
2009-05-19 20:57     ` Becky Bruce
2009-05-21 17:43       ` Jeremy Fitzhardinge [this message]
2009-05-21 18:27         ` Becky Bruce
2009-05-21 19:01           ` Ian Campbell
2009-05-21 19:01             ` Ian Campbell
2009-05-22 10:51             ` FUJITA Tomonori
2009-05-22 10:51               ` FUJITA Tomonori
2009-05-21 20:18           ` Jeremy Fitzhardinge
2009-05-21 22:08             ` Ian Campbell
2009-05-21 22:08               ` Ian Campbell
2009-05-22 10:51             ` FUJITA Tomonori
2009-05-22 10:51               ` FUJITA Tomonori
2009-05-27 19:05               ` Becky Bruce
2009-05-27 19:05                 ` Becky Bruce
2009-05-22 11:11           ` Ian Campbell
2009-05-22 11:11             ` Ian Campbell
2009-05-22 23:55             ` Jeremy Fitzhardinge
2009-05-22 23:55               ` Jeremy Fitzhardinge
2009-05-23 22:59               ` Leon Woestenberg
2009-05-23 22:59                 ` Leon Woestenberg
2009-05-26 12:51               ` Ian Campbell
2009-05-26 12:51                 ` Ian Campbell
2009-05-27 19:11                 ` Becky Bruce
2009-05-27 19:11                   ` Becky Bruce
2009-05-27 19:05             ` Becky Bruce
2009-05-27 19:05               ` Becky Bruce
2009-05-27 20:29               ` Ian Campbell
2009-05-27 20:29                 ` Ian Campbell
2009-05-27 22:11                 ` Becky Bruce
2009-05-27 22:11                   ` Becky Bruce

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=4A1592CF.8000208@goop.org \
    --to=jeremy@goop.org \
    --cc=Ian.Campbell@citrix.com \
    --cc=beckyb@kernel.crashing.org \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.