All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rosen Penev <rosenp@gmail.com>
To: linux-ide@vger.kernel.org
Cc: Damien Le Moal <dlemoal@kernel.org>,
	Niklas Cassel <cassel@kernel.org>,
	Jeff Garzik <jgarzik@redhat.com>,
	Rafal Prylowski <prylowski@metasoft.pl>,
	linux-kernel@vger.kernel.org (open list)
Subject: [PATCHv3] ata: pata_ep93xx: add missing "cc" and "memory" clobbers to inline asm
Date: Fri, 31 Jul 2026 13:53:38 -0700	[thread overview]
Message-ID: <20260731205338.8011-1-rosenp@gmail.com> (raw)

The inline assembly in ep93xx_pata_delay() uses a "subs" instruction
which modifies the ARM condition code flags. Add a "cc" clobber so
the compiler knows the flags are altered. Without it, the compiler may
reorder flag-dependent instructions across the asm block when the
function is inlined, potentially causing incorrect control flow.

Additionally, add a "memory" clobber to prevent the compiler from
reordering I/O accesses across this delay loop. On older ARM
architectures like ARMv4T used in EP93xx, __iormb()/__iowmb() may
evaluate to empty when CONFIG_ARM_DMA_MEM_BUFFERABLE is not set,
leaving writel()/readl() without a compiler memory barrier. Without
a "memory" clobber here, the compiler optimizer might reorder
independent I/O accesses across the delay, violating ATA PIO timing
requirements. This also brings the ARM path in line with the non-ARM
fallback which uses cpu_relax() (a compiler barrier).

Fixes: 2fff27512600 ("PATA host controller driver for ep93xx")
Assisted-by: Opencode:Big-Pickle
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 v3: add memory barrier
 v2: add Fixes tag
 drivers/ata/pata_ep93xx.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/ata/pata_ep93xx.c b/drivers/ata/pata_ep93xx.c
index 587caadf78cb..6d948e41bc59 100644
--- a/drivers/ata/pata_ep93xx.c
+++ b/drivers/ata/pata_ep93xx.c
@@ -211,6 +211,7 @@ static void ep93xx_pata_delay(unsigned long count)
 		"bge 0b\n"
 		: "=r" (count)
 		: "0" (count)
+		: "cc", "memory"
 	);
 #else
 	while (count--)
-- 
2.55.0


             reply	other threads:[~2026-07-31 20:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-31 20:53 Rosen Penev [this message]
2026-07-31 21:04 ` [PATCHv3] ata: pata_ep93xx: add missing "cc" and "memory" clobbers to inline asm sashiko-bot

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=20260731205338.8011-1-rosenp@gmail.com \
    --to=rosenp@gmail.com \
    --cc=cassel@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=jgarzik@redhat.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=prylowski@metasoft.pl \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.