xen-devel
[Xen-devel] [PATCH 02/15] [swiotlb] Add swiotlb_engine structure for tra
|
To: |
fujita.tomonori@xxxxxxxxxxxxx, alex.williamson@xxxxxx, joerg.roedel@xxxxxxx, dwmw2@xxxxxxxxxxxxx, chrisw@xxxxxxxxxxxx, iommu@xxxxxxxxxxxxxxxxxxxxxxxxxx |
|
Subject: |
[Xen-devel] [PATCH 02/15] [swiotlb] Add swiotlb_engine structure for tracking multiple software IO TLBs. |
|
From: |
Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx> |
|
Date: |
2010年1月14日 18:00:51 -0500 |
|
Cc: |
Ian.Campbell@xxxxxxxxxxxxx, jeremy@xxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxx, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx> |
|
Delivery-date: |
2010年1月14日 15:14:41 -0800 |
|
Envelope-to: |
www-data@xxxxxxxxxxxxxxxxxxx |
|
In-reply-to: |
<1263510064-16788-2-git-send-email-konrad.wilk@xxxxxxxxxx> |
|
List-help: |
<mailto:xen-devel-request@lists.xensource.com?subject=help> |
|
List-id: |
Xen developer discussion <xen-devel.lists.xensource.com> |
|
List-post: |
<mailto:xen-devel@lists.xensource.com> |
|
List-subscribe: |
<http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe> |
|
List-unsubscribe: |
<http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe> |
|
References: |
<1263510064-16788-1-git-send-email-konrad.wilk@xxxxxxxxxx> <1263510064-16788-2-git-send-email-konrad.wilk@xxxxxxxxxx> |
|
Sender: |
xen-devel-bounces@xxxxxxxxxxxxxxxxxxx |
The structure contains all of the existing variables used in
software IO TLB (swiotlb.c) collected within a structure.
Additionally a name variable and a deconstructor (release) function
variable is defined for API usages.
The other set of functions: is_swiotlb_buffer, dma_capable, phys_to_bus,
bus_to_phys, virt_to_bus, and bus_to_virt server as a method to abstract
them out of the SWIOTLB library.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
---
include/linux/swiotlb.h | 94 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 94 insertions(+), 0 deletions(-)
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index febedcf..781c3aa 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -24,6 +24,100 @@ extern int swiotlb_force;
extern void swiotlb_init(int verbose);
+struct swiotlb_engine {
+
+ /*
+ * Name of the engine (ie: "Software IO TLB")
+ */
+ const char *name;
+
+ /*
+ * Used to do a quick range check in unmap_single and
+ * sync_single_*, to see if the memory was in fact allocated by this
+ * API.
+ */
+ char *start;
+ char *end;
+
+ /*
+ * The number of IO TLB blocks (in groups of 64) betweeen start and
+ * end. This is command line adjustable via setup_io_tlb_npages.
+ */
+ unsigned long nslabs;
+
+ /*
+ * When the IOMMU overflows we return a fallback buffer.
+ * This sets the size.
+ */
+ unsigned long overflow;
+
+ void *overflow_buffer;
+
+ /*
+ * This is a free list describing the number of free entries available
+ * from each index
+ */
+ unsigned int *list;
+
+ /*
+ * Current marker in the start through end location. Is incremented
+ * on each map and wraps around.
+ */
+ unsigned int index;
+
+ /*
+ * We need to save away the original address corresponding to a mapped
+ * entry for the sync operations.
+ */
+ phys_addr_t *orig_addr;
+
+ /*
+ * IOMMU private data.
+ */
+ void *priv;
+ /*
+ * The API call to free a SWIOTLB engine if another wants to register
+ * (or if want to turn SWIOTLB off altogether).
+ * It is imperative that this function checks for existing DMA maps
+ * and not release the IOTLB if there are out-standing maps.
+ */
+ int (*release)(struct swiotlb_engine *);
+
+ /*
+ * Is the DMA (Bus) address within our bounce buffer (start and end).
+ */
+ int (*is_swiotlb_buffer)(struct swiotlb_engine *, dma_addr_t dev_addr,
+ phys_addr_t phys);
+
+ /*
+ * Is the DMA (Bus) address reachable by the PCI device?.
+ */
+ bool (*dma_capable)(struct device *, dma_addr_t, phys_addr_t, size_t);
+ /*
+ * Physical to bus (DMA) address translation. On
+ * most platforms this is an equivalent function.
+ */
+ dma_addr_t (*phys_to_bus)(struct device *hwdev, phys_addr_t paddr);
+
+ /*
+ * Bus (DMA) to physical address translation. On most
+ * platforms this is an equivalant function.
+ */
+ phys_addr_t (*bus_to_phys)(struct device *hwdev, dma_addr_t baddr);
+
+ /*
+ * Virtual to bus (DMA) address translation. On most platforms
+ * this is a call to __pa(address).
+ */
+ dma_addr_t (*virt_to_bus)(struct device *hwdev, void *address);
+
+ /*
+ * Bus (DMA) to virtual address translation. On most platforms
+ * this is a call to __va(address).
+ */
+ void* (*bus_to_virt)(struct device *hwdev, dma_addr_t address);
+};
+
extern void
*swiotlb_alloc_coherent(struct device *hwdev, size_t size,
dma_addr_t *dma_handle, gfp_t flags);
--
1.6.2.5
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
| <Prev in Thread] |
Current Thread |
[Next in Thread>
|
- [Xen-devel] [RFC SWIOTLB-0.2] , Konrad Rzeszutek Wilk
- [Xen-devel] [PATCH 01/15] [swiotlb] fix: Update 'setup_io_tlb_npages' to accept both arguments in either order. , Konrad Rzeszutek Wilk
- [Xen-devel] [PATCH 02/15] [swiotlb] Add swiotlb_engine structure for tracking multiple software IO TLBs.,
Konrad Rzeszutek Wilk <=
- [Xen-devel] [PATCH 03/15] [swiotlb] Add swiotlb_register_engine function. , Konrad Rzeszutek Wilk
- [Xen-devel] [PATCH 04/15] [swiotlb] Search and replace s/io_tlb/iommu_sw->/ , Konrad Rzeszutek Wilk
- [Xen-devel] [PATCH 05/15] [swiotlb] Respect the io_tlb_nslabs argument value. , Konrad Rzeszutek Wilk
- [Xen-devel] [PATCH 06/15] [swiotlb] In 'swiotlb_init' take advantage of the default swiotlb_engine support. , Konrad Rzeszutek Wilk
- [Xen-devel] [PATCH 07/15] [swiotlb] In 'swiotlb_free' check iommu_sw pointer. , Konrad Rzeszutek Wilk
- [Xen-devel] [PATCH 08/15] [swiotlb] Add 'is_swiotlb_buffer' to the swiotlb_ops function decleration. , Konrad Rzeszutek Wilk
- [Xen-devel] [PATCH 09/15] [swiotlb] Add 'dma_capable' to the swiotlb_ops structure. , Konrad Rzeszutek Wilk
- [Xen-devel] [PATCH 10/15] [swiotlb] Replace the [phys, bus]->virt and virt->[bus, phys] functions with iommu_sw calls. , Konrad Rzeszutek Wilk
- [Xen-devel] [PATCH 11/15] [swiotlb] Replace late_alloc with iommu_sw->priv usage. , Konrad Rzeszutek Wilk
- [Xen-devel] [PATCH 12/15] [swiotlb] Remove un-used static declerations obsoleted by iommu_sw. , Konrad Rzeszutek Wilk
|
|