bus_dmamem_alloc confusion

看板DFBSD_kernel作者時間21年前 (2004/10/16 12:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/9 (看更多)
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. The driver is using bus_dmamem_alloc() to allocate the memory and bus_dmamap_load() to commit the region. The kva that comes back seems fine (ie the driver can use it to write the memory), but I'm wondering if the bus address is correct. For a 4096 byte allocation the kva and bus address (b) were (a is the alignment) 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
文章代碼(AID): #11SAH400 (DFBSD_kernel)
討論串 (同標題文章)
文章代碼(AID): #11SAH400 (DFBSD_kernel)