From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
To: linux-arch@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, arc-linux-dev@synopsys.com,
Vineet Gupta <Vineet.Gupta1@synopsys.com>
Subject: [PATCH 03/19] ARC: cacheflush: No need to retain DC_CTRL from __before_dc_op()
Date: Sun, 7 Jun 2015 14:08:07 +0530 [thread overview]
Message-ID: <1433666303-26112-4-git-send-email-vgupta@synopsys.com> (raw)
In-Reply-To: <1433666303-26112-1-git-send-email-vgupta@synopsys.com>
That is because __after_dc_op() already reads it for status check, so it
is better anyways to use that "newer" value.
Also reduces the clutter in callers for passing from/to these routines.
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
---
arch/arc/mm/cache.c | 36 +++++++++++++++++-------------------
1 file changed, 17 insertions(+), 19 deletions(-)
diff --git a/arch/arc/mm/cache.c b/arch/arc/mm/cache.c
index 1d34a6978a83..7ff54d024b11 100644
--- a/arch/arc/mm/cache.c
+++ b/arch/arc/mm/cache.c
@@ -207,32 +207,32 @@ static inline void __cache_line_loop(unsigned long paddr, unsigned long vaddr,
* Machine specific helpers for Entire D-Cache or Per Line ops
*/
-static inline unsigned int __before_dc_op(const int op)
+static inline void __before_dc_op(const int op)
{
- unsigned int reg = reg;
-
if (op == OP_FLUSH_N_INV) {
/* Dcache provides 2 cmd: FLUSH or INV
* INV inturn has sub-modes: DISCARD or FLUSH-BEFORE
* flush-n-inv is achieved by INV cmd but with IM=1
* So toggle INV sub-mode depending on op request and default
*/
- reg = read_aux_reg(ARC_REG_DC_CTRL);
- write_aux_reg(ARC_REG_DC_CTRL, reg | DC_CTRL_INV_MODE_FLUSH)
+ write_aux_reg(ARC_REG_DC_CTRL,
+ read_aux_reg(ARC_REG_DC_CTRL) | DC_CTRL_INV_MODE_FLUSH)
;
}
-
- return reg;
}
-static inline void __after_dc_op(const int op, unsigned int reg)
+static inline void __after_dc_op(const int op)
{
- if (op & OP_FLUSH) /* flush / flush-n-inv both wait */
- while (read_aux_reg(ARC_REG_DC_CTRL) & DC_CTRL_FLUSH_STATUS);
+ if (op & OP_FLUSH) {
+ unsigned int reg;
- /* Switch back to default Invalidate mode */
- if (op == OP_FLUSH_N_INV)
- write_aux_reg(ARC_REG_DC_CTRL, reg & ~DC_CTRL_INV_MODE_FLUSH);
+ /* flush / flush-n-inv both wait */
+ while ((reg = read_aux_reg(ARC_REG_DC_CTRL)) & DC_CTRL_FLUSH_STATUS);
+
+ /* Switch back to default Invalidate mode */
+ if (op == OP_FLUSH_N_INV)
+ write_aux_reg(ARC_REG_DC_CTRL, reg & ~DC_CTRL_INV_MODE_FLUSH);
+ }
}
/*
@@ -243,10 +243,9 @@ static inline void __after_dc_op(const int op, unsigned int reg)
*/
static inline void __dc_entire_op(const int op)
{
- unsigned int ctrl_reg;
int aux;
- ctrl_reg = __before_dc_op(op);
+ __before_dc_op(op);
if (op & OP_INV) /* Inv or flush-n-inv use same cmd reg */
aux = ARC_REG_DC_IVDC;
@@ -255,7 +254,7 @@ static inline void __dc_entire_op(const int op)
write_aux_reg(aux, 0x1);
- __after_dc_op(op, ctrl_reg);
+ __after_dc_op(op);
}
/* For kernel mappings cache operation: index is same as paddr */
@@ -268,15 +267,14 @@ static inline void __dc_line_op(unsigned long paddr, unsigned long vaddr,
unsigned long sz, const int op)
{
unsigned long flags;
- unsigned int ctrl_reg;
local_irq_save(flags);
- ctrl_reg = __before_dc_op(op);
+ __before_dc_op(op);
__cache_line_loop(paddr, vaddr, sz, op);
- __after_dc_op(op, ctrl_reg);
+ __after_dc_op(op);
local_irq_restore(flags);
}
--
1.9.1
next prev parent reply other threads:[~2015-06-07 8:39 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-07 8:38 [PATCH 00/19] ARCv2 port to Linux - (A) prepratory patches Vineet Gupta
2015-06-07 8:38 ` [PATCH 01/19] ARC: mm/cache_arc700.c -> mm/cache.c Vineet Gupta
2015-06-07 8:38 ` [PATCH 02/19] ARC: cacheflush: move some code around, delete old comments Vineet Gupta
2015-06-07 8:38 ` Vineet Gupta [this message]
2015-06-07 8:38 ` [PATCH 04/19] ARC: untangle cache flush loop Vineet Gupta
2015-06-07 8:38 ` [PATCH 05/19] ARC: entry.S: common'ize scrtach reg freeup in intr + exceptions Vineet Gupta
2015-06-07 8:38 ` [PATCH 06/19] ARC: entry.S: Introduce INTERRUPT_{PROLOGUE,EPILOGUE} Vineet Gupta
2015-06-07 8:38 ` [PATCH 07/19] ARC: entry.S: canonical'ize EXCEPTION_{PROLOGUE,EPILOGUE} Vineet Gupta
2015-06-07 8:38 ` [PATCH 08/19] ARC: entry.S: confine EXCEPTION_* macros to one file Vineet Gupta
2015-06-07 8:38 ` [PATCH 09/19] ARC: entry.S: FAKE_RET_FROM_EXCPN can always use r9 Vineet Gupta
2015-06-07 8:38 ` [PATCH 10/19] ARC: entry.S: Trap handler to use r10 for syscall vs. brkpt decision Vineet Gupta
2015-06-07 8:38 ` [PATCH 11/19] ARC: entry.S: comments cleanup Vineet Gupta
2015-06-07 8:38 ` [PATCH 12/19] ARC: entry.S: Ensure that restore_regs is local to compilation unit Vineet Gupta
2015-06-07 8:38 ` [PATCH 13/19] ARC: entry.S: split into ARCompact ISA specific, common bits Vineet Gupta
2015-06-07 8:38 ` [PATCH 14/19] ARC: entry.S: move some code around for cache locality in return path Vineet Gupta
2015-06-07 8:38 ` [PATCH 15/19] ARC: entry.S: micro-optimize Trap handler Vineet Gupta
2015-06-07 8:38 ` Vineet Gupta
2015-06-07 8:38 ` [PATCH 16/19] ARC: entry.S: use single EXCEPTION_PROLOGUE Vineet Gupta
2015-06-07 8:38 ` Vineet Gupta
2015-06-07 8:38 ` [PATCH 17/19] ARC: entry.S: [arcompact] simplify SWITCH_TO_KERNEL_STK Vineet Gupta
2015-06-07 8:38 ` [PATCH 18/19] ARC: Make way for pt_regs != user_regs_struct Vineet Gupta
2015-06-07 8:38 ` Vineet Gupta
2015-06-07 8:38 ` [PATCH 19/19] ARC: intc: split into ARCompact ISA specific, common bits Vineet Gupta
2015-06-07 8:47 ` [PATCH 00/19] ARCv2 port to Linux - (A) prepratory patches Vineet Gupta
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=1433666303-26112-4-git-send-email-vgupta@synopsys.com \
--to=vineet.gupta1@synopsys.com \
--cc=arc-linux-dev@synopsys.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).