All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: "chen.fang@freescale.com" <chen.fang@freescale.com>,
	"m.chehab@samsung.com" <m.chehab@samsung.com>,
	"viro@ZenIV.linux.org.uk" <viro@ZenIV.linux.org.uk>
Cc: Shawn Guo <Shawn.Guo@freescale.com>,
	"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Marek Szyprowski <m.szyprowski@samsung.com>
Subject: Re: [PATCH] [media] videobuf-dma-contig: replace vm_iomap_memory() with remap_pfn_range().
Date: Wed, 10 Sep 2014 09:21:21 +0200	[thread overview]
Message-ID: <540FFBF1.6060702@xs4all.nl> (raw)
In-Reply-To: <566c6b8349ba4c2ead8f76ff04b52e65@BY2PR03MB556.namprd03.prod.outlook.com>

On 09/10/14 09:14, chen.fang@freescale.com wrote:
> It is not a theoretically issue, it is a real case that the mapping failed issue happens in 3.14.y kernel but not happens in previous 3.10.y kernel.
> So I need your confirmation on it.

With which driver does this happen? On which architecture?

Regards,

	Hans

> 
> Thanks.
> 
> Best regards,
> Fancy Fang
> 
> -----Original Message-----
> From: Hans Verkuil [mailto:hverkuil@xs4all.nl] 
> Sent: Wednesday, September 10, 2014 3:01 PM
> To: Fang Chen-B47543; m.chehab@samsung.com; viro@ZenIV.linux.org.uk
> Cc: Guo Shawn-R65073; linux-media@vger.kernel.org; linux-kernel@vger.kernel.org; Marek Szyprowski
> Subject: Re: [PATCH] [media] videobuf-dma-contig: replace vm_iomap_memory() with remap_pfn_range().
> 
> On 09/10/14 07:28, Fancy Fang wrote:
>> When user requests V4L2_MEMORY_MMAP type buffers, the videobuf-core 
>> will assign the corresponding offset to the 'boff' field of the 
>> videobuf_buffer for each requested buffer sequentially. Later, user 
>> may call mmap() to map one or all of the buffers with the 'offset'
>> parameter which is equal to its 'boff' value. Obviously, the 'offset'
>> value is only used to find the matched buffer instead of to be the 
>> real offset from the buffer's physical start address as used by 
>> vm_iomap_memory(). So, in some case that if the offset is not zero,
>> vm_iomap_memory() will fail.
> 
> Is this just a fix for something that can fail theoretically, or do you actually have a case where this happens? I am very reluctant to make any changes to videobuf. Drivers should all migrate to vb2.
> 
> I have CC-ed Marek as well since he knows a lot more about this stuff than I do.
> 
> Regards,
> 
> 	Hans
> 
>>
>> Signed-off-by: Fancy Fang <chen.fang@freescale.com>
>> ---
>>  drivers/media/v4l2-core/videobuf-dma-contig.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/media/v4l2-core/videobuf-dma-contig.c 
>> b/drivers/media/v4l2-core/videobuf-dma-contig.c
>> index bf80f0f..8bd9889 100644
>> --- a/drivers/media/v4l2-core/videobuf-dma-contig.c
>> +++ b/drivers/media/v4l2-core/videobuf-dma-contig.c
>> @@ -305,7 +305,9 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q,
>>  	/* Try to remap memory */
>>  	size = vma->vm_end - vma->vm_start;
>>  	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
>> -	retval = vm_iomap_memory(vma, mem->dma_handle, size);
>> +	retval = remap_pfn_range(vma, vma->vm_start,
>> +				 mem->dma_handle >> PAGE_SHIFT,
>> +				 size, vma->vm_page_prot);
>>  	if (retval) {
>>  		dev_err(q->dev, "mmap: remap failed with error %d. ",
>>  			retval);
>>
> 


  reply	other threads:[~2014-09-10  7:22 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-10  5:28 [PATCH] [media] videobuf-dma-contig: replace vm_iomap_memory() with remap_pfn_range() Fancy Fang
2014-09-10  7:00 ` Hans Verkuil
2014-09-10  7:14   ` chen.fang
2014-09-10  7:21     ` Hans Verkuil [this message]
2014-09-10  7:30       ` chen.fang
2014-09-23  3:11       ` chen.fang
2014-09-23  6:10         ` Hans Verkuil
2014-09-24  3:29           ` chen.fang
2014-09-24 10:27             ` Hans Verkuil
2014-09-24 12:40   ` Marek Szyprowski
2014-09-24 12:42     ` Hans Verkuil
2014-09-25  2:17       ` chen.fang
2014-09-25  2:17         ` chen.fang
2014-09-25  2:20       ` chen.fang
2014-09-25  2:20         ` chen.fang
  -- strict thread matches above, loose matches on Subject: below --
2014-09-04  8:34 Fancy Fang
2014-09-02  8:23 Fancy Fang

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=540FFBF1.6060702@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=Shawn.Guo@freescale.com \
    --cc=chen.fang@freescale.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=m.chehab@samsung.com \
    --cc=m.szyprowski@samsung.com \
    --cc=viro@ZenIV.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.