- 15 Apr, 2016 1 commit
-
-
Ming Lin authored
Now it's ready to move the mempool based SG chained allocator code from SCSI driver to lib/sg_pool.c, which will be compiled only based on a Kconfig symbol CONFIG_SG_POOL. SCSI selects CONFIG_SG_POOL. Reviewed-by:
Christoph Hellwig <hch@lst.de> Signed-off-by:
Ming Lin <ming.l@ssi.samsung.com> Reviewed-by:
Sagi Grimberg <sagi@grimberg.me> Signed-off-by:
Martin K. Petersen <martin.petersen@oracle.com>
-
- 24 Aug, 2015 1 commit
-
-
Robert Jarzmik authored
Sometimes a scatter-gather has to be split into several chunks, or sub scatter lists. This happens for example if a scatter list will be handled by multiple DMA channels, each one filling a part of it. A concrete example comes with the media V4L2 API, where the scatter list is allocated from userspace to hold an image, regardless of the knowledge of how many DMAs will fill it : - in a simple RGB565 case, one DMA will pump data from the camera ISP to memory - in the trickier YUV422 case, 3 DMAs will pump data from the camera ISP pipes, one for pipe Y, one for pipe U and one for pipe V For these cases, it is necessary to split the original scatter list into multiple scatter lists, which is the purpose of this patch. The guarantees that are required for this patch are : - the intersection of spans of any couple of resulting scatter lists is empty. - the union of spans of all resulting scatter lists is a subrange of the span of the original scatter list. - streaming DMA API operations (mapping, unmapping) should not happen both on both the resulting and the original scatter list. It's either the first or the later ones. - the caller is reponsible to call kfree() on the resulting scatterlists. Signed-off-by:
Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by:
Jens Axboe <axboe@fb.com>
-
- 17 Aug, 2015 1 commit
-
-
Christoph Hellwig authored
There are a couple of uses of struct scatterlist that never go to the dma_map_sg() helper and thus don't care about ARCH_HAS_SG_CHAIN which indicates that we can map chained S/G list. The most important one is the crypto code, which currently has to open code a few helpers to always allow chaining. This patch removes a few #ifdef ARCH_HAS_SG_CHAIN statements so that we can switch the crypto code to these common helpers. Signed-off-by:
Christoph Hellwig <hch@lst.de> Signed-off-by:
Jens Axboe <axboe@fb.com>
-
- 01 Jul, 2015 2 commits
-
-
Dave Gordon authored
do_device_access() takes a separate parameter to indicate the direction of data transfer, which it used to use to select the appropriate function out of sg_pcopy_{to,from}_buffer(). However these two functions now have So this patch makes it bypass these wrappers and call the underlying function sg_copy_buffer() directly; this has the same calling style as do_device_access() i.e. a separate direction-of-transfer parameter and no pointers-to-const, so skipping the wrappers not only eliminates the warning, it also make the code simpler :) [akpm@linux-foundation.org: fix very broken build] Signed-off-by:
Dave Gordon <david.s.gordon@intel.com> Acked-by:
Arnd Bergmann <arnd@arndb.de> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by:
Andrew Morton <akpm@linux-foundation.org> Signed-off-by:
Linus Torvalds <torvalds@linux-foundation.org>
-
Dave Gordon authored
The 'buf' parameter of sg(p)copy_from_buffer() can and should be const-qualified, although because of the shared implementation of _to_buffer() and _from_buffer(), we have to cast this away internally. This means that callers who have a 'const' buffer containing the data to be copied to the sg-list no longer have to cast away the const-ness themselves. It also enables improved coverage by code analysis tools. Signed-off-by:
Dave Gordon <david.s.gordon@intel.com> Cc: Akinobu Mita <akinobu.mita@gmail.com> Cc: "Martin K. Petersen" <martin.petersen@oracle.com> Signed-off-by:
Andrew Morton <akpm@linux-foundation.org> Signed-off-by:
Linus Torvalds <torvalds@linux-foundation.org>
-
- 03 Jun, 2015 1 commit
-
-
Tom Lendacky authored
When performing a dma_map_sg() call, the number of sg entries to map is required. Using sg_nents to retrieve the number of sg entries will return the total number of entries in the sg list up to the entry marked as the end. If there happen to be unused entries in the list, these will still be counted. Some dma_map_sg() implementations will not handle the unused entries correctly (lib/swiotlb.c) and execute a BUG_ON. The sg_nents_for_len() function will traverse the sg list and return the number of entries required to satisfy the supplied length argument. This can then be supplied to the dma_map_sg() call to successfully map the sg. Signed-off-by:
Tom Lendacky <thomas.lendacky@amd.com> Signed-off-by:
Herbert Xu <herbert@gondor.apana.org.au>
-
- 05 May, 2015 1 commit
-
-
Christoph Hellwig authored
We don't have any arch specific scatterlist now that parisc switched over to the generic one. Signed-off-by:
Christoph Hellwig <hch@lst.de> Signed-off-by:
Jens Axboe <axboe@fb.com>
-
- 08 Aug, 2014 1 commit
-
-
Laura Abbott authored
Rather than have architectures #define ARCH_HAS_SG_CHAIN in an architecture specific scatterlist.h, make it a proper Kconfig option and use that instead. At same time, remove the header files are are now mostly useless and just include asm-generic/scatterlist.h. [sfr@canb.auug.org.au: powerpc files now need asm/dma.h] Signed-off-by:
Laura Abbott <lauraa@codeaurora.org> Acked-by: Thomas Gleixner <tglx@linutronix.de> [x86] Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> [powerpc] Acked-by:
Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Russell King <linux@arm.linux.org.uk> Cc: Tony Luck <tony.luck@intel.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: "James E.J. Bottomley" <JBottomley@parallels.com> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by:
Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by:
Andrew Morton <akpm@linux-foundation.org> Signed-off-by:
Linus Torvalds <torvalds@linux-foundation.org>
-
- 25 Jul, 2014 1 commit
-
-
Christoph Hellwig authored
Blk-mq drivers usually preallocate their S/G list as part of the request, but if we want to support the very large S/G lists currently supported by the SCSI code that would tie up a lot of memory in the preallocated request pool. Add support to the scatterlist code so that it can initialize a S/G list that uses a preallocated first chunks and dynamically allocated additional chunks. That way the scsi-mq code can preallocate a first page worth of S/G entries as part of the request, and dynamically extend the S/G list when needed. Signed-off-by:
Christoph Hellwig <hch@lst.de> Reviewed-by:
Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by:
Hannes Reinecke <hare@suse.de> Reviewed-by:
Webb Scales <webbnh@hp.com> Acked-by:
Jens Axboe <axboe@kernel.dk> Tested-by:
Bart Van Assche <bvanassche@acm.org> Tested-by:
Robert Elliott <elliott@hp.com>
-
- 09 Dec, 2013 1 commit
-
-
Ming Lei authored
sg_copy_buffer() can't meet demand for some drrivers(such usb mass storage), so we have to use the sg_miter_* APIs to access sg buffer, then need export sg_miter_skip() for these drivers. The API is needed for converting to sg_miter_* APIs in USB storage driver for accessing sg buffer. Acked-by:
Andrew Morton <akpm@linux-foundation.org> Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Cc: Jens Axboe <axboe@kernel.dk> Signed-off-by:
Ming Lei <ming.lei@canonical.com> Reviewed-by:
Tejun Heo <tj@kernel.org> Signed-off-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
- 09 Jul, 2013 1 commit
-
-
Akinobu Mita authored
The only difference between sg_pcopy_{from,to}_buffer() and sg_copy_{from,to}_buffer() is an additional argument that specifies the number of bytes to skip the SG list before copying. Signed-off-by:
Akinobu Mita <akinobu.mita@gmail.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: "James E.J. Bottomley" <JBottomley@parallels.com> Cc: Douglas Gilbert <dgilbert@interlog.com> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: Horia Geanta <horia.geanta@freescale.com> Cc: Imre Deak <imre.deak@intel.com> Acked-by:
Tejun Heo <tj@kernel.org> Signed-off-by:
Andrew Morton <akpm@linux-foundation.org> Signed-off-by:
Linus Torvalds <torvalds@linux-foundation.org>
-
- 30 May, 2013 1 commit
-
-
Rusty Russell authored
Add a check behind CONFIG_DEBUG_SG to verify this. Signed-off-by:
Rusty Russell <rusty@rustcorp.com.au> Signed-off-by:
Jens Axboe <axboe@kernel.dk>
-
- 27 Mar, 2013 1 commit
-
-
Imre Deak authored
The i915 driver uses sg lists for memory without backing 'struct page' pages, similarly to other IO memory regions, setting only the DMA address for these. It does this, so that it can program the HW MMU tables in a uniform way both for sg lists with and without backing pages. Without a valid page pointer we can't call nth_page to get the current page in __sg_page_iter_next, so add a helper that relevant users can call separately. Also add a helper to get the DMA address of the current page (idea from Daniel). Convert all places in i915, to use the new API. Signed-off-by:
Imre Deak <imre.deak@intel.com> Reviewed-by:
Damien Lespiau <damien.lespiau@intel.com> Signed-off-by:
Daniel Vetter <daniel.vetter@ffwll.ch>
-
- 20 Mar, 2013 1 commit
-
-
Paolo Bonzini authored
This is useful in places that recycle the same scatterlist multiple times, and do not want to incur the cost of sg_init_table every time in hot paths. Acked-by:
Jens Axboe <axboe@kernel.dk> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com> Signed-off-by:
Rusty Russell <rusty@rustcorp.com.au>
-
- 28 Feb, 2013 2 commits
-
-
Imre Deak authored
For better code reuse use the newly added page iterator to iterate through the pages. The offset, length within the page is still calculated by the mapping iterator as well as the actual mapping. Idea from Tejun Heo. Signed-off-by:
Imre Deak <imre.deak@intel.com> Cc: Maxim Levitsky <maximlevitsky@gmail.com> Cc: Tejun Heo <tj@kernel.org> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: James Hogan <james.hogan@imgtec.com> Cc: Stephen Warren <swarren@wwwdotorg.org> Signed-off-by:
Andrew Morton <akpm@linux-foundation.org> Signed-off-by:
Linus Torvalds <torvalds@linux-foundation.org>
-
Imre Deak authored
Add an iterator to walk through a scatter list a page at a time starting at a specific page offset. As opposed to the mapping iterator this is meant to be small, performing well even in simple loops like collecting all pages on the scatterlist into an array or setting up an iommu table based on the pages' DMA address. Signed-off-by:
Imre Deak <imre.deak@intel.com> Cc: Maxim Levitsky <maximlevitsky@gmail.com> Cc: Tejun Heo <tj@kernel.org> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Tested-by:
Stephen Warren <swarren@wwwdotorg.org> Signed-off-by:
Andrew Morton <akpm@linux-foundation.org> Signed-off-by:
Linus Torvalds <torvalds@linux-foundation.org>
-
- 27 Sep, 2012 1 commit
-
-
Maxim Levitsky authored
Useful helper to know the number of entries in scatterlist. Signed-off-by:
Maxim Levitsky <maximlevitsky@gmail.com> Cc: Alex Dubov <oakad@yahoo.com> Acked-by:
Tejun Heo <tj@kernel.org> Cc: Jens Axboe <axboe@kernel.dk> Signed-off-by:
Jens Axboe <axboe@kernel.dk>
-
- 30 Jul, 2012 1 commit
-
-
Tomasz Stanislawski authored
This patch adds a new constructor for an sg table. The table is constructed from an array of struct pages. All contiguous chunks of the pages are merged into a single sg nodes. A user may provide an offset and a size of a buffer if the buffer is not page-aligned. The function is dedicated for DMABUF exporters which often perform conversion from an page array to a scatterlist. Moreover the scatterlist should be squashed in order to save memory and to speed-up the process of DMA mapping using dma_map_sg. The code is based on the patch 'v4l: vb2-dma-contig: add support for scatterlist in userptr mode' and hints from Laurent Pinchart. Signed-off-by:
Tomasz Stanislawski <t.stanislaws@samsung.com> Signed-off-by:
Kyungmin Park <kyungmin.park@samsung.com> Acked-by:
Daniel Vetter <daniel.vetter@ffwll.ch> Acked-by:
Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by:
Marek Szyprowski <m.szyprowski@samsung.com> CC: Andrew Morton <akpm@linux-foundation.org>
-
- 04 Mar, 2012 1 commit
-
-
Paul Gortmaker authored
If a header file is making use of BUG, BUG_ON, BUILD_BUG_ON, or any other BUG variant in a static inline (i.e. not in a #define) then that header really should be including <linux/bug.h> and not just expecting it to be implicitly present. We can make this change risk-free, since if the files using these headers didn't have exposure to linux/bug.h already, they would have been causing compile failures/warnings. Signed-off-by:
Paul Gortmaker <paul.gortmaker@windriver.com>
-
- 31 Jul, 2009 1 commit
-
-
Sebastian Andrzej Siewior authored
sg_miter_start() is currently unaware of the direction of the copy process (to or from the scatter list). It is important to know the direction because the page has to be flushed in case the data written is seen on a different mapping in user land on cache incoherent architectures. Signed-off-by:
Sebastian Andrzej Siewior <sebastian@breakpoint.cc> Acked-by:
FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Acked-by:
Tejun Heo <tj@kernel.org> Signed-off-by:
Pierre Ossman <pierre@ossman.eu>
-
- 23 Jul, 2008 1 commit
-
-
Tejun Heo authored
This is alternative implementation of sg content iterator introduced by commit 83e7d317... from Pierre Ossman in next-20080716. As there's already an sg iterator which iterates over sg entries themselves, name this sg_mapping_iterator. Slightly edited description from the original implementation follows. Iteration over a sg list is not that trivial when you take into account that memory pages might have to be mapped before being used. Unfortunately, that means that some parts of the kernel restrict themselves to directly accesible memory just to not have to deal with the mess. This patch adds a simple iterator system that allows any code to easily traverse an sg list and not have to deal with all the details. The user can decide to consume part of the iteration. Also, iteration can be stopped and resumed later if releasing the kmap between iteration steps is necessary. These features are useful to implement piecemeal sg copying for interrupt drive PIO for example. Signed-off-by:
Tejun Heo <tj@kernel.org> Signed-off-by:
Pierre Ossman <drzeus@drzeus.cx>
-
- 07 Apr, 2008 1 commit
-
-
FUJITA Tomonori authored
This patch adds new three helper functions to copy data between an SG list and a linear buffer. - sg_copy_from_buffer copies data from linear buffer to an SG list - sg_copy_to_buffer copies data from an SG list to a linear buffer When the APIs copy data from a linear buffer to an SG list, flush_kernel_dcache_page is called. It's not necessary for everyone but it's a no-op on most architectures and in general the API is not used in performance critical path. Signed-off-by:
FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Acked-by:
Jens Axboe <jens.axboe@oracle.com> Signed-off-by:
James Bottomley <James.Bottomley@HansenPartnership.com>
-
- 28 Jan, 2008 2 commits
-
-
James Bottomley authored
SCSI sg table allocation has a maximum size (of SCSI_MAX_SG_SEGMENTS, currently 128) and this will cause a BUG_ON() in SCSI if something tries an allocation over it. This patch adds a size limit to the chaining allocator to allow the specification of the maximum allocation size for chaining, so we always chain in units of the maximum SCSI allocation size. Signed-off-by:
James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by:
Jens Axboe <jens.axboe@oracle.com>
-
Jens Axboe authored
Manually doing chained sg lists is not trivial, so add some helpers to make sure that drivers get it right. Signed-off-by:
Jens Axboe <jens.axboe@oracle.com>
-
- 11 Jan, 2008 1 commit
-
-
Rusty Russell authored
I realize that sg chaining is a ploy to make the rest of the kernel devs feel the pain of the SCSI subsystem. But this was a little unsubtle. Signed-off-by:
Rusty Russell <rusty@rustcorp.com.au> Acked-by:
Tejun Heo <htejun@gmail.com> Signed-off-by:
Jens Axboe <jens.axboe@oracle.com>
-
- 27 Nov, 2007 1 commit
-
-
Tejun Heo authored
Add more safeguards to protect against misinterpreting a chain entry as a normal scatterlist and vice-versa. * Make sure the entry isn't a chain when assigning and reading a normal sg. * Clear offset and length when chaining. Signed-off-by:
Tejun Heo <htejun@gmail.com> Signed-off-by:
Jens Axboe <jens.axboe@oracle.com>
-
- 02 Nov, 2007 2 commits
-
-
Jens Axboe authored
sg_mark_end() overwrites the page_link information, but all users want __sg_mark_end() behaviour where we just set the end bit. That is the most natural way to use the sg list, since you'll fill it in and then mark the end point. So change sg_mark_end() to only set the termination bit. Add a sg_magic debug check as well, and clear a chain pointer if it is set. Signed-off-by:
Jens Axboe <jens.axboe@oracle.com>
-
Jens Axboe authored
Don't open code sg_init_one(), make it reuse sg_init_table(). Signed-off-by:
Jens Axboe <jens.axboe@oracle.com>
-
- 29 Oct, 2007 3 commits
-
-
Chuck Lever authored
Clean up: fix a mixed sign comparison in sg_init_table() accidentally introduced by commit d6ec0842. The sign of the loop index variable should match the sign of the "nents" argument. Signed-off-by:
Chuck Lever <chuck.lever@oracle.com> Cc: Jens Axboe <jens.axboe@oracle.com> Signed-off-by:
Jens Axboe <axboe@carl.home.kernel.dk>
-
Chuck Lever authored
Clean up: fix a mixed sign comparison in sg_last() accidentally introduced by commit 70eb8040. The sign of the loop index variable should match the sign of the "nents" argument. Signed-off-by:
Chuck Lever <chuck.lever@oracle.com> Signed-off-by:
Jens Axboe <axboe@carl.home.kernel.dk>
-
Jens Axboe authored
Since we are using the last entry in the list, clear any possible termination bit that may have already been set. Pointed out by Rusty. Signed-off-by:
Jens Axboe <jens.axboe@oracle.com>
-
- 25 Oct, 2007 1 commit
-
-
Hugh Dickins authored
x86_32 CONFIG_HIGHMEM64G with 5GB RAM hung when booting, after issuing some "request_module: runaway loop modprobe binfmt-0000" messages in trying to exec /sbin/init. The binprm buf doesn't see the right ".ELF" header because sg_phys() is providing the wrong physical addresses for high pages: a 32-bit unsigned long is too small in this case, we need to use dma_addr_t. Signed-off-by:
Hugh Dickins <hugh@veritas.com> Signed-off-by:
Jens Axboe <jens.axboe@oracle.com>
-
- 24 Oct, 2007 1 commit
-
-
Jens Axboe authored
Most drivers need to set length and offset as well, so may as well fold those three lines into one. Add sg_assign_page() for those two locations that only needed to set the page, where the offset/length is set outside of the function context. Signed-off-by:
Jens Axboe <jens.axboe@oracle.com>
-
- 23 Oct, 2007 1 commit
-
-
Jens Axboe authored
Suggested by Boaz Harrosh <bharrosh@panasas.com> Signed-off-by:
Jens Axboe <jens.axboe@oracle.com>
-
- 22 Oct, 2007 3 commits
-
-
Jens Axboe authored
Add a Kconfig entry which will toggle some sanity checks on the sg entry and tables. Signed-off-by:
Jens Axboe <jens.axboe@oracle.com>
-
Jens Axboe authored
Change the page member of the scatterlist structure to be an unsigned long, and encode more stuff in the lower bits: - Bits 0 and 1 zero: this is a normal sg entry. Next sg entry is located at sg + 1. - Bit 0 set: this is a chain entry, the next real entry is at ->page_link with the two low bits masked off. - Bit 1 set: this is the final entry in the sg entry. sg_next() will return NULL when passed such an entry. It's thus important that sg table users use the proper accessors to get and set the page member. Signed-off-by:
Jens Axboe <jens.axboe@oracle.com>
-
Jens Axboe authored
We can then transition drivers without changing the generated code. Signed-off-by:
Jens Axboe <jens.axboe@oracle.com>
-
- 16 Oct, 2007 2 commits
-
-
Jens Axboe authored
The core of the patch - allow the last sg element in a scatterlist table to point to the start of a new table. We overload the LSB of the page pointer to indicate whether this is a valid sg entry, or merely a link to the next list. Includes a fix from Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> correcting the ifdef ARCH_HAS_SG_CHAIN guarding sg_last(). Signed-off-by:
Jens Axboe <jens.axboe@oracle.com>
-
Jens Axboe authored
First step to being able to change the scatterlist setup without having to modify drivers (a lot :-) Signed-off-by:
Jens Axboe <jens.axboe@oracle.com>
-
- 21 Sep, 2006 1 commit
-
-
Herbert Xu authored
This patch adds a const modifier to the buf argument of sg_set_buf and sg_init_one. This lets people call it with pointers that are const. Signed-off-by:
Herbert Xu <herbert@gondor.apana.org.au>
-