Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1314372

Re: [PATCH] staging: android: ion: Set the length of the DMA sg entries in buffer

From Laura Abbott <labbott@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH] staging: android: ion: Set the length of the DMA sg entries in buffer
Date 2016-01-21 18:40 +0100
Message-ID <qTrnb-5X-7@gated-at.bofh.it> (permalink)
References <qTm4a-4Jh-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 01/21/2016 03:57 AM, Jon Medhurst (Tixy) wrote:
> From: Liviu Dudau <Liviu.Dudau@arm.com>
>
> ion_buffer_create() will allocate a buffer and then create a DMA
> mapping for it, but it forgot to set the length of the page entries.
>
> Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
> Signed-off-by: Jon Medhurst <tixy@linaro.org>
> ---
>   drivers/staging/android/ion/ion.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
> index e237e9f..df56021 100644
> --- a/drivers/staging/android/ion/ion.c
> +++ b/drivers/staging/android/ion/ion.c
> @@ -251,8 +251,10 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap,
>   	 * memory coming from the heaps is ready for dma, ie if it has a
>   	 * cached mapping that mapping has been invalidated
>   	 */
> -	for_each_sg(buffer->sg_table->sgl, sg, buffer->sg_table->nents, i)
> +	for_each_sg(buffer->sg_table->sgl, sg, buffer->sg_table->nents, i) {
>   		sg_dma_address(sg) = sg_phys(sg);
> +		sg_dma_len(sg) = sg->length;
> +	}
>   	mutex_lock(&dev->buffer_lock);
>   	ion_buffer_add(dev, buffer);
>   	mutex_unlock(&dev->buffer_lock);
>

So Ion is really doing it wrong by setting the sg_dma_address manually as
the comment above notes. Ion has moved away from sg_dma_len though
(see 06e0dcaeb4fd72a010a1f5ad0c03abd8e0a58ef9). This isn't technically
a mapping as well. What's broken by not having sg_dma_len set?

Thanks,
Laura

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] staging: android: ion: Set the length of the DMA sg entries  in buffer "Jon Medhurst (Tixy)" <tixy@linaro.org> - 2016-01-21 13:00 +0100
  Re: [PATCH] staging: android: ion: Set the length of the DMA sg  entries in buffer Laura Abbott <labbott@redhat.com> - 2016-01-21 18:40 +0100
    Re: [PATCH] staging: android: ion: Set the length of the DMA sg  entries in buffer "Jon Medhurst (Tixy)" <tixy@linaro.org> - 2016-01-21 21:20 +0100
      Re: [PATCH] staging: android: ion: Set the length of the DMA sg  entries in buffer Laura Abbott <labbott@redhat.com> - 2016-01-22 02:00 +0100
        Re: [PATCH] staging: android: ion: Set the length of the DMA sg  entries in buffer "Jon Medhurst (Tixy)" <tixy@linaro.org> - 2016-01-22 11:10 +0100

csiph-web