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

[PATCH 5/7] MIPS/octeon: simplify swiotlb initialization



Just use swiotlb_adjust_size and swiotlb_init to initialize
swiotlb instead of doing a lot of manual work.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>
---
 arch/mips/cavium-octeon/dma-octeon.c      | 16 ++--------------
 arch/mips/include/asm/octeon/pci-octeon.h |  1 -
 arch/mips/pci/pci-octeon.c                |  2 +-
 3 files changed, 3 insertions(+), 16 deletions(-)

diff --git a/arch/mips/cavium-octeon/dma-octeon.c 
b/arch/mips/cavium-octeon/dma-octeon.c
index 020b8ce5b8ff7c..6bc9ef5e3790ec 100644
--- a/arch/mips/cavium-octeon/dma-octeon.c
+++ b/arch/mips/cavium-octeon/dma-octeon.c
@@ -186,15 +186,12 @@ phys_addr_t dma_to_phys(struct device *dev, dma_addr_t 
daddr)
        return daddr;
 }
 
-char *octeon_swiotlb;
-
 void __init plat_swiotlb_setup(void)
 {
        phys_addr_t start, end;
        phys_addr_t max_addr;
        phys_addr_t addr_size;
        size_t swiotlbsize;
-       unsigned long swiotlb_nslabs;
        u64 i;
 
        max_addr = 0;
@@ -236,15 +233,6 @@ void __init plat_swiotlb_setup(void)
        if (OCTEON_IS_OCTEON2() && max_addr >= 0x100000000ul)
                swiotlbsize = 64 * (1<<20);
 #endif
-       swiotlb_nslabs = swiotlbsize >> IO_TLB_SHIFT;
-       swiotlb_nslabs = ALIGN(swiotlb_nslabs, IO_TLB_SEGSIZE);
-       swiotlbsize = swiotlb_nslabs << IO_TLB_SHIFT;
-
-       octeon_swiotlb = memblock_alloc_low(swiotlbsize, PAGE_SIZE);
-       if (!octeon_swiotlb)
-               panic("%s: Failed to allocate %zu bytes align=%lx\n",
-                     __func__, swiotlbsize, PAGE_SIZE);
-
-       if (swiotlb_init_with_tbl(octeon_swiotlb, swiotlbsize, 1) == -ENOMEM)
-               panic("Cannot allocate SWIOTLB buffer");
+       swiotlb_adjust_size(swiotlbsize);
+       swiotlb_init(false);
 }
diff --git a/arch/mips/include/asm/octeon/pci-octeon.h 
b/arch/mips/include/asm/octeon/pci-octeon.h
index b12d9a3fbfb6c0..a2f20a44fb6143 100644
--- a/arch/mips/include/asm/octeon/pci-octeon.h
+++ b/arch/mips/include/asm/octeon/pci-octeon.h
@@ -64,6 +64,5 @@ enum octeon_dma_bar_type {
 extern enum octeon_dma_bar_type octeon_dma_bar_type;
 
 void octeon_pci_dma_init(void);
-extern char *octeon_swiotlb;
 
 #endif
diff --git a/arch/mips/pci/pci-octeon.c b/arch/mips/pci/pci-octeon.c
index fc29b85cfa926d..ff26cd9dc083f6 100644
--- a/arch/mips/pci/pci-octeon.c
+++ b/arch/mips/pci/pci-octeon.c
@@ -664,7 +664,7 @@ static int __init octeon_pci_setup(void)
 
                /* BAR1 movable regions contiguous to cover the swiotlb */
                octeon_bar1_pci_phys =
-                       virt_to_phys(octeon_swiotlb) & ~((1ull << 22) - 1);
+                       io_tlb_default_mem->start & ~((1ull << 22) - 1);
 
                for (index = 0; index < 32; index++) {
                        union cvmx_pci_bar1_indexx bar1_index;
-- 
2.30.1




 


Rackspace

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