From patchwork Tue Sep 28 12:24:54 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Yanok X-Patchwork-Id: 65965 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 13EC3B72DA for ; Tue, 28 Sep 2010 22:58:30 +1000 (EST) Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.10]) by ozlabs.org (Postfix) with ESMTP id 7C8A0B70E6 for ; Tue, 28 Sep 2010 22:25:29 +1000 (EST) Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 616041C00497; Tue, 28 Sep 2010 14:25:15 +0200 (CEST) X-Auth-Info: /i4BpYVNCo8z4jXslcfHSbyait0S3C2TZ0DCDOOc53Y= Received: from mail.denx.de (host-82-135-33-74.customer.m-online.net [82.135.33.74]) by smtp-auth.mnet-online.de (Postfix) with ESMTPA id 5A3D11C00361; Tue, 28 Sep 2010 14:25:15 +0200 (CEST) Received: from pollux.denx.de (pollux [192.168.1.1]) by mail.denx.de (Postfix) with ESMTP id 4BAE040BCE7E; Tue, 28 Sep 2010 14:25:15 +0200 (CEST) Received: by pollux.denx.de (Postfix, from userid 547) id 40C82101174A2; Tue, 28 Sep 2010 14:25:15 +0200 (CEST) From: Ilya Yanok To: linuxppc-dev@lists.ozlabs.org, wd@denx.de, dzu@denx.de, vlad@emcraft.com Subject: [PATCH 1/3] mpc512x_dma: scatter/gather fix Date: Tue, 28 Sep 2010 14:24:54 +0200 Message-Id: <1285676696-5358-2-git-send-email-yanok@emcraft.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1285676696-5358-1-git-send-email-yanok@emcraft.com> References: <1285676696-5358-1-git-send-email-yanok@emcraft.com> Cc: Piotr Ziecik , Ilya Yanok X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org While testing mpc512x-dma driver with dmatest module I've found that I can hang the mpc512x-dma issueing request from multiple threads to the single channel. (insmod dmatest.ko max_channels=1 threads_per_chan=16) After investingating this case I've managed to find that this happens if and only if we have more than one quequed requests. In this case the driver tries to make use of hardware scatter/gather functionality. I've found two problems with scatter/gather: 1. When TCD is copied form RAM to the TCD register space with memcpy_io() e_sg bit eventually gets cleared. This results in only first TCD being executed. I've added setting of e_sg bit excplicitly in the TCD registers. BTW, what is the correct way to do this? (How can I use setbits with bitfield structure?) After that hardware loads consecutive TCDs and we hit the second issue. 2. Existing code clears int_maj bit in the last TCD so we never get an interrupt on transfefr completion. With these fixes my tests with many threads of single channel succeed but tests that use many channels simultaneously still don't work reliable. Signed-off-by: Ilya Yanok Cc: Piotr Ziecik --- drivers/dma/mpc512x_dma.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/dma/mpc512x_dma.c b/drivers/dma/mpc512x_dma.c index 4e9cbf3..1bc04aa 100644 --- a/drivers/dma/mpc512x_dma.c +++ b/drivers/dma/mpc512x_dma.c @@ -252,11 +252,13 @@ static void mpc_dma_execute(struct mpc_dma_chan *mchan) prev = mdesc; } - prev->tcd->start = 0; prev->tcd->int_maj = 1; /* Send first descriptor in chain into hardware */ memcpy_toio(&mdma->tcd[cid], first->tcd, sizeof(struct mpc_dma_tcd)); + + if (first != prev) + mdma->tcd[cid].e_sg = 1; out_8(&mdma->regs->dmassrt, cid); }