linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* UIO: phys_mem_access_prot() miss?
@ 2008-05-13 13:55 Johann Baudy
  2008-05-13 18:51 ` Hans J. Koch
  0 siblings, 1 reply; 3+ messages in thread
From: Johann Baudy @ 2008-05-13 13:55 UTC (permalink / raw)
  To: hjk, gregkh; +Cc: linux-kernel

Hi Hans, Greg,

I need some help on UIO driver.
I have to add this below workaround (in uio.c) to be able to access
phys memory from user space.
I'm currently using PPC arch.
Am I wrong? or Is it a miss?

static int uio_mmap(struct file *filep, struct vm_area_struct *vma)
{

...
	switch (idev->info->mem[mi].memtype) {
		case UIO_MEM_PHYS:
+       	vma->vm_page_prot = phys_mem_access_prot(filep,
+            idev->info->mem[mi].addr >> PAGE_SHIFT,
+						 vma->vm_end - vma->vm_start,
+						 vma->vm_page_prot);
			return uio_mmap_physical(vma);
		case UIO_MEM_LOGICAL:
...

}

FYI: I've copied those lines from mem char driver in mmap_mem().

Thanks in advance,
Johann

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: UIO: phys_mem_access_prot() miss?
  2008-05-13 13:55 UIO: phys_mem_access_prot() miss? Johann Baudy
@ 2008-05-13 18:51 ` Hans J. Koch
  2008-05-15  7:45   ` Johann Baudy
  0 siblings, 1 reply; 3+ messages in thread
From: Hans J. Koch @ 2008-05-13 18:51 UTC (permalink / raw)
  To: Johann Baudy; +Cc: hjk, gregkh, linux-kernel

On Tue, May 13, 2008 at 03:55:29PM +0200, Johann Baudy wrote:
> Hi Hans, Greg,
> 
> I need some help on UIO driver.
> I have to add this below workaround (in uio.c) to be able to access
> phys memory from user space.
> I'm currently using PPC arch.
> Am I wrong? or Is it a miss?
> 
> static int uio_mmap(struct file *filep, struct vm_area_struct *vma)
> {
> 
> ...
> 	switch (idev->info->mem[mi].memtype) {
> 		case UIO_MEM_PHYS:
> +       	vma->vm_page_prot = phys_mem_access_prot(filep,
> +            idev->info->mem[mi].addr >> PAGE_SHIFT,
> +						 vma->vm_end - vma->vm_start,
> +						 vma->vm_page_prot);
> 			return uio_mmap_physical(vma);
> 		case UIO_MEM_LOGICAL:
> ...
> 
> }
> 
> FYI: I've copied those lines from mem char driver in mmap_mem().

Hi Johann,
what kernel are you using? Similar problems were reported before, and
we've already applied a patch that should fix it. I think it hit
mainline shortly before the 2.6.25 release. uio_mmap() should work with
kernels >= 2.6.25 for PPC.

Thanks,
Hans


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: UIO: phys_mem_access_prot() miss?
  2008-05-13 18:51 ` Hans J. Koch
@ 2008-05-15  7:45   ` Johann Baudy
  0 siblings, 0 replies; 3+ messages in thread
From: Johann Baudy @ 2008-05-15  7:45 UTC (permalink / raw)
  To: Hans J. Koch; +Cc: gregkh, linux-kernel

Many thanks Hans,

Sorry for late reply. I'm currently using linux-2.6.24-rc8-xlnx (git.xilinx.com)
I will try to rebase and let you know.

Best regards,
Johann

On Tue, May 13, 2008 at 8:51 PM, Hans J. Koch <hjk@linutronix.de> wrote:
> On Tue, May 13, 2008 at 03:55:29PM +0200, Johann Baudy wrote:
>> Hi Hans, Greg,
>>
>> I need some help on UIO driver.
>> I have to add this below workaround (in uio.c) to be able to access
>> phys memory from user space.
>> I'm currently using PPC arch.
>> Am I wrong? or Is it a miss?
>>
>> static int uio_mmap(struct file *filep, struct vm_area_struct *vma)
>> {
>>
>> ...
>>       switch (idev->info->mem[mi].memtype) {
>>               case UIO_MEM_PHYS:
>> +             vma->vm_page_prot = phys_mem_access_prot(filep,
>> +            idev->info->mem[mi].addr >> PAGE_SHIFT,
>> +                                              vma->vm_end - vma->vm_start,
>> +                                              vma->vm_page_prot);
>>                       return uio_mmap_physical(vma);
>>               case UIO_MEM_LOGICAL:
>> ...
>>
>> }
>>
>> FYI: I've copied those lines from mem char driver in mmap_mem().
>
> Hi Johann,
> what kernel are you using? Similar problems were reported before, and
> we've already applied a patch that should fix it. I think it hit
> mainline shortly before the 2.6.25 release. uio_mmap() should work with
> kernels >= 2.6.25 for PPC.
>
> Thanks,
> Hans
>
>



-- 
Johann Baudy
johaahn@gmail.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-05-15  7:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-13 13:55 UIO: phys_mem_access_prot() miss? Johann Baudy
2008-05-13 18:51 ` Hans J. Koch
2008-05-15  7:45   ` Johann Baudy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).