linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: kirill@shutemov.name (Kirill A. Shutsemov)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/5] ARMv6K and ARMv7 use fault statuses 3 and 6 as Access Flag fault
Date: Mon, 19 Jul 2010 11:53:24 +0300	[thread overview]
Message-ID: <bfd71c480c8d137cc4cc6261a42f514f9024ee53.1279529223.git.kirill@shutemov.name> (raw)
In-Reply-To: <cover.1279529223.git.kirill@shutemov.name>

From: Kirill A. Shutemov <kirill@shutemov.name>

Statuses 3 (0b00011) and 6 (0x00110) of DFSR are Access Flags faults on
ARMv6K and ARMv7. Let's patch fsr_info[] at runtime if we are on ARMv7
or later.

Unfortunately, we don't have runtime check for 'K' extension, so we
can't check for it.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
---
 arch/arm/mm/alignment.c |   14 ++++++++++++--
 arch/arm/mm/fault.c     |   11 +++++++++++
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c
index 77cfdbe..d073b64 100644
--- a/arch/arm/mm/alignment.c
+++ b/arch/arm/mm/alignment.c
@@ -926,8 +926,18 @@ static int __init alignment_init(void)
 
 	hook_fault_code(1, do_alignment, SIGBUS, BUS_ADRALN,
 			"alignment exception");
-	hook_fault_code(3, do_alignment, SIGBUS, BUS_ADRALN,
-			"alignment exception");
+
+	/*
+	 * ARMv6K and ARMv7 use fault status 3 (0b00011) as Access Flag section
+	 * fault, not as alignment error.
+	 *
+	 * TODO: handle ARMv6K properly. Runtime check for 'K' extension is
+	 * needed.
+	 */
+	if (cpu_architecture() <= CPU_ARCH_ARMv6) {
+		hook_fault_code(3, do_alignment, SIGBUS, BUS_ADRALN,
+				"alignment exception");
+	}
 
 	return 0;
 }
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
index 345a3c9..7e866e9 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -598,6 +598,17 @@ static int __init exceptions_init(void)
 				"I-cache maintenance fault");
 	}
 
+	if (cpu_architecture() >= CPU_ARCH_ARMv7) {
+		/*
+		 * TODO: Access flag faults introduced in ARMv6K.
+		 * Runtime check for 'K' extension is needed
+		 */
+		hook_fault_code(3, do_bad, SIGSEGV, SEGV_MAPPERR,
+				"section access flag fault");
+		hook_fault_code(6, do_bad, SIGSEGV, SEGV_MAPPERR,
+				"section access flag fault");
+	}
+
 	return 0;
 }
 
-- 
1.7.1.1

  parent reply	other threads:[~2010-07-19  8:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-19  8:53 [PATCH 0/5] ARM: fix exceptions handling Kirill A. Shutsemov
2010-07-19  8:53 ` [PATCH 1/5] Use SIGBUS for unalinged access instead of SIGILL Kirill A. Shutsemov
2010-07-19  8:53 ` [PATCH 2/5] Add 'code' parameter for hook_fault_code() Kirill A. Shutsemov
2010-07-27  9:35   ` Russell King - ARM Linux
2010-07-27  9:42     ` Kirill A. Shutemov
2010-07-19  8:53 ` [PATCH 3/5] Check arch version and modify fsr_info[] depends on it at runtime Kirill A. Shutsemov
2010-07-19  8:53 ` Kirill A. Shutsemov [this message]
2010-07-19 10:11   ` [PATCH 4/5] ARMv6K and ARMv7 use fault statuses 3 and 6 as Access Flag fault Sergei Shtylyov
2010-07-19 11:20     ` Kirill A. Shutemov
2010-07-19 13:51       ` Sergei Shtylyov
2010-07-19  8:53 ` [PATCH 5/5] Workaround infinity loop in handling of translation faults Kirill A. Shutsemov

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=bfd71c480c8d137cc4cc6261a42f514f9024ee53.1279529223.git.kirill@shutemov.name \
    --to=kirill@shutemov.name \
    --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).