All of lore.kernel.org
 help / color / mirror / Atom feed
* Bus error after successful mmap of physical address
@ 2007-08-22 17:31 Alex Gonzalez
  2007-08-22 18:08 ` Ralf Baechle
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Gonzalez @ 2007-08-22 17:31 UTC (permalink / raw)
  To: linux-mips

Hi,

I am sure there is a basic reason why this is not working but I just
can't see it.

I am booting with mem=512MB and trying to access a memory region at
0xC0000000 mapped by a fixed TLB entry.

My driver does,

vma->vm_flags = vma->vm_flags | VM_IO | VM_RESERVED ;
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot) ;

	// Map the whole physically contiguous area in one piece
	if( (ret  = io_remap_pfn_range(vma , vma->vm_start, vma->vm_pgoff ,
vma->vm_end - vma->vm_start , vma->vm_page_prot)) < 0 )
    return ret;
	return 0

And my user space app does:

// open device
	vadr = mmap( NULL , 1024*1024 ,
PROT_WRITE|PROT_READ,MAP_NORESERVE|MAP_SHARED,device,0xC0000000);
	if(vadr == MAP_FAILED)
	{
		perror("mmap failed.\n");
		exit(-1);
	}


That goes OK, but then if I try to read or write from vadr I get a "Bus error".

Isn't that the correct way to map a physical address region to user
space? I just need to make sure that this is the case before starting
to debug the issue.

Thank a lot,
Alex

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

end of thread, other threads:[~2007-08-23 10:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-22 17:31 Bus error after successful mmap of physical address Alex Gonzalez
2007-08-22 18:08 ` Ralf Baechle
2007-08-23 10:22   ` Alex Gonzalez

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.