[PATCH 1/9] x86/iommu: add necessary types for stackable dma_ops

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Joerg Roedel
Date: Monday, September 22, 2008 - 11:21 am

This patch extends the x86 dma_ops structure so that we can queue it
into a list. It also adds a device_supported callback. It can be used to
find out if a registered dma_ops implementation can handle a given
device. Further it adds an enum with dma_ops implementation types
possible in the future.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
 include/asm-x86/dma-mapping.h |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/include/asm-x86/dma-mapping.h b/include/asm-x86/dma-mapping.h
index f408e6d..59d1101 100644
--- a/include/asm-x86/dma-mapping.h
+++ b/include/asm-x86/dma-mapping.h
@@ -17,6 +17,8 @@ extern struct device x86_dma_fallback_dev;
 extern int panic_on_overflow;
 
 struct dma_mapping_ops {
+	struct		list_head list; /* for stacking dma_ops */
+
 	int             (*mapping_error)(struct device *dev,
 					 dma_addr_t dma_addr);
 	void*           (*alloc_coherent)(struct device *dev, size_t size,
@@ -51,9 +53,33 @@ struct dma_mapping_ops {
 				struct scatterlist *sg, int nents,
 				int direction);
 	int             (*dma_supported)(struct device *hwdev, u64 mask);
+	int		(*device_supported)(struct device *hwdev);
 	int		is_phys;
 };
 
+/*
+ * This are the supported types of dma_ops implementations on x86. The
+ * different types mean different priority:
+ *
+ *   DMA_OPS_TYPE_PV   - paravirtualized dma_ops implementation
+ *   DMA_OPS_TYPE_HW   - dma_ops implementation using some kind of hardware
+ *                       support
+ *   DMA_OPS_TYPE_SOFT - a software only dma_ops implementation
+ *
+ * When a device issues its first request to the DMA layer the available
+ * implementations are asked if they support the device by calling the specific
+ * dma_supported callback. The implementations are checked in order, first the
+ * DMA_OPS_TYPE_PV, then the DMA_OPS_TYPE_HW and at the end the
+ * DMA_OPS_TYPE_SOFT implementations. Within the implementation types they are
+ * called in registration order.
+ */
+enum dma_ops_driver_type {
+	DMA_OPS_TYPE_PV,
+	DMA_OPS_TYPE_HW,
+	DMA_OPS_TYPE_SOFT,
+	DMA_OPS_TYPE_MAX,
+};
+
 extern struct dma_mapping_ops *dma_ops;
 
 static inline struct dma_mapping_ops *get_dma_ops(struct device *dev)
-- 
1.5.6.4


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/9][RFC] stackable dma_ops for x86, Joerg Roedel, (Mon Sep 22, 11:21 am)
[PATCH 1/9] x86/iommu: add necessary types for stackable d ..., Joerg Roedel, (Mon Sep 22, 11:21 am)
[PATCH 9/9] x86/iommu: use dma_ops_list in get_dma_ops, Joerg Roedel, (Mon Sep 22, 11:21 am)
Re: [PATCH 0/9][RFC] stackable dma_ops for x86, Arjan van de Ven, (Mon Sep 22, 11:36 am)
Re: [PATCH 0/9][RFC] stackable dma_ops for x86, Joerg Roedel, (Mon Sep 22, 11:39 am)
Re: [PATCH 0/9][RFC] stackable dma_ops for x86, Jeremy Fitzhardinge, (Mon Sep 22, 7:41 pm)
Re: [PATCH 0/9][RFC] stackable dma_ops for x86, Arjan van de Ven, (Mon Sep 22, 7:50 pm)
Re: [PATCH 9/9] x86/iommu: use dma_ops_list in get_dma_ops, Muli Ben-Yehuda, (Fri Sep 26, 5:13 pm)
Re: [PATCH 9/9] x86/iommu: use dma_ops_list in get_dma_ops, FUJITA Tomonori, (Sun Sep 28, 7:21 am)
Re: [PATCH 0/9][RFC] stackable dma_ops for x86, FUJITA Tomonori, (Sun Sep 28, 7:21 am)
Re: [PATCH 0/9][RFC] stackable dma_ops for x86, Joerg Roedel, (Sun Sep 28, 11:49 am)
Re: [PATCH 9/9] x86/iommu: use dma_ops_list in get_dma_ops, Muli Ben-Yehuda, (Mon Sep 29, 2:25 am)
Re: [PATCH 9/9] x86/iommu: use dma_ops_list in get_dma_ops, Muli Ben-Yehuda, (Mon Sep 29, 2:30 am)
Re: [PATCH 0/9][RFC] stackable dma_ops for x86, FUJITA Tomonori, (Mon Sep 29, 6:16 am)
Re: [PATCH 9/9] x86/iommu: use dma_ops_list in get_dma_ops, FUJITA Tomonori, (Mon Sep 29, 6:16 am)
Re: [PATCH 0/9][RFC] stackable dma_ops for x86, Joerg Roedel, (Mon Sep 29, 6:26 am)
Re: [PATCH 0/9][RFC] stackable dma_ops for x86, FUJITA Tomonori, (Mon Sep 29, 6:42 am)
Re: [PATCH 0/9][RFC] stackable dma_ops for x86, Joerg Roedel, (Mon Sep 29, 6:51 am)
Re: [PATCH 9/9] x86/iommu: use dma_ops_list in get_dma_ops, Muli Ben-Yehuda, (Tue Sep 30, 12:44 pm)
Re: [PATCH 9/9] x86/iommu: use dma_ops_list in get_dma_ops, Muli Ben-Yehuda, (Fri Oct 3, 1:38 am)