Skip to contentSkip to conversation

DMA mapping and loadable modules

DISCUSSION Dan Malek 2 participants 2 messages Feb 8, 2001

lore
Share & tools
lore

Dan Malek

author
#0 lore raw

It's amazing how things like this happen.........Today, at least three different instances of this bug appeared, including one of my own.

There is a problem when loadable drivers with "static" data stuctures try to determine the physical address for DMA. The "virt_to_bus" macro doesn't work for these (or for any dynamically allocated memory). These drivers will work fine when compiled in, and break when loaded as modules.

As part of the IBM4xx and MPC8xx updates I have hanging around in my tree, I have modified the virt_to_bus and other macros to be a little smarter, and work the same on all platforms. Basically, if there isn't a BAT or other large mapping, it will search the page tables for the proper physical address. It still doesn't work exactly correct on the PMac, but I hope to have it done today.

	-- Dan

--

I like MMUs because I don't have a real life.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#1 lore raw

Hi,

Quoted 3 lines · Dan Malek

There is a problem when loadable drivers with "static" data stuctures try to determine the physical address for DMA. The "virt_to_bus" macro doesn't work for these (or for any dynamically allocated memory).

Sure, they can use get_free_page/kmalloc and it will work.

Quoted 2 lines

These drivers will work fine when compiled in, and break when loaded as modules.

The same problem exists on any architecture.

bye, Roman

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/