[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090409061444G.fujita.tomonori@lab.ntt.co.jp>
Date: Thu, 9 Apr 2009 06:15:07 +0900
From: FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>
To: galak@...nel.crashing.org
Cc: hch@...radead.org, linux-kernel@...r.kernel.org, mingo@...e.hu,
jeremy@...p.org, fujita.tomonori@....ntt.co.jp,
ian.campbell@...rix.com, beckyb@...nel.crashing.org
Subject: Re: [PATCH 4/7] swiotlb: Allow arch override of
address_needs_mapping
On Wed, 8 Apr 2009 15:56:32 -0500
Kumar Gala <galak@...nel.crashing.org> wrote:
>
> On Apr 8, 2009, at 3:38 PM, Christoph Hellwig wrote:
>
> > On Wed, Apr 08, 2009 at 09:09:18AM -0500, Kumar Gala wrote:
> >> From: Becky Bruce <beckyb@...nel.crashing.org>
> >>
> >> Some architectures require additional checking to determine
> >> if a device can dma to an address and need to provide their
> >> own address_needs_mapping..
> >
> > Shouldn't we just move it completely to the arch? I think that ia64
> > and
> > x86 currently use the same one is more of an accident.
>
> It seems like the swiotlb code uses __weak for a number of things:
>
> lib/swiotlb.c:void * __weak __init swiotlb_alloc_boot(size_t size,
> unsigned long nslabs)
> lib/swiotlb.c:void * __weak swiotlb_alloc(unsigned order, unsigned
> long nslabs)
> lib/swiotlb.c:dma_addr_t __weak swiotlb_phys_to_bus(struct device
> *hwdev, phys_addr_t paddr)
> lib/swiotlb.c:phys_addr_t __weak swiotlb_bus_to_phys(struct device
> *hwdev, dma_addr_t baddr)
> lib/swiotlb.c:void * __weak swiotlb_bus_to_virt(struct device *hwdev,
> dma_addr_t address)
> lib/swiotlb.c:int __weak swiotlb_arch_address_needs_mapping(struct
> device *hwdev,
> lib/swiotlb.c:int __weak swiotlb_arch_range_needs_mapping(phys_addr_t
> paddr, size_t size)
>
> instead of #ifndef HAVE_ARCH_<FOO>. Not sure if there is a historical
> reason for that.
ia64 and x86_64 use swiotlb but neither need this function. And
neither need any above __weak. They were added for dom0 support.
Yeah, swiotlb is much cleaner and better if we don't add dom0 support.
About this patch, I think that we could do better. What we need to do
is allowing each architectures to have is_buffer_dma_capable().
I'm doing the dma_mapping_ops unification. I think that adding
something like is_buffer_dma_capable to dma_map_ops struct is
cleaner. Then we don't need this __weak function. But this patch is
fine by me for now.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists