mirror of
https://github.com/torvalds/linux
synced 2024-09-06 18:01:05 +00:00
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>
This commit is contained in:
parent
9bbe7a7fc1
commit
f39f8d0eb0
|
@ -186,15 +186,12 @@ phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr)
|
||||||
return daddr;
|
return daddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *octeon_swiotlb;
|
|
||||||
|
|
||||||
void __init plat_swiotlb_setup(void)
|
void __init plat_swiotlb_setup(void)
|
||||||
{
|
{
|
||||||
phys_addr_t start, end;
|
phys_addr_t start, end;
|
||||||
phys_addr_t max_addr;
|
phys_addr_t max_addr;
|
||||||
phys_addr_t addr_size;
|
phys_addr_t addr_size;
|
||||||
size_t swiotlbsize;
|
size_t swiotlbsize;
|
||||||
unsigned long swiotlb_nslabs;
|
|
||||||
u64 i;
|
u64 i;
|
||||||
|
|
||||||
max_addr = 0;
|
max_addr = 0;
|
||||||
|
@ -236,15 +233,7 @@ void __init plat_swiotlb_setup(void)
|
||||||
if (OCTEON_IS_OCTEON2() && max_addr >= 0x100000000ul)
|
if (OCTEON_IS_OCTEON2() && max_addr >= 0x100000000ul)
|
||||||
swiotlbsize = 64 * (1<<20);
|
swiotlbsize = 64 * (1<<20);
|
||||||
#endif
|
#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);
|
swiotlb_adjust_size(swiotlbsize);
|
||||||
if (!octeon_swiotlb)
|
swiotlb_init(1);
|
||||||
panic("%s: Failed to allocate %zu bytes align=%lx\n",
|
|
||||||
__func__, swiotlbsize, PAGE_SIZE);
|
|
||||||
|
|
||||||
if (swiotlb_init_with_tbl(octeon_swiotlb, swiotlb_nslabs, 1) == -ENOMEM)
|
|
||||||
panic("Cannot allocate SWIOTLB buffer");
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -664,7 +664,7 @@ static int __init octeon_pci_setup(void)
|
||||||
|
|
||||||
/* BAR1 movable regions contiguous to cover the swiotlb */
|
/* BAR1 movable regions contiguous to cover the swiotlb */
|
||||||
octeon_bar1_pci_phys =
|
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++) {
|
for (index = 0; index < 32; index++) {
|
||||||
union cvmx_pci_bar1_indexx bar1_index;
|
union cvmx_pci_bar1_indexx bar1_index;
|
||||||
|
|
Loading…
Reference in a new issue