Date: Wed, 4 Feb 2009 09:00:23 -0500 From: John Baldwin <jhb@freebsd.org> To: freebsd-hackers@freebsd.org Cc: Alexej Sokolov <bsd.quest@googlemail.com>, Garrett Cooper <yanefbsd@gmail.com> Subject: Re: bus_dma (9). What exactly means "Loading of memory allocation" ? Message-ID: <200902040900.24320.jhb@freebsd.org> In-Reply-To: <671bb5fc0902020823p3ee8d9edl715a074603ab97de@mail.gmail.com> References: <6699015.16785.1233539817447.JavaMail.root@vms063.mailsrvcs.net> <7d6fde3d0902020046o7640f217ye88336b53920a538@mail.gmail.com> <671bb5fc0902020823p3ee8d9edl715a074603ab97de@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Monday 02 February 2009 11:23:33 am Alexej Sokolov wrote: > Hi, > thanx for your answer. I checked the source code of the *dma() functions. > If I understand it correctly, "loading of memory allocation" means the > following: > > 1. At first memory allocation should be done: bufp = *alloc(sizeof ....) > 2. then in ... _bus_dmamap_load_buffer() we get physical addres of allocated > buffer: > if (pmap) > curaddr = pmap_extract(pmap, vaddr); > else > curaddr = pmap_kextract(vaddr); > > ... then some "magic" with bouncing > > 3. then physical address will passed to dmat->segments > segs[seg].ds_addr = curaddr; > segs[seg].ds_len = sgsize; > > Ok, it all means: getting of physical address of allocated buffer. If > physical space not accessble for device, allocating bounce buffers. Getting > of physical addresses of allocated buffers. And then put these physical > addresses and sizes of buffers in dmat->segments array. <- loading of > memory allocation (-: Yes. On architectures with an IOMMU, the load may also program entries into the IOMMU for the specified buffer and then populate the S/G array with the associated DMA addresses (sparc64 uses this). I think the "load" name has more to do with this case in that you are "loading" a buffer into the DMA virtual address space (with IOMMUs you have a separate virtual address space for DMA that is not 1:1 with physical addresses as on i386 machines). If you look at bus_dma as basically implementing an abstract IOMMU on all architectures then it might make a bit more sense. -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200902040900.24320.jhb>