From: Ian Campbell <ian.campbell@citrix.com>
To: ian.campbell@citrix.com
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
Jeremy Fitzhardinge <jeremy@goop.org>,
Becky Bruce <beckyb@kernel.crashing.org>,
Olaf Kirch <okir@suse.de>, Ingo Molnar <mingo@elte.hu>,
Greg KH <gregkh@suse.de>,
xen-devel <xendevel@lists.xensource.com>,
x86 maintainers <x86@kernel.org>,
lkml <linux-kernel@vger.kernel.org>
Subject: [PATCH] swiotlb/xen: update xen for changes to swiotlb allocation interface
Date: Thu, 21 May 2009 17:15:26 +0100 [thread overview]
Message-ID: <1242922528-5982-6-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1242906335.22654.188.camel@zakaz.uk.xensource.com>
This function is now implemented via an explicit hook in
arch/x86/kernel/pci-swiotlb.c rather than as a weak hook in
swiotlb.c
Initialsation of the hook needs to happen before xen_iommu_init() is
called so add detect_xen_iommu() (mirroring other IOMMU
implementations) which is called early enough.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Becky Bruce <beckyb@kernel.crashing.org>
Cc: Olaf Kirch <okir@suse.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Greg KH <gregkh@suse.de>
Cc: xen-devel <xendevel@lists.xensource.com>
Cc: x86 maintainers <x86@kernel.org>
Cc: lkml <linux-kernel@vger.kernel.org>
---
arch/x86/include/asm/xen/iommu.h | 4 ++++
arch/x86/kernel/pci-dma.c | 4 +++-
drivers/pci/xen-iommu.c | 14 +++++++++++---
include/xen/swiotlb.h | 1 -
4 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/arch/x86/include/asm/xen/iommu.h b/arch/x86/include/asm/xen/iommu.h
index 75df312..22b6091 100644
--- a/arch/x86/include/asm/xen/iommu.h
+++ b/arch/x86/include/asm/xen/iommu.h
@@ -1,8 +1,12 @@
#ifndef ASM_X86__XEN_IOMMU_H
#ifdef CONFIG_PCI_XEN
+extern void detect_xen_iommu(void);
extern void xen_iommu_init(void);
#else
+static inline void detect_xen_iommu(void)
+{
+}
static inline void xen_iommu_init(void)
{
}
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 587cc6a..695f8a6 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -121,6 +121,8 @@ void __init pci_iommu_alloc(void)
*/
gart_iommu_hole_init();
+ detect_xen_iommu();
+
detect_calgary();
detect_intel_iommu();
@@ -277,7 +279,7 @@ static int __init pci_iommu_init(void)
#endif
xen_iommu_init();
-
+
calgary_iommu_init();
intel_iommu_init();
diff --git a/drivers/pci/xen-iommu.c b/drivers/pci/xen-iommu.c
index f65660a..2d727d1 100644
--- a/drivers/pci/xen-iommu.c
+++ b/drivers/pci/xen-iommu.c
@@ -39,7 +39,8 @@ do { \
static int max_dma_bits = 32;
-void xen_swiotlb_fixup(void *buf, size_t size, unsigned long nslabs)
+static void __init xen_swiotlb_alloc_fixup(void *buf, size_t size,
+ unsigned long nslabs)
{
int i, rc;
int dma_bits;
@@ -314,6 +315,15 @@ static struct dma_map_ops xen_swiotlb_dma_ops = {
.is_phys = 0,
};
+void __init detect_xen_iommu(void)
+{
+ if (!xen_pv_domain())
+ return;
+
+ x86_swiotlb_force_mapping = &xen_swiotlb_force_mapping;
+ x86_swiotlb_alloc_fixup = &xen_swiotlb_alloc_fixup;
+}
+
void __init xen_iommu_init(void)
{
if (!xen_pv_domain())
@@ -324,8 +334,6 @@ void __init xen_iommu_init(void)
force_iommu = 0;
dma_ops = &xen_dma_ops;
- x86_swiotlb_force_mapping = &xen_swiotlb_force_mapping;
-
if (swiotlb) {
printk(KERN_INFO "Xen: Enabling DMA fallback to swiotlb\n");
dma_ops = &xen_swiotlb_dma_ops;
diff --git a/include/xen/swiotlb.h b/include/xen/swiotlb.h
index 64137fa..83ec002 100644
--- a/include/xen/swiotlb.h
+++ b/include/xen/swiotlb.h
@@ -1,7 +1,6 @@
#ifndef _XEN_SWIOTLB_H
#define _XEN_SWIOTLB_H
-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);
--
1.5.6.5
next prev parent reply other threads:[~2009-05-21 16:16 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-14 19:54 Where do we stand with the Xen patches? Jeremy Fitzhardinge
2009-05-15 18:35 ` Ingo Molnar
2009-05-15 19:59 ` Jeremy Fitzhardinge
2009-05-18 1:36 ` FUJITA Tomonori
2009-05-18 1:42 ` Jeremy Fitzhardinge
2009-05-18 8:40 ` Ingo Molnar
2009-05-19 5:27 ` FUJITA Tomonori
2009-05-19 13:03 ` Ingo Molnar
2009-05-19 15:30 ` FUJITA Tomonori
2009-05-19 15:56 ` Ian Campbell
2009-05-20 17:06 ` Jeremy Fitzhardinge
2009-05-21 8:54 ` FUJITA Tomonori
2009-05-21 10:27 ` Ian Campbell
2009-05-21 10:28 ` Ian Campbell
2009-05-21 10:39 ` FUJITA Tomonori
2009-05-21 11:03 ` [Xen-devel] " Ian Campbell
2009-05-21 11:08 ` Ian Campbell
2009-05-21 11:19 ` FUJITA Tomonori
2009-05-21 11:45 ` Ian Campbell
2009-05-21 16:15 ` swiotlb: remove __weak hooks in favour of architecture-specific functions Ian Campbell
2009-05-21 16:19 ` Ian Campbell
2009-05-21 16:47 ` Randy Dunlap
2009-05-22 8:55 ` Ian Campbell
2009-05-22 11:13 ` FUJITA Tomonori
2009-05-22 11:43 ` Ian Campbell
2009-05-22 11:55 ` FUJITA Tomonori
2009-05-22 14:02 ` Ian Campbell
2009-05-22 14:24 ` FUJITA Tomonori
2009-05-21 16:15 ` [PATCH] swiotlb: make is_buffer_dma_capable architecture-specific Ian Campbell
2009-05-21 16:15 ` [PATCH] swiotlb: make range_needs_mapping architecture-specific Ian Campbell
2009-05-22 11:13 ` FUJITA Tomonori
2009-05-22 11:45 ` Ian Campbell
2009-05-21 16:15 ` [PATCH] swiotlb/xen: update xen for swiotlb_arch_force_mapping changes Ian Campbell
2009-05-21 16:15 ` [PATCH] swiotlb: make swiotlb allocation functions architecture-specific Ian Campbell
2009-05-22 11:13 ` FUJITA Tomonori
2009-05-22 11:46 ` Ian Campbell
2009-05-21 16:15 ` Ian Campbell [this message]
2009-05-21 16:15 ` [PATCH] swiotlb: make swiotlb phys<->bus translations architecture-specific Ian Campbell
2009-05-22 11:13 ` FUJITA Tomonori
2009-05-22 11:46 ` Ian Campbell
2009-05-21 16:15 ` [PATCH] swiotlb/xen: update xen swiotlb for phys<->bus API changes Ian Campbell
2009-05-21 17:21 ` [Xen-devel] Re: Where do we stand with the Xen patches? FUJITA Tomonori
2009-05-21 10:48 ` 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=1242922528-5982-6-git-send-email-ian.campbell@citrix.com \
--to=ian.campbell@citrix.com \
--cc=beckyb@kernel.crashing.org \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=gregkh@suse.de \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=okir@suse.de \
--cc=x86@kernel.org \
--cc=xendevel@lists.xensource.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).