From: David Daney <ddaney@caviumnetworks.com>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: linux-mips@linux-mips.org, ralf@linux-mips.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/9] MIPS: Convert DMA to use dma-mapping-common.h
Date: Mon, 27 Sep 2010 10:35:15 -0700 [thread overview]
Message-ID: <4CA0D5D3.3040700@caviumnetworks.com> (raw)
In-Reply-To: <20100927142628X.fujita.tomonori@lab.ntt.co.jp>
On 09/26/2010 10:30 PM, FUJITA Tomonori wrote:
> On Thu, 23 Sep 2010 15:38:12 -0700
> David Daney<ddaney@caviumnetworks.com> wrote:
>
>> Use asm-generic/dma-mapping-common.h to handle all DMA mapping
>> operations and establish a default get_dma_ops() that forwards all
>> operations to the existing code.
>>
>> Augment dev_archdata to carry a pointer to the struct dma_map_ops,
>> allowing DMA operations to be overridden on a per device basis.
>> Currently this is never filled in, so the default dma_map_ops are
>> used. A follow-on patch sets this for Octeon PCI devices.
>>
>> Also initialize the dma_debug system as it is now used if it is
>> configured.
>>
>> Signed-off-by: David Daney<ddaney@caviumnetworks.com>
>> ---
>> arch/mips/Kconfig | 2 +
>> arch/mips/include/asm/device.h | 15 +++-
>> arch/mips/include/asm/dma-mapping.h | 125 +++++++++++++++++--------
>> arch/mips/mm/dma-default.c | 179 +++++++++++++---------------------
>> 4 files changed, 172 insertions(+), 149 deletions(-)
>>
>> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
>> index 6c33709..e68b89f 100644
>> --- a/arch/mips/Kconfig
>> +++ b/arch/mips/Kconfig
>> @@ -14,6 +14,8 @@ config MIPS
>> select HAVE_KRETPROBES
>> select RTC_LIB if !MACH_LOONGSON
>> select GENERIC_ATOMIC64 if !64BIT
>> + select HAVE_DMA_ATTRS
>> + select HAVE_DMA_API_DEBUG
>>
>> mainmenu "Linux/MIPS Kernel Configuration"
>>
>> diff --git a/arch/mips/include/asm/device.h b/arch/mips/include/asm/device.h
>> index 06746c5..65bf274 100644
>> --- a/arch/mips/include/asm/device.h
>> +++ b/arch/mips/include/asm/device.h
>> @@ -3,4 +3,17 @@
>> *
>> * This file is released under the GPLv2
>> */
>> -#include<asm-generic/device.h>
>> +#ifndef _ASM_MIPS_DEVICE_H
>> +#define _ASM_MIPS_DEVICE_H
>> +
>> +struct mips_dma_map_ops;
>> +
>> +struct dev_archdata {
>> + /* DMA operations on that device */
>> + struct mips_dma_map_ops *dma_ops;
>> +};
>> +
>> +struct pdev_archdata {
>> +};
>> +
>> +#endif /* _ASM_MIPS_DEVICE_H*/
>> diff --git a/arch/mips/include/asm/dma-mapping.h b/arch/mips/include/asm/dma-mapping.h
>> index 18fbf7a..9a4c307 100644
>> --- a/arch/mips/include/asm/dma-mapping.h
>> +++ b/arch/mips/include/asm/dma-mapping.h
>> @@ -5,51 +5,67 @@
>> #include<asm/cache.h>
>> #include<asm-generic/dma-coherent.h>
>>
>> -void *dma_alloc_noncoherent(struct device *dev, size_t size,
>> - dma_addr_t *dma_handle, gfp_t flag);
>> +struct mips_dma_map_ops {
>> + struct dma_map_ops dma_map_ops;
>> + dma_addr_t (*phys_to_dma)(struct device *dev, phys_addr_t paddr);
>> + phys_addr_t (*dma_to_phys)(struct device *dev, dma_addr_t daddr);
>> +};
>
> The above code doesn't look great but we don't want to add phys_to_dma
> and dma_to_phys to dma_map_ops struct, and these functions on MIPS
> looks too complicated for ifdef. So I guess that we need to live with
> the above code.
>
I think you have a point here. I will attempt to move these two into a
chip specific operations vector, and leave the more generic MIPS version
with the simplified static definition.
Thanks,
David Daney
next prev parent reply other threads:[~2010-09-27 17:35 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-23 22:38 [PATCH 0/9] MIPS: Use dma-mapping-common.h and use swiotlb for Octeon David Daney
2010-09-23 22:38 ` [PATCH 1/9] MIPS: Octeon: Set dma_masks for octeon_mgmt device David Daney
2010-09-23 22:38 ` [PATCH 2/9] MIPS: Allow MAX_DMA32_PFN to be overridden David Daney
2010-09-23 22:38 ` [PATCH 3/9] MIPS: Octeon: Adjust top of DMA32 zone David Daney
2010-09-23 22:38 ` [PATCH 4/9] MIPS: Octeon: Select ZONE_DMA32 David Daney
2010-09-23 22:38 ` [PATCH 5/9] MIPS: Convert DMA to use dma-mapping-common.h David Daney
2010-09-24 1:03 ` [PATCH] MIPS: Remove plat_map_dma_mem_page() David Daney
2010-09-27 5:30 ` [PATCH 5/9] MIPS: Convert DMA to use dma-mapping-common.h FUJITA Tomonori
2010-09-27 17:35 ` David Daney [this message]
2010-09-28 0:12 ` FUJITA Tomonori
2010-09-23 22:38 ` [PATCH 8/9] MIPS: Add a platform hook for swiotlb setup David Daney
2010-09-24 16:08 ` Sergei Shtylyov
2010-09-24 16:13 ` David Daney
2010-09-24 16:32 ` Ralf Baechle
2010-09-23 22:38 ` [PATCH 9/9] MIPS: Octeon: Rewrite DMA mapping functions David Daney
2010-09-24 1:06 ` [PATCH] MIPS: Octeon: Remove plat_map_dma_mem_page() David Daney
2010-09-23 22:47 ` [PATCH 6/9] swiotlb: Declare swiotlb_init_with_default_size() David Daney
2010-09-27 16:53 ` Konrad Rzeszutek Wilk
2010-09-23 22:47 ` [PATCH 7/9] swiotlb: Make bounce buffer bounds non-static David Daney
2010-09-27 5:20 ` FUJITA Tomonori
2010-09-27 17:39 ` David Daney
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=4CA0D5D3.3040700@caviumnetworks.com \
--to=ddaney@caviumnetworks.com \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.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