lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <0cd61d5b-ac88-31e8-99ad-143af480416f@arm.com>
Date:   Tue, 24 Aug 2021 11:04:25 +0100
From:   Robin Murphy <robin.murphy@....com>
To:     Christophe JAILLET <christophe.jaillet@...adoo.fr>,
        jani.nikula@...ux.intel.com, joonas.lahtinen@...ux.intel.com,
        rodrigo.vivi@...el.com, airlied@...ux.ie, daniel@...ll.ch,
        zhenyuw@...ux.intel.com, zhi.a.wang@...el.com
Cc:     intel-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
        intel-gvt-dev@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
        kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] drm/i915: switch from 'pci_' to 'dma_' API

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);
>   }
>   
>   /**
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ