forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CMA: generalize CMA reserved area management functionality
Currently, there are two users on CMA functionality, one is the DMA subsystem and the other is the KVM on powerpc. They have their own code to manage CMA reserved area even if they looks really similar. From my guess, it is caused by some needs on bitmap management. KVM side wants to maintain bitmap not for 1 page, but for more size. Eventually it use bitmap where one bit represents 64 pages. When I implement CMA related patches, I should change those two places to apply my change and it seem to be painful to me. I want to change this situation and reduce future code management overhead through this patch. This change could also help developer who want to use CMA in their new feature development, since they can use CMA easily without copying & pasting this reserved area management code. In previous patches, we have prepared some features to generalize CMA reserved area management and now it's time to do it. This patch moves core functions to mm/cma.c and change DMA APIs to use these functions. There is no functional change in DMA APIs. Signed-off-by: Joonsoo Kim <[email protected]> Acked-by: Michal Nazarewicz <[email protected]> Acked-by: Zhang Yanfei <[email protected]> Acked-by: Minchan Kim <[email protected]> Reviewed-by: Aneesh Kumar K.V <[email protected]> Cc: Alexander Graf <[email protected]> Cc: Aneesh Kumar K.V <[email protected]> Cc: Gleb Natapov <[email protected]> Acked-by: Marek Szyprowski <[email protected]> Tested-by: Marek Szyprowski <[email protected]> Cc: Paolo Bonzini <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Paul Mackerras <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
- Loading branch information
1 parent
e0bdb37
commit a254129
Showing
8 changed files
with
383 additions
and
291 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef __CMA_H__ | ||
#define __CMA_H__ | ||
|
||
/* | ||
* There is always at least global CMA area and a few optional | ||
* areas configured in kernel .config. | ||
*/ | ||
#ifdef CONFIG_CMA_AREAS | ||
#define MAX_CMA_AREAS (1 + CONFIG_CMA_AREAS) | ||
|
||
#else | ||
#define MAX_CMA_AREAS (0) | ||
|
||
#endif | ||
|
||
struct cma; | ||
|
||
extern phys_addr_t cma_get_base(struct cma *cma); | ||
extern unsigned long cma_get_size(struct cma *cma); | ||
|
||
extern int __init cma_declare_contiguous(phys_addr_t size, | ||
phys_addr_t base, phys_addr_t limit, | ||
phys_addr_t alignment, unsigned int order_per_bit, | ||
struct cma **res_cma, bool fixed); | ||
extern struct page *cma_alloc(struct cma *cma, int count, unsigned int align); | ||
extern bool cma_release(struct cma *cma, struct page *pages, int count); | ||
#endif |
Oops, something went wrong.