bus_dmamem_alloc confusion

Matthew Dillon dillon at apollo.backplane.com
Fri Oct 15 23:30:59 PDT 2004

:More weirdness in bus_dma land. The driver I'm working on (**** not in
:the tree, but available if interested ****) allocates bus memory
:according to a user space request and passes back a physical address.
:The app in user space then does a mmap on the address to get a virtual
:address that it can use. This has worked on both NetBSD and FreeBSD
:but the user space mmap is failing on DFly.
:Mem:  k=0xcc68f000 b=0x3c50000 a=0x1000
:and for an 8096 byte allocation, the addresses come back
:Mem:  k=0xcc6b4000 b=0x14000 a=0x2000
:The user space app can't mmap either bus address. I could be way
:wrong, but the second bus address looks suspicious to me.  This second
:allocation goes through a different path in bus_dmamem_alloc() and
:calls contigmalloc() instead of malloc() as would happen if the
:request size <= PAGE_SIZE.
:I steped through some of contigmalloc and saw the code checking the
:request against bus addresses much lower than the 0x14000 (e.g.
:0x2000) which makes me wonder about the bus addresses. Any suggestions
:of what might be going on or what I should be looking at more closely?
:---chuck (a newbie to the vm code)
:Chuck Tuffli
:Agilent Technologies

    Well, it's hard to say without more information.  I have no idea what
    you are using to generate that output, for example, but I would suggest
    writing some code in bus_dmamem_alloc() itself to print information on
    the arguments it passes to contigmalloc as well as information (both
    virtual and physical) about the results.  contigmalloc should not be
    allocating physical addresses below the ~1 MB mark or so.

					Matthew Dillon 
					<dillon at xxxxxxxxxxxxx>

More information about the Kernel mailing list