Inter-revision diff: patch 2

Comparing v4 (message) to v6 (message)

--- v4
+++ v6
@@ -1,57 +1,57 @@
-Move is_swiotlb_buffer() to swiotlb.c and make io_tlb_{start,end}
-static, so we can entirely hide struct swiotlb inside of swiotlb.c in
-the following patches.
+Split the debugfs creation to make the code reusable for supporting
+different bounce buffer pools, e.g. restricted DMA pool.
 
 Signed-off-by: Claire Chang <tientzu@chromium.org>
 ---
- include/linux/swiotlb.h | 7 +------
- kernel/dma/swiotlb.c    | 7 ++++++-
- 2 files changed, 7 insertions(+), 7 deletions(-)
+ kernel/dma/swiotlb.c | 22 ++++++++++++++++------
+ 1 file changed, 16 insertions(+), 6 deletions(-)
 
-diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
-index 83200f3b042a..041611bf3c2a 100644
---- a/include/linux/swiotlb.h
-+++ b/include/linux/swiotlb.h
-@@ -70,13 +70,8 @@ dma_addr_t swiotlb_map(struct device *dev, phys_addr_t phys,
- 
- #ifdef CONFIG_SWIOTLB
- extern enum swiotlb_force swiotlb_force;
--extern phys_addr_t io_tlb_start, io_tlb_end;
--
--static inline bool is_swiotlb_buffer(phys_addr_t paddr)
--{
--	return paddr >= io_tlb_start && paddr < io_tlb_end;
--}
- 
-+bool is_swiotlb_buffer(phys_addr_t paddr);
- void __init swiotlb_exit(void);
- unsigned int swiotlb_max_segment(void);
- size_t swiotlb_max_mapping_size(struct device *dev);
 diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
-index e180211f6ad9..678490d39e55 100644
+index d3232fc19385..858475bd6923 100644
 --- a/kernel/dma/swiotlb.c
 +++ b/kernel/dma/swiotlb.c
-@@ -69,7 +69,7 @@ enum swiotlb_force swiotlb_force;
-  * swiotlb_tbl_sync_single_*, to see if the memory was in fact allocated by this
-  * API.
-  */
--phys_addr_t io_tlb_start, io_tlb_end;
-+static phys_addr_t io_tlb_start, io_tlb_end;
+@@ -64,6 +64,7 @@
+ enum swiotlb_force swiotlb_force;
+ 
+ struct io_tlb_mem *io_tlb_default_mem;
++static struct dentry *debugfs_dir;
  
  /*
-  * The number of IO TLB blocks (in groups of 64) between io_tlb_start and
-@@ -719,6 +719,11 @@ bool is_swiotlb_active(void)
- 	return io_tlb_end != 0;
+  * Max segment that we can provide which (if pages are contingous) will
+@@ -662,18 +663,27 @@ EXPORT_SYMBOL_GPL(is_swiotlb_active);
+ 
+ #ifdef CONFIG_DEBUG_FS
+ 
+-static int __init swiotlb_create_debugfs(void)
++static void swiotlb_create_debugfs(struct io_tlb_mem *mem, const char *name,
++				   struct dentry *node)
+ {
+-	struct io_tlb_mem *mem = io_tlb_default_mem;
+-
+ 	if (!mem)
+-		return 0;
+-	mem->debugfs = debugfs_create_dir("swiotlb", NULL);
++		return;
++
++	mem->debugfs = debugfs_create_dir(name, node);
+ 	debugfs_create_ulong("io_tlb_nslabs", 0400, mem->debugfs, &mem->nslabs);
+ 	debugfs_create_ulong("io_tlb_used", 0400, mem->debugfs, &mem->used);
++}
++
++static int __init swiotlb_create_default_debugfs(void)
++{
++	struct io_tlb_mem *mem = io_tlb_default_mem;
++
++	swiotlb_create_debugfs(mem, "swiotlb", NULL);
++	debugfs_dir = mem->debugfs;
++
+ 	return 0;
  }
  
-+bool is_swiotlb_buffer(phys_addr_t paddr)
-+{
-+	return paddr >= io_tlb_start && paddr < io_tlb_end;
-+}
-+
- phys_addr_t get_swiotlb_start(void)
- {
- 	return io_tlb_start;
+-late_initcall(swiotlb_create_debugfs);
++late_initcall(swiotlb_create_default_debugfs);
+ 
+ #endif
 -- 
-2.30.0.478.g8a0d178c01-goog
+2.31.1.607.g51e8a6a459-goog
 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help