From: ben.dooks@codethink.co.uk (Ben Dooks)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] ARM: mm: mm->context.id fix for big-endian
Date: Sun, 10 Feb 2013 14:57:28 +0000 [thread overview]
Message-ID: <1360508248-25252-3-git-send-email-ben.dooks@codethink.co.uk> (raw)
In-Reply-To: <1360508248-25252-1-git-send-email-ben.dooks@codethink.co.uk>
Since the new ASID code in [b5466f8728527a05a493cc4abe9e6f034a1bbaab]
was changed to use 64bit operations it has broken the BE operation due
to an issue with the MM code accessing sub-fields of mm->context.id.
When running in BE mode we see the values in mm->context.id are stored
with the highest value first, so the LDR in the arch/arm/mm/proc-macros.S
reads the wrong part of this field. To resolve this, change the LDR in
the mmid macro to load from +4.
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
arch/arm/mm/context.c | 3 +++
arch/arm/mm/proc-macros.S | 5 +++++
2 files changed, 8 insertions(+)
diff --git a/arch/arm/mm/context.c b/arch/arm/mm/context.c
index bc4a5e9..7a05111 100644
--- a/arch/arm/mm/context.c
+++ b/arch/arm/mm/context.c
@@ -34,6 +34,9 @@
* The ASID is used to tag entries in the CPU caches and TLBs.
* The context ID is used by debuggers and trace logic, and
* should be unique within all running processes.
+ *
+ * In big endian operation, the two 32 bit words are swapped if accesed by
+ * non 64-bit operations.
*/
#define ASID_FIRST_VERSION (1ULL << ASID_BITS)
#define NUM_USER_ASIDS (ASID_FIRST_VERSION - 1)
diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
index eb6aa73..f9a0aa7 100644
--- a/arch/arm/mm/proc-macros.S
+++ b/arch/arm/mm/proc-macros.S
@@ -38,9 +38,14 @@
/*
* mmid - get context id from mm pointer (mm->context.id)
+ * note, this field is 64bit, so in big-endian the two words are swapped too.
*/
.macro mmid, rd, rn
+#ifdef __ARMEB__
+ ldr \rd, [\rn, #MM_CONTEXT_ID + 4 ]
+#else
ldr \rd, [\rn, #MM_CONTEXT_ID]
+#endif
.endm
/*
--
1.7.10.4
next prev parent reply other threads:[~2013-02-10 14:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-10 14:57 [FIX v2] v3.8-rc: fix for MM ASID code in BE mode Ben Dooks
2013-02-10 14:57 ` [PATCH 1/2] ARM: mm: replace direct access to mm->context.id with new macro Ben Dooks
2013-02-10 14:57 ` Ben Dooks [this message]
2013-02-10 15:05 ` [PATCH 2/2] ARM: mm: mm->context.id fix for big-endian Ben Dooks
2013-02-10 23:29 ` Russell King - ARM Linux
2013-02-11 10:38 ` Ben Dooks
2013-02-11 10:51 ` Will Deacon
-- strict thread matches above, loose matches on Subject: below --
2013-02-09 23:15 v3.8-rc issues with big endian Ben Dooks
2013-02-09 23:15 ` [PATCH 2/2] ARM: mm: mm->context.id fix for big-endian Ben Dooks
2013-02-10 1:10 ` Ben Dooks
2013-02-10 14:14 ` Sergei Shtylyov
2013-02-10 14:17 ` Ben Dooks
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=1360508248-25252-3-git-send-email-ben.dooks@codethink.co.uk \
--to=ben.dooks@codethink.co.uk \
--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).