From: Eugeniy Paltsev <eugeniy.paltsev@synopsys.com>
To: linux-snps-arc@lists.infradead.org,
Vineet Gupta <vineet.gupta1@synopsys.com>
Cc: linux-kernel@vger.kernel.org,
Alexey Brodkin <alexey.brodkin@synopsys.com>,
Eugeniy Paltsev <eugeniy.paltsev@synopsys.com>
Subject: [PATCH 1/3] ARC: cache: declare cache-related defines via ARC_MAX_CACHE_SHIFT
Date: Tue, 16 Apr 2019 20:10:19 +0300 [thread overview]
Message-ID: <20190416171021.20049-2-Eugeniy.Paltsev@synopsys.com> (raw)
In-Reply-To: <20190416171021.20049-1-Eugeniy.Paltsev@synopsys.com>
* Declare all cache-related defines where we need maximum cache
line size (like SMP_CACHE_BYTES, ARCH_DMA_MINALIGN, etc...) via
one common ARC_MAX_CACHE_SHIFT define.
* Move all cache-related defines outside '#ifdef __ASSEMBLY__'
guard to make them visible from ASM code.
This is prerequisite for autodetecting cache line size in runtime.
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
---
arch/arc/include/asm/cache.h | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/arch/arc/include/asm/cache.h b/arch/arc/include/asm/cache.h
index 2ad77fb43639..f1642634aab0 100644
--- a/arch/arc/include/asm/cache.h
+++ b/arch/arc/include/asm/cache.h
@@ -9,6 +9,12 @@
#ifndef __ARC_ASM_CACHE_H
#define __ARC_ASM_CACHE_H
+/* Largest line length for either L1 or L2 is 128 bytes (2^7) */
+#define ARC_MAX_CACHE_SHIFT 7
+#define ARC_MAX_CACHE_BYTES (1 << (ARC_MAX_CACHE_SHIFT))
+#define SMP_CACHE_BYTES ARC_MAX_CACHE_BYTES
+#define ARCH_DMA_MINALIGN ARC_MAX_CACHE_BYTES
+
/* In case $$ not config, setup a dummy number for rest of kernel */
#ifndef CONFIG_ARC_CACHE_LINE_SHIFT
#define L1_CACHE_SHIFT 6
@@ -47,10 +53,7 @@
: "r"(data), "r"(ptr)); \
})
-/* Largest line length for either L1 or L2 is 128 bytes */
-#define SMP_CACHE_BYTES 128
-#define cache_line_size() SMP_CACHE_BYTES
-#define ARCH_DMA_MINALIGN SMP_CACHE_BYTES
+#define cache_line_size() ARC_MAX_CACHE_BYTES
/*
* Make sure slab-allocated buffers are 64-bit aligned when atomic64_t uses
--
2.14.5
next prev parent reply other threads:[~2019-04-16 17:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-16 17:10 [PATCH 0/3] ARC: cache: allow to autodetect L1 cache line size Eugeniy Paltsev
2019-04-16 17:10 ` Eugeniy Paltsev [this message]
2019-04-16 17:10 ` [PATCH 2/3] ARC: cache: check cache configuration on each CPU Eugeniy Paltsev
2019-04-16 17:32 ` Vineet Gupta
2019-04-16 17:10 ` [PATCH 3/3] ARC: cache: allow to autodetect L1 cache line size Eugeniy Paltsev
2019-04-16 17:51 ` 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=20190416171021.20049-2-Eugeniy.Paltsev@synopsys.com \
--to=eugeniy.paltsev@synopsys.com \
--cc=alexey.brodkin@synopsys.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-snps-arc@lists.infradead.org \
--cc=vineet.gupta1@synopsys.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;
as well as URLs for NNTP newsgroup(s).