From: Finn Thain <fthain@telegraphics.com.au>
To: Ondrej Zary <linux@rainbow-software.org>
Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
Michael Schmitz <schmitzmic@gmail.com>
Subject: Re: [PATCH v4 0/5] g_NCR5380: PDMA fixes and cleanup
Date: Thu, 29 Jun 2017 15:27:01 +1000 (AEST) [thread overview]
Message-ID: <alpine.LNX.2.00.1706290827440.19937@nippy.intranet> (raw)
In-Reply-To: <201706282328.06806.linux@rainbow-software.org>
On Wed, 28 Jun 2017, Ondrej Zary wrote:
>
> Now read seems to work on non-DTC chips. Writes continue in PDMA after
> disconnect but there's a corruption - one 128 B block missing on
> disconnect.
>
> On DTC, the log is spammed with errors like this:
> sd 2:0:1:0: [sdb] tag#0 generic_NCR5380_pread: End of DMA timeout (0)
>
> They're cause by read corruption on DTC: pread() is breaking at
> start=3968 because of an end-of-DMA IRQ (BASR=0x98) but pdma_residual is
> set to zero (block counter is zero because the data was read into the
> buffer but we did not read it from there). So we lose one buffer of data
> on each 4 KB read.
>
But the algorithm in the datasheet never reads from the buffer after the
block counter reaches zero. (Of course, the only datasheet we have is for
a 53c400 device not a DTC436 so all bets are off.)
Anyway, the corrupted data that you describe is telling. I think you're
right, we have to drain the buffer even when Gated IRQ has been asserted
(or find a better way to calculate the residual).
I can see a theoretical problem with the code I sent. If the 53c80 raises
IRQ during the outsb() or insb(), we could still end up with start == end,
which could mess up both the residual and the handling for an incomplete
transfer.
> The PDMA is then reset which probably means BASR_END_DMA_TRANSFER will
> not be asserted.
>
But the BASR_END_DMA_TRANSFER flag is latched, and resetting the 53c400
logic should not affect 53c80 registers (assuming they are accessible). So
the reset does not explain the log messages.
Maybe your BASR=0x98 observations do not co-incide with the log messages.
Or maybe we need to wait for registers to become accessible after the
reset.
I've attempted to address all these issues in v5.
Thanks.
--
prev parent reply other threads:[~2017-06-29 5:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-28 4:04 Finn Thain
2017-06-28 4:04 ` [PATCH v4 4/5] g_NCR5380: Limit PDMA send to 512 B to avoid random corruption on DTC3181E Finn Thain
2017-06-28 4:04 ` [PATCH v4 2/5] g_NCR5380: End PDMA transfer correctly on target disconnection Finn Thain
2017-06-28 4:04 ` [PATCH v4 3/5] g_NCR5380: Cleanup comments and whitespace Finn Thain
2017-06-28 4:04 ` [PATCH v4 5/5] g_NCR5380: Re-work PDMA loops Finn Thain
2017-06-28 5:25 ` Finn Thain
2017-06-28 4:04 ` [PATCH v4 1/5] g_NCR5380: Fix PDMA transfer size Finn Thain
2017-06-28 21:28 ` [PATCH v4 0/5] g_NCR5380: PDMA fixes and cleanup Ondrej Zary
2017-06-29 5:27 ` Finn Thain [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=alpine.LNX.2.00.1706290827440.19937@nippy.intranet \
--to=fthain@telegraphics.com.au \
--cc=jejb@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linux@rainbow-software.org \
--cc=martin.petersen@oracle.com \
--cc=schmitzmic@gmail.com \
/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
all inboxes | Powered by JetHome®