linux-mips
[Top] [All Lists]

virt_to_phys bug?

To: linux-mips@linux-mips.org
Subject: virt_to_phys bug?
From: Brian Pomerantz <bapper@piratehaven.org>
Date: Mon, 22 Sep 2003 15:55:41 -0700
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.4i
Maybe the wrong function is being used here, I'm not sure.  I ran into
a problem with using virt_to_phys.  The acacia driver for the IDT
rc32438 chip uses virt_to_phys to convert from a KSEG1 address to a
physical address.  Somehow this works on their 2.4.18 kernel but does
not in the 2.4.22 tree.  After changing virt_to_phys to this:

        return (unsigned long)address - KSEGX(address);

everything worked just fine.  I guess what I'm wondering is, is this
the correct way to get a physical address for use with DMA?  The note
in io.h above the function says no but fails to tell me what should be
used.  My guess is virt_to_bus is correct but they are identical
functions.  Since I didn't write this driver, I can only assume that
address for the rung descriptors are accessed via KSEG1 so that they
are uncached and don't require flushing after each access.  I had a
lot of dropped packets when I failed to access the ring descriptors
via KSEG1.


BAPper

<Prev in Thread] Current Thread [Next in Thread>
  • virt_to_phys bug?, Brian Pomerantz <=