lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 21 May 2009 17:15:26 +0100
From:	Ian Campbell <ian.campbell@...rix.com>
To:	ian.campbell@...rix.com
Cc:	FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>,
	Jeremy Fitzhardinge <jeremy@...p.org>,
	Becky Bruce <beckyb@...nel.crashing.org>,
	Olaf Kirch <okir@...e.de>, Ingo Molnar <mingo@...e.hu>,
	Greg KH <gregkh@...e.de>,
	xen-devel <xendevel@...ts.xensource.com>,
	x86 maintainers <x86@...nel.org>,
	lkml <linux-kernel@...r.kernel.org>
Subject: [PATCH] swiotlb/xen: update xen for changes to swiotlb allocation interface

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@...rix.com>
Cc: FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>
Cc: Jeremy Fitzhardinge <jeremy@...p.org>
Cc: Becky Bruce <beckyb@...nel.crashing.org>
Cc: Olaf Kirch <okir@...e.de>
Cc: Ingo Molnar <mingo@...e.hu>
Cc: Greg KH <gregkh@...e.de>
Cc: xen-devel <xendevel@...ts.xensource.com>
Cc: x86 maintainers <x86@...nel.org>
Cc: lkml <linux-kernel@...r.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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ