|
160 | 160 |
|
161 | 161 | #define ARM_V7S_TCR_PD1 BIT(5)
|
162 | 162 |
|
| 163 | +#ifdef CONFIG_ZONE_DMA32 |
| 164 | +#define ARM_V7S_TABLE_GFP_DMA GFP_DMA32 |
| 165 | +#define ARM_V7S_TABLE_SLAB_FLAGS SLAB_CACHE_DMA32 |
| 166 | +#else |
| 167 | +#define ARM_V7S_TABLE_GFP_DMA GFP_DMA |
| 168 | +#define ARM_V7S_TABLE_SLAB_FLAGS SLAB_CACHE_DMA |
| 169 | +#endif |
| 170 | + |
163 | 171 | typedef u32 arm_v7s_iopte;
|
164 | 172 |
|
165 | 173 | static bool selftest_running;
|
@@ -197,13 +205,16 @@ static void *__arm_v7s_alloc_table(int lvl, gfp_t gfp,
|
197 | 205 | void *table = NULL;
|
198 | 206 |
|
199 | 207 | if (lvl == 1)
|
200 |
| - table = (void *)__get_dma_pages(__GFP_ZERO, get_order(size)); |
| 208 | + table = (void *)__get_free_pages( |
| 209 | + __GFP_ZERO | ARM_V7S_TABLE_GFP_DMA, get_order(size)); |
201 | 210 | else if (lvl == 2)
|
202 |
| - table = kmem_cache_zalloc(data->l2_tables, gfp | GFP_DMA); |
| 211 | + table = kmem_cache_zalloc(data->l2_tables, gfp); |
203 | 212 | phys = virt_to_phys(table);
|
204 |
| - if (phys != (arm_v7s_iopte)phys) |
| 213 | + if (phys != (arm_v7s_iopte)phys) { |
205 | 214 | /* Doesn't fit in PTE */
|
| 215 | + dev_err(dev, "Page table does not fit in PTE: %pa", &phys); |
206 | 216 | goto out_free;
|
| 217 | + } |
207 | 218 | if (table && !(cfg->quirks & IO_PGTABLE_QUIRK_NO_DMA)) {
|
208 | 219 | dma = dma_map_single(dev, table, size, DMA_TO_DEVICE);
|
209 | 220 | if (dma_mapping_error(dev, dma))
|
@@ -733,7 +744,7 @@ static struct io_pgtable *arm_v7s_alloc_pgtable(struct io_pgtable_cfg *cfg,
|
733 | 744 | data->l2_tables = kmem_cache_create("io-pgtable_armv7s_l2",
|
734 | 745 | ARM_V7S_TABLE_SIZE(2),
|
735 | 746 | ARM_V7S_TABLE_SIZE(2),
|
736 |
| - SLAB_CACHE_DMA, NULL); |
| 747 | + ARM_V7S_TABLE_SLAB_FLAGS, NULL); |
737 | 748 | if (!data->l2_tables)
|
738 | 749 | goto out_free_data;
|
739 | 750 |
|
|
0 commit comments