Commit c6af2aa9 authored by Christoph Hellwig's avatar Christoph Hellwig
Browse files

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: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Tested-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
parent a3e23092
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -271,11 +271,7 @@ static void __init free_highpages(void)
void __init mem_init(void)
{
#ifdef CONFIG_ARM_LPAE
	if (swiotlb_force == SWIOTLB_FORCE ||
	    max_pfn > arm_dma_pfn_limit)
		swiotlb_init(1);
	else
		swiotlb_force = SWIOTLB_NO_FORCE;
	swiotlb_init(max_pfn > arm_dma_pfn_limit, SWIOTLB_VERBOSE);
#endif

	set_max_mapnr(pfn_to_page(max_pfn) - mem_map);
+1 −5
Original line number Diff line number Diff line
@@ -398,11 +398,7 @@ void __init bootmem_init(void)
 */
void __init mem_init(void)
{
	if (swiotlb_force == SWIOTLB_FORCE ||
	    max_pfn > PFN_DOWN(arm64_dma_phys_limit))
		swiotlb_init(1);
	else if (!xen_swiotlb_detect())
		swiotlb_force = SWIOTLB_NO_FORCE;
	swiotlb_init(max_pfn > PFN_DOWN(arm64_dma_phys_limit), SWIOTLB_VERBOSE);

	/* this will put all unused low memory onto the freelists */
	memblock_free_all();
+1 −3
Original line number Diff line number Diff line
@@ -437,9 +437,7 @@ mem_init (void)
		if (iommu_detected)
			break;
#endif
#ifdef CONFIG_SWIOTLB
		swiotlb_init(1);
#endif
		swiotlb_init(true, SWIOTLB_VERBOSE);
	} while (0);

#ifdef CONFIG_FLATMEM
+1 −1
Original line number Diff line number Diff line
@@ -235,5 +235,5 @@ void __init plat_swiotlb_setup(void)
#endif

	swiotlb_adjust_size(swiotlbsize);
	swiotlb_init(1);
	swiotlb_init(true, SWIOTLB_VERBOSE);
}
+1 −1
Original line number Diff line number Diff line
@@ -24,5 +24,5 @@ phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr)

void __init plat_swiotlb_setup(void)
{
	swiotlb_init(1);
	swiotlb_init(true, SWIOTLB_VERBOSE);
}
Loading