From: robherring2@gmail.com (Rob Herring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] ARM: use cache type functions for arch_get_unmapped_area
Date: Mon, 7 Nov 2011 17:43:40 -0600 [thread overview]
Message-ID: <1320709421-14469-1-git-send-email-robherring2@gmail.com> (raw)
From: Rob Herring <rob.herring@calxeda.com>
There are already cache type decoding functions, so use those instead
of custom decode code which only works for ARMv6.
This change also correctly enables cache colour alignment on Cortex-A9
whose I-cache is aliasing VIPT.
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
arch/arm/mm/mmap.c | 23 ++++++-----------------
1 files changed, 6 insertions(+), 17 deletions(-)
diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c
index 74be05f..80e70ef 100644
--- a/arch/arm/mm/mmap.c
+++ b/arch/arm/mm/mmap.c
@@ -9,8 +9,7 @@
#include <linux/io.h>
#include <linux/personality.h>
#include <linux/random.h>
-#include <asm/cputype.h>
-#include <asm/system.h>
+#include <asm/cachetype.h>
#define COLOUR_ALIGN(addr,pgoff) \
((((addr)+SHMLBA-1)&~(SHMLBA-1)) + \
@@ -32,25 +31,15 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
struct mm_struct *mm = current->mm;
struct vm_area_struct *vma;
unsigned long start_addr;
-#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K)
- unsigned int cache_type;
- int do_align = 0, aliasing = 0;
+ int do_align = 0;
+ int aliasing = cache_is_vipt_aliasing() || icache_is_vipt_aliasing();
/*
* We only need to do colour alignment if either the I or D
- * caches alias. This is indicated by bits 9 and 21 of the
- * cache type register.
+ * caches alias.
*/
- cache_type = read_cpuid_cachetype();
- if (cache_type != read_cpuid_id()) {
- aliasing = (cache_type | cache_type >> 12) & (1 << 11);
- if (aliasing)
- do_align = filp || flags & MAP_SHARED;
- }
-#else
-#define do_align 0
-#define aliasing 0
-#endif
+ if (aliasing)
+ do_align = filp || (flags & MAP_SHARED);
/*
* We enforce the MAP_FIXED case.
--
1.7.5.4
next reply other threads:[~2011-11-07 23:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-07 23:43 Rob Herring [this message]
2011-11-07 23:43 ` [PATCH 2/2] ARM: topdown mmap support Rob Herring
2011-11-14 17:41 ` Nicolas Pitre
2011-11-14 18:05 ` Rob Herring
2011-11-14 18:22 ` Nicolas Pitre
2011-11-15 23:02 ` Rob Herring
2011-11-16 23:45 ` Nicolas Pitre
2011-11-14 17:36 ` [PATCH 1/2] ARM: use cache type functions for arch_get_unmapped_area Nicolas Pitre
2011-11-14 20:27 ` Will Deacon
2011-11-14 20:36 ` Rob Herring
2011-11-15 23:37 ` Rob Herring
2011-11-16 9:48 ` Will Deacon
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=1320709421-14469-1-git-send-email-robherring2@gmail.com \
--to=robherring2@gmail.com \
--cc=linux-arm-kernel@lists.infradead.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).