[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/7] swiotlb: use swiotlb_adjust_size in setup_io_tlb_npages



Use the proper helper to do the proper alignment of the buffer size
to the requirements of the swiotlb allocator instead of open coding
the logic.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>
---
 kernel/dma/swiotlb.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
index 27461fd63e0330..93737d0932fbf2 100644
--- a/kernel/dma/swiotlb.c
+++ b/kernel/dma/swiotlb.c
@@ -76,11 +76,9 @@ static unsigned long default_nslabs = IO_TLB_DEFAULT_SIZE >> 
IO_TLB_SHIFT;
 static int __init
 setup_io_tlb_npages(char *str)
 {
-       if (isdigit(*str)) {
-               /* avoid tail segment of size < IO_TLB_SEGSIZE */
-               default_nslabs =
-                       ALIGN(simple_strtoul(str, &str, 0), IO_TLB_SEGSIZE);
-       }
+       if (isdigit(*str))
+               swiotlb_adjust_size(
+                       simple_strtoul(str, &str, 0) << IO_TLB_SHIFT);
        if (*str == ',')
                ++str;
        if (!strcmp(str, "force"))
-- 
2.30.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.