Messages in this thread | | | Date | Thu, 12 Nov 1998 21:48:26 +0100 (MET) | From | Gerard Roudier <> | Subject | Re: virt_to_bus and >1G of memory (was MAX_DMA_ADDRESS ...) |
| |
On Thu, 12 Nov 1998, Kurt Garloff wrote:
> On Thu, Nov 12, 1998 at 03:59:38PM +0100, Kurt Garloff wrote: > > Reading this, I wonder, why my kernel with PAGE_OFFSET 0x70000000 does work. > > Somebody able to explain this? > > And it crashes with an ,,Unable to handle kernel paging request at > e4414007`` in the ncr53c8xx (3.0i) driver, if I apply the following patch. > So is the idea about what it should look like wrong, or is it the ncr53c8xx > driver?
For DMAing from devices, drivers call virt_to_bus() that provides the address devices have to use to hit the right memory location from the bus. Being wrong is harder then being right for that, but obviously a bug is always possible.
> --- linux/include/asm-i386/io.h~ Thu Nov 12 10:52:46 1998 > +++ linux/include/asm-i386/io.h Thu Nov 12 15:55:55 1998 > @@ -101,8 +101,8 @@ > #include <linux/vmalloc.h> > #include <asm/page.h> > > -#define __io_virt(x) ((void *)(PAGE_OFFSET | (unsigned long)(x))) > -#define __io_phys(x) ((unsigned long)(x) & ~PAGE_OFFSET) > +#define __io_virt(x) ((void *)(PAGE_OFFSET + (unsigned long)(x))) > +#define __io_phys(x) ((unsigned long)(x) - PAGE_OFFSET)
Only the __io_phys(x) macro should be involved in virt_to_bus(). The previous versions of the macros left result unchanged if they are called more than once, but your versions will break. So probably such a bug exists somewhere.
BTW, what was wrong with previous macro versions? (Sorry, if I just missed your initial posting. Will search it).
Regards, Gerard.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |