Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

ioremap() bug in Nios2 kernel

Altera_Forum
Honored Contributor II
1,080 Views

There is a critical bug, in the ioremap() function. It didn't uncache the address mapping. 

It existed for all Nios2 kernel released. 

This will cause problems in mtd driver, and others. 

Smcnutt noted it in 2004. Feiwu had problem in netflash lately. 

 

Please check this, (and let me know if you have better idea) 

 

Please patch, 

__ioremap() in file arch/nios2nommu/mm/ioremap.c 

 

/* 

* Map some physical address range into the kernel address space. 

*/ 

 

void *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag) 

return (void *)(physaddr | 0x80000000); // always uncached 

 

 

Another issue, which existed in kernel 2.6.16 and 2.6.17 . 

Miked and Heing had resolved the problems of module loading from initramfs and BOA by updating the file , linux-2.6.x/fs/ramfs/file-nommu.c, as it was fixed in kernel 2.6.18 

 

int ramfs_nommu_mmap(struct file *file, struct vm_area_struct *vma) 

return vma->vm_flags & VM_SHARED ? 0 : -ENOSYS; 

}
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
390 Views

Update, please disregard my first port. 

Actually, the original code did not do anything about uncache. 

I could agree with that, if all the access are consistent. 

ie, always use the uncached functions (from io.h) to access memory, 

and never mix access with the cached virt address . 

 

see, 

http://forum.niosforum.com/forum/index.php...&st=0&p=18788&# (http://forum.niosforum.com/forum/index.php?showtopic=4925&st=0&p=18788&#)
0 Kudos
Reply