From: Kwangwoo Lee <kwangwoo.lee@sk.com>
To: Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
linux-arm-kernel@lists.infradead.org
Cc: Kwangwoo Lee <kwangwoo.lee@sk.com>,
Woosuk Chung <woosuk.chung@sk.com>,
Hyunchul Kim <hyunchul3.kim@sk.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH RFC] arm64: mm: convert __dma_* routines to use start, size
Date: Mon, 25 Jul 2016 16:40:06 +0900 [thread overview]
Message-ID: <1469432406-27548-1-git-send-email-kwangwoo.lee@sk.com> (raw)
__dma_* routines have been converted to use start and size instread of
start and end addresses. The patch was origianlly for adding
__clean_dcache_area_poc() which will be used in pmem driver to clean
dcache to the PoC(Point of Coherency) in arch_wb_cache_pmem().
The functionality of __clean_dcache_area_poc() was equivalent to
__dma_clean_range(). The difference was __dma_clean_range() uses the end
address, but __clean_dcache_area_poc() uses the size to clean.
Thus, __clean_dcache_area_poc() has been revised with a fall through
function of __dma_clean_range() after the change that __dma_* routines
use start and size instead of using start and end.
Signed-off-by: Kwangwoo Lee <kwangwoo.lee@sk.com>
---
arch/arm64/include/asm/cacheflush.h | 1 +
arch/arm64/mm/cache.S | 53 +++++++++++++++++++------------------
2 files changed, 28 insertions(+), 26 deletions(-)
diff --git a/arch/arm64/include/asm/cacheflush.h b/arch/arm64/include/asm/cacheflush.h
index c64268d..02b3039 100644
--- a/arch/arm64/include/asm/cacheflush.h
+++ b/arch/arm64/include/asm/cacheflush.h
@@ -68,6 +68,7 @@
extern void flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned long end);
extern void flush_icache_range(unsigned long start, unsigned long end);
extern void __flush_dcache_area(void *addr, size_t len);
+extern void __clean_dcache_area_poc(void *addr, size_t len);
extern void __clean_dcache_area_pou(void *addr, size_t len);
extern long __flush_cache_user_range(unsigned long start, unsigned long end);
diff --git a/arch/arm64/mm/cache.S b/arch/arm64/mm/cache.S
index 50ff9ba..622a854 100644
--- a/arch/arm64/mm/cache.S
+++ b/arch/arm64/mm/cache.S
@@ -110,14 +110,16 @@ ENDPROC(__clean_dcache_area_pou)
* - end - end address of region
*/
ENTRY(__inval_cache_range)
+ sub x1, x1, x0
/* FALLTHROUGH */
/*
- * __dma_inv_range(start, end)
+ * __dma_inv_range(start, size)
* - start - virtual start address of region
- * - end - virtual end address of region
+ * - size - size in question
*/
__dma_inv_range:
+ add x1, x1, x0
dcache_line_size x2, x3
sub x3, x2, #1
tst x1, x3 // end cache line aligned?
@@ -139,41 +141,42 @@ ENDPIPROC(__inval_cache_range)
ENDPROC(__dma_inv_range)
/*
- * __dma_clean_range(start, end)
+ * __clean_dcache_area_poc(kaddr, size)
+ *
+ * Ensure that any D-cache lines for the interval [kaddr, kaddr+size)
+ * are cleaned to the PoC.
+ *
+ * - kaddr - kernel address
+ * - size - size in question
+ */
+ENTRY(__clean_dcache_area_poc)
+ /* FALLTHROUGH */
+
+/*
+ * __dma_clean_range(start, size)
* - start - virtual start address of region
- * - end - virtual end address of region
+ * - size - size in question
*/
__dma_clean_range:
- dcache_line_size x2, x3
- sub x3, x2, #1
- bic x0, x0, x3
-1:
alternative_if_not ARM64_WORKAROUND_CLEAN_CACHE
- dc cvac, x0
+ dcache_by_line_op cvac, sy, x0, x1, x2, x3
alternative_else
- dc civac, x0
+ dcache_by_line_op civac, sy, x0, x1, x2, x3
alternative_endif
- add x0, x0, x2
- cmp x0, x1
- b.lo 1b
- dsb sy
ret
+ENDPIPROC(__clean_dcache_area_poc)
ENDPROC(__dma_clean_range)
/*
- * __dma_flush_range(start, end)
+ * __dma_flush_range(start, size)
+ *
+ * clean & invalidate D / U line
+ *
* - start - virtual start address of region
- * - end - virtual end address of region
+ * - size - size in question
*/
ENTRY(__dma_flush_range)
- dcache_line_size x2, x3
- sub x3, x2, #1
- bic x0, x0, x3
-1: dc civac, x0 // clean & invalidate D / U line
- add x0, x0, x2
- cmp x0, x1
- b.lo 1b
- dsb sy
+ dcache_by_line_op civac, sy, x0, x1, x2, x3
ret
ENDPIPROC(__dma_flush_range)
@@ -184,7 +187,6 @@ ENDPIPROC(__dma_flush_range)
* - dir - DMA direction
*/
ENTRY(__dma_map_area)
- add x1, x1, x0
cmp w2, #DMA_FROM_DEVICE
b.eq __dma_inv_range
b __dma_clean_range
@@ -197,7 +199,6 @@ ENDPIPROC(__dma_map_area)
* - dir - DMA direction
*/
ENTRY(__dma_unmap_area)
- add x1, x1, x0
cmp w2, #DMA_TO_DEVICE
b.ne __dma_inv_range
ret
--
2.5.0
next reply other threads:[~2016-07-25 7:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-25 7:40 Kwangwoo Lee [this message]
2016-07-25 9:28 ` Russell King - ARM Linux
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1469432406-27548-1-git-send-email-kwangwoo.lee@sk.com \
--to=kwangwoo.lee@sk.com \
--cc=catalin.marinas@arm.com \
--cc=hyunchul3.kim@sk.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=will.deacon@arm.com \
--cc=woosuk.chung@sk.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®