From: Jeremy Fitzhardinge <jeremy@goop.org>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: the arch/x86 maintainers <x86@kernel.org>,
Ingo Molnar <mingo@elte.hu>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Ian Campbell <ian.campbell@citrix.com>,
Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Subject: [PATCH 4/9] xen/swiotlb: add hook for swiotlb_arch_range_needs_mapping
Date: Tue, 31 Mar 2009 15:52:10 -0700 [thread overview]
Message-ID: <1238539935-4295-5-git-send-email-jeremy@goop.org> (raw)
In-Reply-To: <1238539935-4295-1-git-send-email-jeremy@goop.org>
From: Ian Campbell <ian.campbell@citrix.com>
Impact: Xen support for DMA
Add hook so that Xen can determine whether a particular address range needs
pfn<->mfn mapping.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Reviewed-by: "H. Peter Anvin" <hpa@zytor.com>
---
arch/x86/kernel/pci-swiotlb_64.c | 3 +++
drivers/pci/xen-iommu.c | 5 +++++
include/xen/swiotlb.h | 8 ++++++++
3 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kernel/pci-swiotlb_64.c b/arch/x86/kernel/pci-swiotlb_64.c
index 7f87ce2..7aa8c18 100644
--- a/arch/x86/kernel/pci-swiotlb_64.c
+++ b/arch/x86/kernel/pci-swiotlb_64.c
@@ -54,6 +54,9 @@ phys_addr_t swiotlb_bus_to_phys(dma_addr_t baddr)
int __weak swiotlb_arch_range_needs_mapping(phys_addr_t paddr, size_t size)
{
+ if (xen_pv_domain())
+ return xen_range_needs_mapping(paddr, size);
+
return 0;
}
diff --git a/drivers/pci/xen-iommu.c b/drivers/pci/xen-iommu.c
index 47d87a7..fcef078 100644
--- a/drivers/pci/xen-iommu.c
+++ b/drivers/pci/xen-iommu.c
@@ -118,6 +118,11 @@ static int range_straddles_page_boundary(phys_addr_t p, size_t size)
return 1;
}
+int xen_range_needs_mapping(phys_addr_t paddr, size_t size)
+{
+ return range_straddles_page_boundary(paddr, size);
+}
+
static inline void xen_dma_unmap_page(struct page *page)
{
/* Xen TODO: 2.6.18 xen calls __gnttab_dma_unmap_page here
diff --git a/include/xen/swiotlb.h b/include/xen/swiotlb.h
index 3d96b07..e975aa0 100644
--- a/include/xen/swiotlb.h
+++ b/include/xen/swiotlb.h
@@ -5,6 +5,7 @@
extern void xen_swiotlb_fixup(void *buf, size_t size, unsigned long nslabs);
extern phys_addr_t xen_bus_to_phys(dma_addr_t daddr);
extern dma_addr_t xen_phys_to_bus(phys_addr_t paddr);
+extern int xen_range_needs_mapping(phys_addr_t phys, size_t size);
#else
static inline void xen_swiotlb_fixup(void *buf, size_t size, unsigned long nslabs)
{
@@ -19,6 +20,13 @@ static inline dma_addr_t xen_phys_to_bus(phys_addr_t paddr)
{
return paddr;
}
+
+static inline int xen_range_needs_mapping(phys_addr_t phys, size_t size)
+{
+ return 0;
+}
#endif
+
+
#endif /* _XEN_SWIOTLB_H */
--
1.6.0.6
next prev parent reply other threads:[~2009-03-31 22:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-31 22:52 [PATCH] swiotlb updates for Xen dom0 Jeremy Fitzhardinge
2009-03-31 22:52 ` [PATCH 1/9] xen: make sure swiotlb allocation is physically contigious Jeremy Fitzhardinge
2009-03-31 22:52 ` [PATCH 2/9] xen swiotlb: fixup swiotlb is chunks smaller than MAX_CONTIG_ORDER Jeremy Fitzhardinge
2009-03-31 22:52 ` [PATCH 3/9] xen: add hooks for mapping phys<->bus addresses in swiotlb Jeremy Fitzhardinge
2009-03-31 22:52 ` Jeremy Fitzhardinge [this message]
2009-03-31 22:52 ` [PATCH 5/9] xen: enable swiotlb for xen domain 0 Jeremy Fitzhardinge
2009-03-31 22:52 ` [PATCH 6/9] swiotlb: use swiotlb_alloc_boot to allocate emergency pool Jeremy Fitzhardinge
2009-03-31 22:52 ` [PATCH 7/9] xen/swiotlb: improve comment on gfp flags in xen_alloc_coherent() Jeremy Fitzhardinge
2009-03-31 22:52 ` [PATCH 8/9] xen/swiotlb: add sync functions Jeremy Fitzhardinge
2009-03-31 22:52 ` [PATCH 9/9] pci-swiotlb: remove __weak vs __weak binding Jeremy Fitzhardinge
2009-04-02 6:29 ` [PATCH] swiotlb updates for Xen dom0 FUJITA Tomonori
2009-04-02 7:12 ` Jeremy Fitzhardinge
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=1238539935-4295-5-git-send-email-jeremy@goop.org \
--to=jeremy@goop.org \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=ian.campbell@citrix.com \
--cc=jeremy.fitzhardinge@citrix.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=x86@kernel.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
all inboxes | Powered by JetHome®