From patchwork Tue Jun 27 06:28:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 9810871 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 75806603D7 for ; Tue, 27 Jun 2017 06:28:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F287285C8 for ; Tue, 27 Jun 2017 06:28:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 512A7285DA; Tue, 27 Jun 2017 06:28:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA48C285C8 for ; Tue, 27 Jun 2017 06:28:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751587AbdF0G2s (ORCPT ); Tue, 27 Jun 2017 02:28:48 -0400 Received: from smtp-1b.atlantis.sk ([80.94.52.26]:55970 "EHLO smtp-1b.atlantis.sk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751504AbdF0G2q (ORCPT ); Tue, 27 Jun 2017 02:28:46 -0400 Received: from [192.168.1.3] (ns.gsystem.sk [62.176.172.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp-1b.atlantis.sk (Postfix) with ESMTPSA id DAED78344286; Tue, 27 Jun 2017 08:28:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rainbow-software.org; s=atlsmtp; t=1498544923; bh=545RGB3n008YfrPnWmtyeuPwTeMwYDeCvIX/sA8VZvo=; h=From:To:Subject:Date:Cc:References:In-Reply-To; b=XOh184CQywdDXhEQeQY7mUlq5UMH3cbCr5jb7ZW3nDHGnT+Hb4AoTpuZoCJTnfSSH kUOzl7VFDBz0S7lVtiBh4ky5wf8IRAoG1zleCjab72wxyz++B8dgf5j4fkfWJaYNpm Wn0Vq7PvBusaYEHC5smd8+YodDoXbvWpsYJjoMK8= From: Ondrej Zary To: Finn Thain Subject: Re: [PATCH v3 0/4] g_NCR5380: PDMA fixes and cleanup Date: Tue, 27 Jun 2017 08:28:39 +0200 User-Agent: KMail/1.9.10 (enterprise35 0.20100827.1168748) Cc: "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Schmitz References: <201706262127.03911.linux@rainbow-software.org> In-Reply-To: <201706262127.03911.linux@rainbow-software.org> X-KMail-QuotePrefix: > MIME-Version: 1.0 Content-Disposition: inline Message-Id: <201706270828.40336.linux@rainbow-software.org> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Monday 26 June 2017, Ondrej Zary wrote: > On Monday 26 June 2017 09:30:33 Finn Thain wrote: > > Ondrej, would you please test this new series? > > > > Changed since v1: > > - PDMA transfer residual is calculated earlier. > > - End of DMA flag check is now polled (if there is any residual). > > > > Changed since v2: > > - Bail out of transfer loops when Gated IRQ gets asserted. > > - Make udelay conditional on board type. > > - Drop sg_tablesize patch due to performance regression. > > > > > > Finn Thain (1): > > g_NCR5380: Cleanup comments and whitespace > > > > Ondrej Zary (3): > > g_NCR5380: Fix PDMA transfer size > > g_NCR5380: End PDMA transfer correctly on target disconnection > > g_NCR5380: Re-work PDMA loops > > > > drivers/scsi/g_NCR5380.c | 239 > > +++++++++++++++++++++++------------------------ 1 file changed, 116 > > insertions(+), 123 deletions(-) BTW. I've probably found the DTC write corruption. Added the following check (13 is host buffer index register) - and it triggers sometimes: the value is 1 instead of 0. As we use only 16-bit writes, I don't see how the value could ever be odd. Looks like a bug in the chip. The index register corrupts during the transfer, not after IRQ or timeout. The same check at beginning of pwrite() did not trigger. The index register is not writable so we must(?) reset the PDMA engine to recover. However, this quick attempt to fix does not work, maybe we should reload the block count and continue? src + start, 64); --- a/drivers/scsi/g_NCR5380.c +++ b/drivers/scsi/g_NCR5380.c @@ -595,7 +603,13 @@ static inline int generic_NCR5380_pwrite(struct NCR5380_hostdata *hostdata, goto out_wait; } } - + idx = NCR5380_read(13); + if (idx != 0) { + printk("host idx=%d, start=%d\n", idx, start); + NCR5380_write(hostdata->c400_ctl_status, CSR_RESET); + NCR5380_write(hostdata->c400_ctl_status, CSR_BASE); + goto out_wait; + } if (hostdata->io_port && hostdata->io_width == 2) outsw(hostdata->io_port + hostdata->c400_host_buf,