[PATCH] drm/i915: switch from 'pci_' to 'dma_' API
Robin Murphy
robin.murphy at arm.com
Tue Aug 24 10:04:25 UTC 2021
Hi,
FWIW this patch itself looks fine, but it does highlight some things
which could be further cleaned up if anyone's interested...
On 2021-08-22 22:06, Christophe JAILLET wrote:
[...]
> diff --git a/drivers/gpu/drm/i915/gt/intel_region_lmem.c b/drivers/gpu/drm/i915/gt/intel_region_lmem.c
> index a74b72f50cc9..afb35d2e5c73 100644
> --- a/drivers/gpu/drm/i915/gt/intel_region_lmem.c
> +++ b/drivers/gpu/drm/i915/gt/intel_region_lmem.c
> @@ -32,7 +32,7 @@ static int init_fake_lmem_bar(struct intel_memory_region *mem)
> mem->remap_addr = dma_map_resource(i915->drm.dev,
> mem->region.start,
> mem->fake_mappable.size,
> - PCI_DMA_BIDIRECTIONAL,
> + DMA_BIDIRECTIONAL,
> DMA_ATTR_FORCE_CONTIGUOUS);
DMA_ATTR_FORCE_CONTIGUOUS is nonsensical here (and below) as it is only
meaningful for coherent buffers allocated by dma_alloc_attrs().
> if (dma_mapping_error(i915->drm.dev, mem->remap_addr)) {
> drm_mm_remove_node(&mem->fake_mappable);
> @@ -62,7 +62,7 @@ static void release_fake_lmem_bar(struct intel_memory_region *mem)
> dma_unmap_resource(mem->i915->drm.dev,
> mem->remap_addr,
> mem->fake_mappable.size,
> - PCI_DMA_BIDIRECTIONAL,
> + DMA_BIDIRECTIONAL,
> DMA_ATTR_FORCE_CONTIGUOUS);
> }
>
[...]
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 36489be4896b..cd5f2348a187 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -30,7 +30,7 @@ int i915_gem_gtt_prepare_pages(struct drm_i915_gem_object *obj,
> do {
> if (dma_map_sg_attrs(obj->base.dev->dev,
> pages->sgl, pages->nents,
> - PCI_DMA_BIDIRECTIONAL,
> + DMA_BIDIRECTIONAL,
> DMA_ATTR_SKIP_CPU_SYNC |
> DMA_ATTR_NO_KERNEL_MAPPING |
> DMA_ATTR_NO_WARN))
Similarly DMA_ATTR_NO_KERNEL_MAPPING and DMA_ATTR_NO_WARN are also for
coherent allocations rather than streaming mappings.
I'll see if I can whip up a patch to make the API documentation clearer...
Thanks,
Robin.
> @@ -64,7 +64,7 @@ void i915_gem_gtt_finish_pages(struct drm_i915_gem_object *obj,
> usleep_range(100, 250);
>
> dma_unmap_sg(i915->drm.dev, pages->sgl, pages->nents,
> - PCI_DMA_BIDIRECTIONAL);
> + DMA_BIDIRECTIONAL);
> }
>
> /**
>
More information about the dri-devel
mailing list