linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: js@sig21.net (Johannes Stezenbach)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] fix DEBUG_LL DCC race condition
Date: Wed, 31 Oct 2012 18:25:54 +0100	[thread overview]
Message-ID: <20121031172553.GA20949@sig21.net> (raw)
In-Reply-To: <20121031170853.GA20498@sig21.net>

Trying to boot a kernel with I- and D-caches disabled
sometimes hangs when DEBUG_LL output to DCC is enabled.
Apparently the JTAG debugger sometimes reads the
DCC register before the current busyuart implementation
could see the wDTRfull flag, thus busyuart spins in an endless loop.

The reason seems to be a misunderstanding of the purpose
of the busyuart macro.  For UART, waituart should wait
until flow control allows to send the character, or do
nothing.  busyuart should wait until the FIFO is empty
(all data is sent).
For DCC, busyuart should wait until the JTAG debugger has
read the DCC register (wait for wDTRfull == 0 on ARMv6), and
waituart does nothing.

Signed-off-by: Johannes Stezenbach <js@sig21.net>
---
v2:
- update description
- waituart is empty (no flow control)

diff --git a/arch/arm/include/debug/icedcc.S b/arch/arm/include/debug/icedcc.S
index 43afcb0..30e18e5 100644
--- a/arch/arm/include/debug/icedcc.S
+++ b/arch/arm/include/debug/icedcc.S
@@ -21,13 +21,6 @@
 		.endm
 
 		.macro	busyuart, rd, rx
-1001:
-		mrc	p14, 0, \rx, c0, c1, 0
-		tst	\rx, #0x20000000
-		beq	1001b
-		.endm
-
-		.macro	waituart, rd, rx
 		mov	\rd, #0x2000000
 1001:
 		subs	\rd, \rd, #1
@@ -38,6 +31,9 @@
 1002:
 		.endm
 
+		.macro	waituart, rd, rx
+		.endm
+
 #elif defined(CONFIG_CPU_XSCALE)
 
 		.macro	senduart, rd, rx
@@ -45,13 +41,6 @@
 		.endm
 
 		.macro	busyuart, rd, rx
-1001:
-		mrc	p14, 0, \rx, c14, c0, 0
-		tst	\rx, #0x10000000
-		beq	1001b
-		.endm
-
-		.macro	waituart, rd, rx
 		mov	\rd, #0x10000000
 1001:
 		subs	\rd, \rd, #1
@@ -62,6 +51,9 @@
 1002:
 		.endm
 
+		.macro	waituart, rd, rx
+		.endm
+
 #else
 
 		.macro	senduart, rd, rx
@@ -69,14 +61,6 @@
 		.endm
 
 		.macro	busyuart, rd, rx
-1001:
-		mrc	p14, 0, \rx, c0, c0, 0
-		tst	\rx, #2
-		beq	1001b
-
-		.endm
-
-		.macro	waituart, rd, rx
 		mov	\rd, #0x2000000
 1001:
 		subs	\rd, \rd, #1
@@ -87,4 +71,7 @@
 1002:
 		.endm
 
+		.macro	waituart, rd, rx
+		.endm
+
 #endif	/* CONFIG_CPU_V6 */

      reply	other threads:[~2012-10-31 17:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-29 15:18 [PATCH] fix DEBUG_LL DCC race condition Johannes Stezenbach
2012-10-31 16:27 ` Tony Lindgren
2012-10-31 16:36 ` Russell King - ARM Linux
2012-10-31 17:08   ` Johannes Stezenbach
2012-10-31 17:25     ` Johannes Stezenbach [this message]

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=20121031172553.GA20949@sig21.net \
    --to=js@sig21.net \
    --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).