DMA memory

Nathan Glasser neg at brooktrout.com
Sat Mar 26 09:50:14 EST 2005


Hello,

It was suggested that I send a message to this mailing list to attempt
to get help with a problem I'm seeing.

I'm using ppc64 (p630), kernel 2.4.x (RH 3.0 patch x).
I'm working on a proprietary driver for a proprietary device.

The device needs to access some host memory in order to perform
a DMA transfer. It can only access 32-bits.

I'm allocating memory using pci_alloc_consistent. I'm passing
the "dma handle" to the device in the place where the bus address
would usually go (I formerly used virt_to_bus for x86).

It seems that after the device performs the DMA, any further
access to MMIO board registers results in a system crash (such accesses
work fine prior to the device DMA). Here is the panic message on the
serial console.

RTAS: 2 --------- RTAS event begin
RTAS 0: 00000000 00000000
RTAS: 2 --------- RTAS event end
Kernel panic: EEH: MMIO failure (2) on device:pci12e4,1000 /pci at 400000000111/pci at 2,6/pci12e4,1000 at 1

It was suggested to me that the DMA was to a bad address, and that this
caused the device to be isolated. I didn't know the system could do that,
but it makes sense to me.

The amount allocated is PAGE_SIZE. The DMA size is normally 1K. The transfer
start address can be at any multiple of 1K within the PAGE_SIZE-sized
region.

I did this 4 times, and got these addresses.

cpu_addr:       C0000001E0801000
dma handle:     40000000
cpu_addr:       C0000001E0800000
dma handle:     40001000
cpu_addr:       C0000001DB25F000
dma handle:     40002000
cpu_addr:       C0000001DB25E000
dma handle:     40003000

Assuming you trust that these dma handle values are properly being sent to the
device, does anyone have any suggestions for what I'm doing wrong? Is there
some further translation I need to do of the dma handle before passing it to
the device? Other drivers I looked at didn't seem to.

                                Thanks,
                                Nathan




More information about the Linuxppc64-dev mailing list