Re: [PATCH] swiotlb: make swiotlb phys<->bus translationsarchitecture-specific

From: FUJITA Tomonori
Date: Fri May 22 2009 - 07:14:42 EST


On Thu, 21 May 2009 17:15:27 +0100
Ian Campbell <ian.campbell@xxxxxxxxxx> wrote:

> This moves swiotlb_bus_to_phys() and swiotlb_phys_to_bus() from
> lib/swiotlb.c to arch/*/include/asm/dma-mapping.h. On x86 gart_to_phys
> and phys_to_gart translations need an exported function for use from
> drivers so introduce common x86_ variants to implement the interface
> required by both.
>
> The __weak swiotlb_bus_to_virt is not currently overriden by any
> architecture therefore it can be made static again. I imagine the
> ability to override phys<->bus translations will be sufficient for any
> potential users anyhow, otherwise we can revisit this aspect.
>
> Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
> Cc: FUJITA Tomonori <fujita.tomonori@xxxxxxxxxxxxx>
> Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
> Cc: Becky Bruce <beckyb@xxxxxxxxxxxxxxxxxxx>
> Cc: Olaf Kirch <okir@xxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxx>
> Cc: Greg KH <gregkh@xxxxxxx>
> Cc: xen-devel <xendevel@xxxxxxxxxxxxxxxxxxx>
> Cc: x86 maintainers <x86@xxxxxxxxxx>
> Cc: lkml <linux-kernel@xxxxxxxxxxxxxxx>
> ---
> arch/ia64/include/asm/dma-mapping.h | 13 +++++++++++++
> arch/x86/include/asm/agp.h | 4 ++--
> arch/x86/include/asm/dma-mapping.h | 15 +++++++++++++++
> arch/x86/kernel/pci-swiotlb.c | 18 ++++++++++++++++++
> arch/x86/xen/pci-swiotlb.c | 15 ---------------
> include/linux/swiotlb.h | 5 -----
> lib/swiotlb.c | 14 +-------------
> 7 files changed, 49 insertions(+), 35 deletions(-)
>
> diff --git a/arch/ia64/include/asm/dma-mapping.h b/arch/ia64/include/asm/dma-mapping.h
> index 9f9994d..667d04e 100644
> --- a/arch/ia64/include/asm/dma-mapping.h
> +++ b/arch/ia64/include/asm/dma-mapping.h
> @@ -190,4 +190,17 @@ static inline int swiotlb_force_mapping(phys_addr_t paddr, size_t size)
> extern void *swiotlb_alloc_boot(size_t size, unsigned long nslabs);
> extern void *swiotlb_alloc(unsigned order, unsigned long nslabs);
>
> +static inline dma_addr_t swiotlb_phys_to_bus(struct device *hwdev,
> + phys_addr_t paddr)
> +{
> + return paddr;
> +}
> +
> +static inline phys_addr_t swiotlb_bus_to_phys(struct device *hwdev,
> + dma_addr_t baddr)
> +{
> + return baddr;
> +}
> +
> +

As I wrote in another mail, adding swiotlb specific code in
dma-mapping.h is wrong.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/