Skip to content

Commit c6af2aa

Browse files
author
Christoph Hellwig
committed
swiotlb: make the swiotlb_init interface more useful
Pass a boolean flag to indicate if swiotlb needs to be enabled based on the addressing needs, and replace the verbose argument with a set of flags, including one to force enable bounce buffering. Note that this patch removes the possibility to force xen-swiotlb use with the swiotlb=force parameter on the command line on x86 (arm and arm64 never supported that), but this interface will be restored shortly. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Konrad Rzeszutek Wilk <[email protected]> Tested-by: Boris Ostrovsky <[email protected]>
1 parent a3e2309 commit c6af2aa

File tree

15 files changed

+55
-82
lines changed

15 files changed

+55
-82
lines changed

arch/arm/mm/init.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,7 @@ static void __init free_highpages(void)
271271
void __init mem_init(void)
272272
{
273273
#ifdef CONFIG_ARM_LPAE
274-
if (swiotlb_force == SWIOTLB_FORCE ||
275-
max_pfn > arm_dma_pfn_limit)
276-
swiotlb_init(1);
277-
else
278-
swiotlb_force = SWIOTLB_NO_FORCE;
274+
swiotlb_init(max_pfn > arm_dma_pfn_limit, SWIOTLB_VERBOSE);
279275
#endif
280276

281277
set_max_mapnr(pfn_to_page(max_pfn) - mem_map);

arch/arm64/mm/init.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -398,11 +398,7 @@ void __init bootmem_init(void)
398398
*/
399399
void __init mem_init(void)
400400
{
401-
if (swiotlb_force == SWIOTLB_FORCE ||
402-
max_pfn > PFN_DOWN(arm64_dma_phys_limit))
403-
swiotlb_init(1);
404-
else if (!xen_swiotlb_detect())
405-
swiotlb_force = SWIOTLB_NO_FORCE;
401+
swiotlb_init(max_pfn > PFN_DOWN(arm64_dma_phys_limit), SWIOTLB_VERBOSE);
406402

407403
/* this will put all unused low memory onto the freelists */
408404
memblock_free_all();

arch/ia64/mm/init.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,9 +437,7 @@ mem_init (void)
437437
if (iommu_detected)
438438
break;
439439
#endif
440-
#ifdef CONFIG_SWIOTLB
441-
swiotlb_init(1);
442-
#endif
440+
swiotlb_init(true, SWIOTLB_VERBOSE);
443441
} while (0);
444442

445443
#ifdef CONFIG_FLATMEM

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,5 +235,5 @@ void __init plat_swiotlb_setup(void)
235235
#endif
236236

237237
swiotlb_adjust_size(swiotlbsize);
238-
swiotlb_init(1);
238+
swiotlb_init(true, SWIOTLB_VERBOSE);
239239
}

arch/mips/loongson64/dma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr)
2424

2525
void __init plat_swiotlb_setup(void)
2626
{
27-
swiotlb_init(1);
27+
swiotlb_init(true, SWIOTLB_VERBOSE);
2828
}

arch/mips/sibyte/common/dma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010

1111
void __init plat_swiotlb_setup(void)
1212
{
13-
swiotlb_init(1);
13+
swiotlb_init(true, SWIOTLB_VERBOSE);
1414
}

arch/powerpc/mm/mem.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <linux/suspend.h>
1818
#include <linux/dma-direct.h>
1919

20+
#include <asm/swiotlb.h>
2021
#include <asm/machdep.h>
2122
#include <asm/rtas.h>
2223
#include <asm/kasan.h>
@@ -251,7 +252,7 @@ void __init mem_init(void)
251252
if (is_secure_guest())
252253
svm_swiotlb_init();
253254
else
254-
swiotlb_init(0);
255+
swiotlb_init(ppc_swiotlb_enable, 0);
255256
#endif
256257

257258
high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);

arch/powerpc/platforms/pseries/setup.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -849,9 +849,6 @@ static void __init pSeries_setup_arch(void)
849849
}
850850

851851
ppc_md.pcibios_root_bridge_prepare = pseries_root_bridge_prepare;
852-
853-
if (swiotlb_force == SWIOTLB_FORCE)
854-
ppc_swiotlb_enable = 1;
855852
}
856853

857854
static void pseries_panic(char *str)

arch/riscv/mm/init.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,7 @@ void __init mem_init(void)
120120
BUG_ON(!mem_map);
121121
#endif /* CONFIG_FLATMEM */
122122

123-
#ifdef CONFIG_SWIOTLB
124-
if (swiotlb_force == SWIOTLB_FORCE ||
125-
max_pfn > PFN_DOWN(dma32_phys_limit))
126-
swiotlb_init(1);
127-
else
128-
swiotlb_force = SWIOTLB_NO_FORCE;
129-
#endif
123+
swiotlb_init(max_pfn > PFN_DOWN(dma32_phys_limit), SWIOTLB_VERBOSE);
130124
memblock_free_all();
131125

132126
print_vm_layout();

arch/s390/mm/init.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,7 @@ static void pv_init(void)
185185
return;
186186

187187
/* make sure bounce buffers are shared */
188-
swiotlb_force = SWIOTLB_FORCE;
189-
swiotlb_init(1);
188+
swiotlb_init(true, SWIOTLB_FORCE | SWIOTLB_VERBOSE);
190189
swiotlb_update_mem_attributes();
191190
}
192191

0 commit comments

Comments
 (0)