[cdi-devel] [RFC] Getting the physical address of a virtual buffer

Max Reitz ·

Hi,

This is just a small proposal which shouldn't be taken too serious (I 
won't provide a patch here before you don't acknowledge). ;-)

There is actually some hardware which has no problem at all using 
unaligned buffers, for example the USB host controllers when it's about 
specifying the transmit buffer. It would be a pity if one had to 
allocate a new memory area and to copy the contents of a virtual buffer 
into the newly allocated one just for having a physical address, thus I 
propose introducing some kind of function which translates a virtual 
address into a physical one (yes, those hardware is also capable of 
handling physically incontinuous memory areas).

I know the current approach would be to use one CDI memory area all over 
in the driver layers (as far as possible) but in that way you couldn't 
use buffers which are located on the stack, for example.


Thus, I think it would be nice to have such a function (which shouldn't 
be too hard to implement, if it's about that).

Well, what do you think about it?


Greetings,

Max