mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Laura Abbott <labbott@redhat.com>
To: "Jon Medhurst (Tixy)" <tixy@linaro.org>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Arve Hjønnevåg" <arve@android.com>,
	"Riley Andrews" <riandrews@android.com>
Cc: Liviu Dudau <Liviu.Dudau@arm.com>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: android: ion: Set the length of the DMA sg entries in buffer
Date: Thu, 21 Jan 2016 09:39:02 -0800	[thread overview]
Message-ID: <56A117B6.7050503@redhat.com> (raw)
In-Reply-To: <1453377467.2858.14.camel@linaro.org>

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

  reply	other threads:[~2016-01-21 17:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-21 11:57 Jon Medhurst (Tixy)
2016-01-21 17:39 ` Laura Abbott [this message]
2016-01-21 20:19   ` Jon Medhurst (Tixy)
2016-01-22  0:58     ` Laura Abbott
2016-01-22  9:43       ` Jon Medhurst (Tixy)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56A117B6.7050503@redhat.com \
    --to=labbott@redhat.com \
    --cc=Liviu.Dudau@arm.com \
    --cc=arve@android.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=riandrews@android.com \
    --cc=tixy@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome