| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2005-2008, PA Semi, Inc |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Maintained by: Olof Johansson <olof@lixom.net> |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 8 | | - * published by the Free Software Foundation. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 11 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | | - * GNU General Public License for more details. |
|---|
| 14 | | - * |
|---|
| 15 | | - * You should have received a copy of the GNU General Public License |
|---|
| 16 | | - * along with this program; if not, write to the Free Software |
|---|
| 17 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 18 | 6 | */ |
|---|
| 19 | 7 | |
|---|
| 20 | 8 | #undef DEBUG |
|---|
| .. | .. |
|---|
| 158 | 146 | */ |
|---|
| 159 | 147 | iommu_table_iobmap.it_blocksize = 4; |
|---|
| 160 | 148 | iommu_table_iobmap.it_ops = &iommu_table_iobmap_ops; |
|---|
| 161 | | - iommu_init_table(&iommu_table_iobmap, 0); |
|---|
| 149 | + iommu_init_table(&iommu_table_iobmap, 0, 0, 0); |
|---|
| 162 | 150 | pr_debug(" <- %s\n", __func__); |
|---|
| 163 | 151 | } |
|---|
| 164 | 152 | |
|---|
| .. | .. |
|---|
| 186 | 174 | */ |
|---|
| 187 | 175 | if (dev->vendor == 0x1959 && dev->device == 0xa007 && |
|---|
| 188 | 176 | !firmware_has_feature(FW_FEATURE_LPAR)) { |
|---|
| 189 | | - dev->dev.dma_ops = &dma_nommu_ops; |
|---|
| 177 | + dev->dev.dma_ops = NULL; |
|---|
| 190 | 178 | /* |
|---|
| 191 | 179 | * Set the coherent DMA mask to prevent the iommu |
|---|
| 192 | 180 | * being used unnecessarily |
|---|
| .. | .. |
|---|
| 208 | 196 | pr_debug(" -> %s\n", __func__); |
|---|
| 209 | 197 | |
|---|
| 210 | 198 | /* For 2G space, 8x64 pages (2^21 bytes) is max total l2 size */ |
|---|
| 211 | | - iob_l2_base = (u32 *)__va(memblock_alloc_base(1UL<<21, 1UL<<21, 0x80000000)); |
|---|
| 199 | + iob_l2_base = memblock_alloc_try_nid_raw(1UL << 21, 1UL << 21, |
|---|
| 200 | + MEMBLOCK_LOW_LIMIT, 0x80000000, |
|---|
| 201 | + NUMA_NO_NODE); |
|---|
| 202 | + if (!iob_l2_base) |
|---|
| 203 | + panic("%s: Failed to allocate %lu bytes align=0x%lx max_addr=%x\n", |
|---|
| 204 | + __func__, 1UL << 21, 1UL << 21, 0x80000000); |
|---|
| 212 | 205 | |
|---|
| 213 | 206 | pr_info("IOBMAP L2 allocated at: %p\n", iob_l2_base); |
|---|
| 214 | 207 | |
|---|
| 215 | 208 | /* Allocate a spare page to map all invalid IOTLB pages. */ |
|---|
| 216 | | - tmp = memblock_alloc(IOBMAP_PAGE_SIZE, IOBMAP_PAGE_SIZE); |
|---|
| 209 | + tmp = memblock_phys_alloc(IOBMAP_PAGE_SIZE, IOBMAP_PAGE_SIZE); |
|---|
| 217 | 210 | if (!tmp) |
|---|
| 218 | 211 | panic("IOBMAP: Cannot allocate spare page!"); |
|---|
| 219 | 212 | /* Empty l1 is marked invalid */ |
|---|
| .. | .. |
|---|
| 269 | 262 | pasemi_pci_controller_ops.dma_bus_setup = pci_dma_bus_setup_pasemi; |
|---|
| 270 | 263 | set_pci_dma_ops(&dma_iommu_ops); |
|---|
| 271 | 264 | } |
|---|
| 272 | | - |
|---|