Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ae7871be authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Konrad Rzeszutek Wilk
Browse files

swiotlb: Convert swiotlb_force from int to enum



Convert the flag swiotlb_force from an int to an enum, to prepare for
the advent of more possible values.

Suggested-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
parent 6c206e4d
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -524,7 +524,8 @@ EXPORT_SYMBOL(dummy_dma_ops);

static int __init arm64_dma_init(void)
{
	if (swiotlb_force || max_pfn > (arm64_dma_phys_limit >> PAGE_SHIFT))
	if (swiotlb_force == SWIOTLB_FORCE ||
	    max_pfn > (arm64_dma_phys_limit >> PAGE_SHIFT))
		swiotlb = 1;

	return atomic_pool_init();
+2 −1
Original line number Diff line number Diff line
@@ -401,7 +401,8 @@ static void __init free_unused_memmap(void)
 */
void __init mem_init(void)
{
	if (swiotlb_force || max_pfn > (arm64_dma_phys_limit >> PAGE_SHIFT))
	if (swiotlb_force == SWIOTLB_FORCE ||
	    max_pfn > (arm64_dma_phys_limit >> PAGE_SHIFT))
		swiotlb_init(1);

	set_max_mapnr(pfn_to_page(max_pfn) - mem_map);
+1 −1
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ static struct dma_map_ops swiotlb_dma_ops = {
 */
int __init pci_swiotlb_detect_override(void)
{
	if (swiotlb_force)
	if (swiotlb_force == SWIOTLB_FORCE)
		swiotlb = 1;

	return swiotlb;
+1 −1
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ int __init pci_xen_swiotlb_detect(void)
	 * activate this IOMMU. If running as PV privileged, activate it
	 * irregardless.
	 */
	if ((xen_initial_domain() || swiotlb || swiotlb_force))
	if (xen_initial_domain() || swiotlb || swiotlb_force == SWIOTLB_FORCE)
		xen_swiotlb = 1;

	/* If we are running under Xen, we MUST disable the native SWIOTLB.
+2 −2
Original line number Diff line number Diff line
@@ -392,7 +392,7 @@ dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page,
	if (dma_capable(dev, dev_addr, size) &&
	    !range_straddles_page_boundary(phys, size) &&
		!xen_arch_need_swiotlb(dev, phys, dev_addr) &&
		!swiotlb_force) {
		(swiotlb_force != SWIOTLB_FORCE)) {
		/* we are not interested in the dma_addr returned by
		 * xen_dma_map_page, only in the potential cache flushes executed
		 * by the function. */
@@ -552,7 +552,7 @@ xen_swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl,
		phys_addr_t paddr = sg_phys(sg);
		dma_addr_t dev_addr = xen_phys_to_bus(paddr);

		if (swiotlb_force ||
		if (swiotlb_force == SWIOTLB_FORCE ||
		    xen_arch_need_swiotlb(hwdev, paddr, dev_addr) ||
		    !dma_capable(hwdev, dev_addr, sg->length) ||
		    range_straddles_page_boundary(paddr, sg->length)) {
Loading