From: Ian Campbell <ian.campbell@citrix.com>
To: linux-kernel@vger.kernel.org
Cc: Ian Campbell <ian.campbell@citrix.com>,
FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
Ingo Molnar <mingo@elte.hu>,
Jeremy Fitzhardinge <jeremy@goop.org>,
Tony Luck <tony.luck@intel.com>,
linux-ia64@vger.kernel.org
Subject: [PATCH 1/9] ia64: introduce arch-specific dma-mapping interfaces
Date: Fri, 29 May 2009 08:43:55 +0000 [thread overview]
Message-ID: <1243586643-5554-2-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1243586643-5554-1-git-send-email-ian.campbell@citrix.com>
dma_map_range is intended to replace usage of both
swiotlb_arch_range_needs_mapping and
swiotlb_arch_address_needs_mapping as __weak functions as well as
replacing is_buffer_dma_capable.
phys_to_dma and dma_to_phys are intended to replace
swiotlb_phys_to_bus and swiotlb_bus_to_phys. I choose to use dma
rather than bus since a) it matches the parameters and b) avoids
confusion on x86 with the existing (but deprecated) virt_to_bus
function which relates to ISA device DMA.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: linux-ia64@vger.kernel.org
---
arch/ia64/include/asm/dma-mapping.h | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/arch/ia64/include/asm/dma-mapping.h b/arch/ia64/include/asm/dma-mapping.h
index 36c0009..7250e1a 100644
--- a/arch/ia64/include/asm/dma-mapping.h
+++ b/arch/ia64/include/asm/dma-mapping.h
@@ -174,4 +174,27 @@ dma_cache_sync (struct device *dev, void *vaddr, size_t size,
#define dma_is_consistent(d, h) (1) /* all we do is coherent memory... */
+static inline dma_addr_t phys_to_dma(struct device *hwdev, phys_addr_t paddr)
+{
+ return paddr;
+}
+
+static inline phys_addr_t dma_to_phys(struct device *hwdev, dma_addr_t daddr)
+{
+ return daddr;
+}
+
+static inline bool dma_map_range(struct device *dev, u64 mask,
+ phys_addr_t addr, size_t size,
+ dma_addr_t *dma_addr_p)
+{
+ dma_addr_t dma_addr = phys_to_dma(dev, addr);
+
+ if (dma_addr + size > mask)
+ return false;
+
+ *dma_addr_p = dma_addr;
+ return true;
+}
+
#endif /* _ASM_IA64_DMA_MAPPING_H */
--
1.5.6.5
WARNING: multiple messages have this Message-ID (diff)
From: Ian Campbell <ian.campbell@citrix.com>
To: <linux-kernel@vger.kernel.org>
Cc: Ian Campbell <ian.campbell@citrix.com>,
FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
Ingo Molnar <mingo@elte.hu>,
Jeremy Fitzhardinge <jeremy@goop.org>,
Tony Luck <tony.luck@intel.com>, <linux-ia64@vger.kernel.org>
Subject: [PATCH 1/9] ia64: introduce arch-specific dma-mapping interfaces
Date: Fri, 29 May 2009 09:43:55 +0100 [thread overview]
Message-ID: <1243586643-5554-2-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1243586643-5554-1-git-send-email-ian.campbell@citrix.com>
dma_map_range is intended to replace usage of both
swiotlb_arch_range_needs_mapping and
swiotlb_arch_address_needs_mapping as __weak functions as well as
replacing is_buffer_dma_capable.
phys_to_dma and dma_to_phys are intended to replace
swiotlb_phys_to_bus and swiotlb_bus_to_phys. I choose to use dma
rather than bus since a) it matches the parameters and b) avoids
confusion on x86 with the existing (but deprecated) virt_to_bus
function which relates to ISA device DMA.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: linux-ia64@vger.kernel.org
---
arch/ia64/include/asm/dma-mapping.h | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/arch/ia64/include/asm/dma-mapping.h b/arch/ia64/include/asm/dma-mapping.h
index 36c0009..7250e1a 100644
--- a/arch/ia64/include/asm/dma-mapping.h
+++ b/arch/ia64/include/asm/dma-mapping.h
@@ -174,4 +174,27 @@ dma_cache_sync (struct device *dev, void *vaddr, size_t size,
#define dma_is_consistent(d, h) (1) /* all we do is coherent memory... */
+static inline dma_addr_t phys_to_dma(struct device *hwdev, phys_addr_t paddr)
+{
+ return paddr;
+}
+
+static inline phys_addr_t dma_to_phys(struct device *hwdev, dma_addr_t daddr)
+{
+ return daddr;
+}
+
+static inline bool dma_map_range(struct device *dev, u64 mask,
+ phys_addr_t addr, size_t size,
+ dma_addr_t *dma_addr_p)
+{
+ dma_addr_t dma_addr = phys_to_dma(dev, addr);
+
+ if (dma_addr + size > mask)
+ return false;
+
+ *dma_addr_p = dma_addr;
+ return true;
+}
+
#endif /* _ASM_IA64_DMA_MAPPING_H */
--
1.5.6.5
next prev parent reply other threads:[~2009-05-29 8:43 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-29 8:43 Ian Campbell
2009-05-29 8:43 ` Ian Campbell
2009-05-29 8:43 ` Ian Campbell
2009-05-29 8:43 ` Ian Campbell [this message]
2009-05-29 8:43 ` [PATCH 1/9] ia64: introduce arch-specific dma-mapping interfaces Ian Campbell
2009-05-29 8:43 ` [PATCH 2/9] x86: introduce arch-specific dma-mapping interface Ian Campbell
2009-05-29 8:43 ` [PATCH 3/9] x86: use dma_map_range when allocating PCI DMA memory Ian Campbell
2009-05-29 8:43 ` [PATCH 4/9] x86: use dma_map_range when allocating PCI DMA memory with no IOMMU Ian Campbell
2009-05-29 8:43 ` [PATCH 5/9] x86: use dma_map_range when allocating PCI GART memory Ian Campbell
2009-05-29 8:44 ` [PATCH 6/9] swiotlb: use dma_to_phys and phys_to_dma Ian Campbell
2009-05-29 8:44 ` Ian Campbell
2009-05-29 8:44 ` Ian Campbell
2009-05-29 21:09 ` Jeremy Fitzhardinge
2009-05-29 21:09 ` Jeremy Fitzhardinge
2009-05-29 21:09 ` Jeremy Fitzhardinge
2009-05-30 13:02 ` Ian Campbell
2009-05-30 13:02 ` Ian Campbell
2009-05-30 13:02 ` Ian Campbell
2009-05-29 8:44 ` [PATCH 7/9] swiotlb: use dma_map_range Ian Campbell
2009-05-29 8:44 ` Ian Campbell
2009-05-29 8:44 ` Ian Campbell
2009-05-29 8:44 ` [PATCH 8/9] swiotlb: support HIGHMEM in swiotlb_bus_to_virt Ian Campbell
2009-05-29 8:44 ` Ian Campbell
2009-05-29 15:58 ` Jeremy Fitzhardinge
2009-05-29 15:58 ` Jeremy Fitzhardinge
2009-05-30 13:02 ` Ian Campbell
2009-05-30 13:02 ` Ian Campbell
2009-05-29 8:44 ` [PATCH 9/9] swiotlb: rename swiotlb_virt_to_bus as virt_to_dma Ian Campbell
2009-05-29 9:06 ` swiotlb: Introduce architecture-specific APIs to replace Ian Campbell
2009-05-29 9:06 ` swiotlb: Introduce architecture-specific APIs to replace __weak functions Ian Campbell
2009-05-29 9:06 ` Ian Campbell
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=1243586643-5554-2-git-send-email-ian.campbell@citrix.com \
--to=ian.campbell@citrix.com \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=jeremy@goop.org \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tony.luck@intel.com \
/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.