public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Anton Blanchard <anton@samba•org>
To: linuxppc-dev@ozlabs•org
Cc: paulus@samba•org
Subject: [PATCH] powerpc: cleanup dma_mapping_ops
Date: Sat, 10 Jun 2006 23:04:39 +1000	[thread overview]
Message-ID: <20060610130438.GR23891@krispykreme> (raw)


For pseries IOMMU bypass I want to be able to fall back to the regular
IOMMU ops. Do this by creating a dma_mapping_ops struct, and convert
the others while at it.

Signed-off-by: Anton Blanchard <anton@samba•org>
---

Index: build/arch/powerpc/kernel/pci_iommu.c
===================================================================
--- build.orig/arch/powerpc/kernel/pci_iommu.c	2006-06-10 11:37:31.000000000 +1000
+++ build/arch/powerpc/kernel/pci_iommu.c	2006-06-10 22:35:25.000000000 +1000
@@ -148,13 +148,17 @@ static int pci_iommu_dma_supported(struc
 		return 1;
 }
 
+struct dma_mapping_ops pci_iommu_ops = {
+	.alloc_coherent = pci_iommu_alloc_coherent,
+	.free_coherent = pci_iommu_free_coherent,
+	.map_single = pci_iommu_map_single,
+	.unmap_single = pci_iommu_unmap_single,
+	.map_sg = pci_iommu_map_sg,
+	.unmap_sg = pci_iommu_unmap_sg,
+	.dma_supported = pci_iommu_dma_supported,
+};
+
 void pci_iommu_init(void)
 {
-	pci_dma_ops.alloc_coherent = pci_iommu_alloc_coherent;
-	pci_dma_ops.free_coherent = pci_iommu_free_coherent;
-	pci_dma_ops.map_single = pci_iommu_map_single;
-	pci_dma_ops.unmap_single = pci_iommu_unmap_single;
-	pci_dma_ops.map_sg = pci_iommu_map_sg;
-	pci_dma_ops.unmap_sg = pci_iommu_unmap_sg;
-	pci_dma_ops.dma_supported = pci_iommu_dma_supported;
+	pci_dma_ops = pci_iommu_ops;
 }
Index: build/arch/powerpc/kernel/pci_direct_iommu.c
===================================================================
--- build.orig/arch/powerpc/kernel/pci_direct_iommu.c	2006-06-08 10:57:36.000000000 +1000
+++ build/arch/powerpc/kernel/pci_direct_iommu.c	2006-06-10 22:35:25.000000000 +1000
@@ -82,13 +82,17 @@ static int pci_direct_dma_supported(stru
 	return mask < 0x100000000ull;
 }
 
+static struct dma_mapping_ops pci_direct_ops = {
+	.alloc_coherent = pci_direct_alloc_coherent,
+	.free_coherent = pci_direct_free_coherent,
+	.map_single = pci_direct_map_single,
+	.unmap_single = pci_direct_unmap_single,
+	.map_sg = pci_direct_map_sg,
+	.unmap_sg = pci_direct_unmap_sg,
+	.dma_supported = pci_direct_dma_supported,
+};
+
 void __init pci_direct_iommu_init(void)
 {
-	pci_dma_ops.alloc_coherent = pci_direct_alloc_coherent;
-	pci_dma_ops.free_coherent = pci_direct_free_coherent;
-	pci_dma_ops.map_single = pci_direct_map_single;
-	pci_dma_ops.unmap_single = pci_direct_unmap_single;
-	pci_dma_ops.map_sg = pci_direct_map_sg;
-	pci_dma_ops.unmap_sg = pci_direct_unmap_sg;
-	pci_dma_ops.dma_supported = pci_direct_dma_supported;
+	pci_dma_ops = pci_direct_ops;
 }
Index: build/arch/powerpc/platforms/cell/iommu.c
===================================================================
--- build.orig/arch/powerpc/platforms/cell/iommu.c	2006-06-08 10:57:36.000000000 +1000
+++ build/arch/powerpc/platforms/cell/iommu.c	2006-06-10 22:35:25.000000000 +1000
@@ -473,6 +473,16 @@ static int cell_dma_supported(struct dev
 	return mask < 0x100000000ull;
 }
 
+static struct dma_mapping_ops cell_iommu_ops = {
+	.alloc_coherent = cell_alloc_coherent,
+	.free_coherent = cell_free_coherent,
+	.map_single = cell_map_single,
+	.unmap_single = cell_unmap_single,
+	.map_sg = cell_map_sg,
+	.unmap_sg = cell_unmap_sg,
+	.dma_supported = cell_dma_supported,
+};
+
 void cell_init_iommu(void)
 {
 	int setup_bus = 0;
@@ -498,11 +508,5 @@ void cell_init_iommu(void)
 		}
 	}
 
-	pci_dma_ops.alloc_coherent = cell_alloc_coherent;
-	pci_dma_ops.free_coherent = cell_free_coherent;
-	pci_dma_ops.map_single = cell_map_single;
-	pci_dma_ops.unmap_single = cell_unmap_single;
-	pci_dma_ops.map_sg = cell_map_sg;
-	pci_dma_ops.unmap_sg = cell_unmap_sg;
-	pci_dma_ops.dma_supported = cell_dma_supported;
+	pci_dma_ops = cell_iommu_ops;
 }

                 reply	other threads:[~2006-06-10 13:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20060610130438.GR23891@krispykreme \
    --to=anton@samba$(echo .)org \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    --cc=paulus@samba$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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