Skip to content

Commit f39f8d0

Browse files
author
Christoph Hellwig
committed
MIPS/octeon: use swiotlb_init instead of open coding it
Use the generic swiotlb initialization helper instead of open coding it. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Tested-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
1 parent 9bbe7a7 commit f39f8d0

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

arch/mips/cavium-octeon/dma-octeon.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -186,15 +186,12 @@ phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr)
186186
return daddr;
187187
}
188188

189-
char *octeon_swiotlb;
190-
191189
void __init plat_swiotlb_setup(void)
192190
{
193191
phys_addr_t start, end;
194192
phys_addr_t max_addr;
195193
phys_addr_t addr_size;
196194
size_t swiotlbsize;
197-
unsigned long swiotlb_nslabs;
198195
u64 i;
199196

200197
max_addr = 0;
@@ -236,15 +233,7 @@ void __init plat_swiotlb_setup(void)
236233
if (OCTEON_IS_OCTEON2() && max_addr >= 0x100000000ul)
237234
swiotlbsize = 64 * (1<<20);
238235
#endif
239-
swiotlb_nslabs = swiotlbsize >> IO_TLB_SHIFT;
240-
swiotlb_nslabs = ALIGN(swiotlb_nslabs, IO_TLB_SEGSIZE);
241-
swiotlbsize = swiotlb_nslabs << IO_TLB_SHIFT;
242-
243-
octeon_swiotlb = memblock_alloc_low(swiotlbsize, PAGE_SIZE);
244-
if (!octeon_swiotlb)
245-
panic("%s: Failed to allocate %zu bytes align=%lx\n",
246-
__func__, swiotlbsize, PAGE_SIZE);
247236

248-
if (swiotlb_init_with_tbl(octeon_swiotlb, swiotlb_nslabs, 1) == -ENOMEM)
249-
panic("Cannot allocate SWIOTLB buffer");
237+
swiotlb_adjust_size(swiotlbsize);
238+
swiotlb_init(1);
250239
}

arch/mips/pci/pci-octeon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ static int __init octeon_pci_setup(void)
664664

665665
/* BAR1 movable regions contiguous to cover the swiotlb */
666666
octeon_bar1_pci_phys =
667-
virt_to_phys(octeon_swiotlb) & ~((1ull << 22) - 1);
667+
io_tlb_default_mem.start & ~((1ull << 22) - 1);
668668

669669
for (index = 0; index < 32; index++) {
670670
union cvmx_pci_bar1_indexx bar1_index;

0 commit comments

Comments
 (0)