mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-16 21:35:07 +00:00
4720287c7b
This is not being used to pass ops, it is just a way to tell if an iommu driver was probed. These days this can be detected directly via device_iommu_mapped(). Call device_iommu_mapped() in the two places that need to check it and remove the iommu parameter everywhere. Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com> Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com> Reviewed-by: Moritz Fischer <mdf@kernel.org> Acked-by: Christoph Hellwig <hch@lst.de> Acked-by: Rob Herring <robh@kernel.org> Tested-by: Hector Martin <marcan@marcan.st> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/1-v2-16e4def25ebb+820-iommu_fwspec_p1_jgg@nvidia.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
54 lines
1.3 KiB
C
54 lines
1.3 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* Based on linux/arch/arm/mm/dma-mapping.c
|
|
*
|
|
* Copyright (C) 2000-2004 Russell King
|
|
*/
|
|
|
|
#include <linux/dma-map-ops.h>
|
|
#include <asm/cachetype.h>
|
|
#include <asm/cacheflush.h>
|
|
#include <asm/outercache.h>
|
|
#include <asm/cp15.h>
|
|
|
|
#include "dma.h"
|
|
|
|
void arch_sync_dma_for_device(phys_addr_t paddr, size_t size,
|
|
enum dma_data_direction dir)
|
|
{
|
|
dmac_map_area(__va(paddr), size, dir);
|
|
|
|
if (dir == DMA_FROM_DEVICE)
|
|
outer_inv_range(paddr, paddr + size);
|
|
else
|
|
outer_clean_range(paddr, paddr + size);
|
|
}
|
|
|
|
void arch_sync_dma_for_cpu(phys_addr_t paddr, size_t size,
|
|
enum dma_data_direction dir)
|
|
{
|
|
if (dir != DMA_TO_DEVICE) {
|
|
outer_inv_range(paddr, paddr + size);
|
|
dmac_unmap_area(__va(paddr), size, dir);
|
|
}
|
|
}
|
|
|
|
void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
|
|
bool coherent)
|
|
{
|
|
if (IS_ENABLED(CONFIG_CPU_V7M)) {
|
|
/*
|
|
* Cache support for v7m is optional, so can be treated as
|
|
* coherent if no cache has been detected. Note that it is not
|
|
* enough to check if MPU is in use or not since in absense of
|
|
* MPU system memory map is used.
|
|
*/
|
|
dev->dma_coherent = cacheid ? coherent : true;
|
|
} else {
|
|
/*
|
|
* Assume coherent DMA in case MMU/MPU has not been set up.
|
|
*/
|
|
dev->dma_coherent = (get_cr() & CR_M) ? coherent : true;
|
|
}
|
|
}
|