* PPC460EX - Machine check in kernel mode - when accessing I/O in user space
@ 2008-09-09 23:34 Henry Bausley
2008-09-10 1:29 ` Josh Boyer
0 siblings, 1 reply; 2+ messages in thread
From: Henry Bausley @ 2008-09-09 23:34 UTC (permalink / raw)
To: linuxppc-embedded
I am trying to give user space application access to I/O. Previously I
used 2.6.14 with RT Linux and made a kernel device driver with a mmap
routine on a 440EP.
I am converting to a PPC460Ex with 2.6.26-2 with Xenomai the same code
results in a Machine Check in Kernel mode when I attempt to use the code
in user space.
The io memory is in the device tree and with ioremap and I can read and
write to it in kernel mode with
of_address_to_resource(np,0,&res)
piom = (unsigned *) ioremap( res.start, RTL_SHIOM_SIZE);
In addition I tried
void *map_base, * virtAddr;
off_t target = ((unsigned int)addr) & ~MAP_MASK;
int fd;
if ((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1) {
printf("/dev/mem could not be opened.\n");
exit(1);
}
/* Map one page */
map_base = mmap((void *)target, length, PROT_READ | PROT_WRITE,
MAP_SHARED, fd, target);
if (map_base == (void *) -1) {
printf("Memory map failed for address 0x%lx\n", addr);
exit(1);
}
In my own driver I did the following for my mmap but it gives an error
as well.
//---------------------------------------
// map a pointer back for user mode usage
//----------------------------------------
static int ubus_mmap(struct file * filp, void * pvoidvma)
{
int ret;
struct vm_area_struct * vma = (struct vm_area_struct *)pvoidvma;
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
ret = remap_pfn_range(vma,
vma->vm_start,
UBUS_BASE_ADDRESS >> PAGE_SHIFT,
vma->vm_end-vma->vm_start,
vma->vm_page_prot);
if(ret != 0)
{
return -EAGAIN;
}
return 0;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: PPC460EX - Machine check in kernel mode - when accessing I/O in user space
2008-09-09 23:34 PPC460EX - Machine check in kernel mode - when accessing I/O in user space Henry Bausley
@ 2008-09-10 1:29 ` Josh Boyer
0 siblings, 0 replies; 2+ messages in thread
From: Josh Boyer @ 2008-09-10 1:29 UTC (permalink / raw)
To: Henry Bausley; +Cc: linuxppc-embedded
On Tue, Sep 09, 2008 at 04:34:07PM -0700, Henry Bausley wrote:
>I am trying to give user space application access to I/O. Previously I
>used 2.6.14 with RT Linux and made a kernel device driver with a mmap
>routine on a 440EP.
>
>I am converting to a PPC460Ex with 2.6.26-2 with Xenomai the same code
>results in a Machine Check in Kernel mode when I attempt to use the code
>in user space.
>
>
>The io memory is in the device tree and with ioremap and I can read and
>write to it in kernel mode with
>
>of_address_to_resource(np,0,&res)
>piom = (unsigned *) ioremap( res.start, RTL_SHIOM_SIZE);
>
>
>
>In addition I tried
>
> void *map_base, * virtAddr;
> off_t target = ((unsigned int)addr) & ~MAP_MASK;
> int fd;
>
> if ((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1) {
> printf("/dev/mem could not be opened.\n");
> exit(1);
> }
>
> /* Map one page */
> map_base = mmap((void *)target, length, PROT_READ | PROT_WRITE,
> MAP_SHARED, fd, target);
You want mmap2 here. The I/O on 440EPx is above 4GiB.
josh
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-09-10 1:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-09 23:34 PPC460EX - Machine check in kernel mode - when accessing I/O in user space Henry Bausley
2008-09-10 1:29 ` Josh Boyer
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).