Re: PATCH: fix bogus error message bus_dmamem_alloc failed to align memory properly

2010-09-29 Thread John Baldwin
...@freebsd.org wrote: On Friday, September 24, 2010 9:00:44 pm Neel Natu wrote: Hi, This patch fixes the bogus error message from bus_dmamem_alloc() about the buffer not being aligned properly. The problem is that the check is against a virtual address as opposed

Re: PATCH: fix bogus error message bus_dmamem_alloc failed to align memory properly

2010-09-28 Thread John Baldwin
bus_dmamem_alloc() about the buffer not being aligned properly. The problem is that the check is against a virtual address as opposed to the physical address. contigmalloc() makes guarantees about the alignment of physical addresses but not the virtual address mapping it. Any objections if I

Re: PATCH: fix bogus error message bus_dmamem_alloc failed to align memory properly

2010-09-28 Thread Neel Natu
Natu wrote: Hi, This patch fixes the bogus error message from bus_dmamem_alloc() about the buffer not being aligned properly. The problem is that the check is against a virtual address as opposed to the physical address. contigmalloc() makes guarantees about the alignment of physical

Re: PATCH: fix bogus error message bus_dmamem_alloc failed to align memory properly

2010-09-27 Thread John Baldwin
On Friday, September 24, 2010 9:00:44 pm Neel Natu wrote: Hi, This patch fixes the bogus error message from bus_dmamem_alloc() about the buffer not being aligned properly. The problem is that the check is against a virtual address as opposed to the physical address. contigmalloc() makes

Re: PATCH: fix bogus error message bus_dmamem_alloc failed to align memory properly

2010-09-27 Thread Neel Natu
Hi John, Thanks for reviewing this. On Mon, Sep 27, 2010 at 8:04 AM, John Baldwin j...@freebsd.org wrote: On Friday, September 24, 2010 9:00:44 pm Neel Natu wrote: Hi, This patch fixes the bogus error message from bus_dmamem_alloc() about the buffer not being aligned properly. The problem

PATCH: fix bogus error message bus_dmamem_alloc failed to align memory properly

2010-09-24 Thread Neel Natu
Hi, This patch fixes the bogus error message from bus_dmamem_alloc() about the buffer not being aligned properly. The problem is that the check is against a virtual address as opposed to the physical address. contigmalloc() makes guarantees about the alignment of physical addresses

multi-seg bus_dmamem_alloc?

2009-10-21 Thread Jason Harmening
Hi everyone, It seems like there are starting to be some drivers that need to allocate large chunks of DMA-able memory, and since bus_dmamem_alloc() on most architectures is always physically contiguous, it may not work for them. It seems like we could use the new sglist routines to help us here

bus_dmamem_alloc() and BUS_DMA_WAITOK

2009-02-13 Thread Patrick Lamaizière
Hello, I would like to know if it is safe to use the BUS_DMA_WAITOK flag with bus_dmamem_alloc(), in the context of the device_attach routine? Many drivers use BUS_DMA_NOWAIT. I need a 32Ko buffer and on low memory my driver cannot attach (bus_dmamem_alloc returns ENOMEM). Will BUS_DMA_WAITOK

Re: bus_dmamem_alloc() and BUS_DMA_WAITOK

2009-02-13 Thread John Baldwin
On Friday 13 February 2009 9:22:05 am Patrick Lamaizière wrote: Hello, I would like to know if it is safe to use the BUS_DMA_WAITOK flag with bus_dmamem_alloc(), in the context of the device_attach routine? Many drivers use BUS_DMA_NOWAIT. Yes, it is ok to use in an attach routine. I need

Re: bus_dmamem_alloc

2008-06-11 Thread John-Mark Gurney
haven't worked on it in a long time.. Of course the driver uses busdma to be as machine-independent as possible. One problem I've encountered is that bus_dmamem_alloc is inadequate for my needs. The CX2388x only understands 32-bit physical addreses, and the driver This restriction is set

Re: bus_dmamem_alloc

2008-06-11 Thread Jason Harmening
often the case with just MPEG TS, but once you add analog video there's usually not enough room. For case 1), I malloc(9) the buffers and then feed them to busdma, since on most machines bus_dmamem_alloc just calls contigmalloc. Use of malloc(9) is suboptimal as it may result in bounce

bus_dmamem_alloc

2008-06-07 Thread Jason Harmening
Hello, I've written a FreeBSD driver for Conexant CX2388x-based PCI TV capture cards. Of course the driver uses busdma to be as machine-independent as possible. One problem I've encountered is that bus_dmamem_alloc is inadequate for my needs. The CX2388x only understands 32-bit physical

bus_dmamem_alloc strangeness

2005-02-17 Thread Gerald Heinig
Hi hackers, I've come across weird behaviour in bus_dmamem_alloc() whilst trying to allocate small memory blocks (less than PAGE_SIZE) which have to be aligned to PAGE_SIZE. My segment size is 2048, my maximum number of segments is 1 (it MUST be contiguous), my max. total segment size is also

Re: bus_dmamem_alloc strangeness

2005-02-17 Thread Mike Silbersack
On Thu, 17 Feb 2005, Gerald Heinig wrote: Hi hackers, I've come across weird behaviour in bus_dmamem_alloc() whilst trying to allocate small memory blocks (less than PAGE_SIZE) which have to be aligned to PAGE_SIZE. My segment size is 2048, my maximum number of segments is 1 (it MUST

Re: bus_dmamem_alloc strangeness

2005-02-17 Thread Harti Brandt
On Thu, 17 Feb 2005, Gerald Heinig wrote: GHHi hackers, GH GHI've come across weird behaviour in bus_dmamem_alloc() whilst trying to GHallocate small memory blocks (less than PAGE_SIZE) which have to be GHaligned to PAGE_SIZE. GHMy segment size is 2048, my maximum number of segments is 1 (it MUST

Re: bus_dmamem_alloc failing

2002-11-16 Thread Gary Thorpe
the 16 page chunk making it unable to reallocatable by you, so the next bus_dmamem_alloc() looks for the next 16 page contiguous chunk. This continues until there is no more 16 page contiguous chunks available and the bus_dmamem_alloc() fails. FreeBSD does not have a physical memory

Re: bus_dmamem_alloc failing

2002-11-16 Thread Terry Lambert
Gary Thorpe wrote: Really, there's a lot of the kernel which could be pageable, which would help this. But for this to work, all the code in the paging path has to be marked non-pageable. The way Windows handles this is to have seperate ELF sections for pageable vs. unpageable vs.

bus_dmamem_alloc failing

2002-11-15 Thread Chuck Tuffli
I'm writting a PCI device driver that needs to allocate large aligned chunks of DMA memory for the hardware's queues. After loading and unloading the driver a number of times, bus_dmamem_alloc starts to fail. In the device attach, the allocation code looks like (error checking removed for brevity

Re: bus_dmamem_alloc failing

2002-11-15 Thread mark tinguely
since the allocated space is larger that a physical page (65536 4096), bus_dmamem_alloc() allocates physical contiguous memory. After repeated allocations and frees, the physical memory pages will fragment and the allocation will fail. You may need to rethink your allocation strategy

Re: bus_dmamem_alloc failing

2002-11-15 Thread Chuck Tuffli
On Fri, Nov 15, 2002 at 10:36:18AM -0600, mark tinguely wrote: since the allocated space is larger that a physical page (65536 4096), bus_dmamem_alloc() allocates physical contiguous memory. After repeated allocations and frees, the physical memory pages will fragment and the allocation

Re: bus_dmamem_alloc failing

2002-11-15 Thread mark tinguely
On Fri, Nov 15, 2002 at 10:36:18AM -0600, mark tinguely wrote: since the allocated space is larger that a physical page (65536 4096), bus_dmamem_alloc() allocates physical contiguous memory. After repeated allocations and frees, the physical memory pages will fragment

Re: bus_dmamem_alloc failing

2002-11-15 Thread Chuck Tuffli
bus_dmamem_alloc() looks for the next 16 page contiguous chunk. This continues until there is no more 16 page contiguous chunks available and the bus_dmamem_alloc() fails. FreeBSD does not have a physical memory defragmenter. Ok, I get it now. Thanks to all for the explanation. Would a physical

Re: bus_dmamem_alloc failing

2002-11-15 Thread Terry Lambert
by you, so the next bus_dmamem_alloc() looks for the next 16 page contiguous chunk. This continues until there is no more 16 page contiguous chunks available and the bus_dmamem_alloc() fails. FreeBSD does not have a physical memory defragmenter. Ok, I get it now. Thanks to all