From patchwork Mon Mar 6 09:43:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 9605569 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 551B2601D2 for ; Mon, 6 Mar 2017 09:45:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 24AE4279B3 for ; Mon, 6 Mar 2017 09:45:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 18FBA28346; Mon, 6 Mar 2017 09:45:21 +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.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 AFFD8279B3 for ; Mon, 6 Mar 2017 09:45:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754059AbdCFJor (ORCPT ); Mon, 6 Mar 2017 04:44:47 -0500 Received: from mail-qk0-f172.google.com ([209.85.220.172]:34805 "EHLO mail-qk0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754141AbdCFJob (ORCPT ); Mon, 6 Mar 2017 04:44:31 -0500 Received: by mail-qk0-f172.google.com with SMTP id p64so25652242qke.1 for ; Mon, 06 Mar 2017 01:44:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=92Sq4I4UInpzq2CbNnJQfee071l2ERx49mmNUjUXieo=; b=AhIt2zrLKQcNU6zAfHN57PCiV1jCWCnNuucVBbNt+Ij66381Av5seNwWOtZJviGs+J cUjtYjOFzMhmYtgJVXoO+PVe/gPGM5Bf1zFrjo9DgmNejHGxTyQ/Z0I6lFofzSc2q3+U iO14ABVrUiiwVAJzEq3P6RQn1QD4K9TBZcX2s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=92Sq4I4UInpzq2CbNnJQfee071l2ERx49mmNUjUXieo=; b=nGJzkapLwRffXNsGCMdjumAt6iSuVEOT+fcKPKiTNxfee8pUYGdQpjE+d0pYh3j+Jr LVcUTNmr0GdIg48FTpi+BgAuOnAM044VqmTE32Hy9NSK+47W+B03Tjocb7XyEqepdqIG 9N8p+4W5iDdpfD7IPeXsb9yuMmn0T4EEE8eH8wG2q+MNBV8eAI4UdbtZsiEeaf64p8dK MGQo8q3iuy3jZ/n82egmOjPiv1RBjL+FJlTcF9CCYhnG/sLCAyfnR4oUAoGixGin9bgG NlpUV0p0Niq04YeOI80spICGhKRPW2W540l3fatqEtgtgBRocqHcwd1Uui6/OqOPoSDp af/A== X-Gm-Message-State: AMke39nRliIH42Gv8WGM7fP4WvYWVd4Oy7WFER8qQU/sibhgj5W2PBYmjrHJtE9LCDRYwHI5 X-Received: by 10.55.94.6 with SMTP id s6mr15585163qkb.166.1488793456280; Mon, 06 Mar 2017 01:44:16 -0800 (PST) Received: from anup-HP-Compaq-8100-Elite-CMT-PC.dhcp.avagotech.net ([192.19.237.250]) by smtp.gmail.com with ESMTPSA id q66sm13017276qkd.69.2017.03.06.01.44.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 06 Mar 2017 01:44:15 -0800 (PST) From: Anup Patel To: Vinod Koul , Rob Herring , Mark Rutland , Herbert Xu , "David S . Miller" , Jassi Brar Cc: Dan Williams , Ray Jui , Scott Branden , Jon Mason , Rob Rice , bcm-kernel-feedback-list@broadcom.com, dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, linux-raid@vger.kernel.org, Anup Patel Subject: [PATCH v6 2/4] async_tx: Fix DMA_PREP_FENCE usage in do_async_gen_syndrome() Date: Mon, 6 Mar 2017 15:13:26 +0530 Message-Id: <1488793408-25592-3-git-send-email-anup.patel@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488793408-25592-1-git-send-email-anup.patel@broadcom.com> References: <1488793408-25592-1-git-send-email-anup.patel@broadcom.com> Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The DMA_PREP_FENCE is to be used when preparing Tx descriptor if output of Tx descriptor is to be used by next/dependent Tx descriptor. The DMA_PREP_FENSE will not be set correctly in do_async_gen_syndrome() when calling dma->device_prep_dma_pq() under following conditions: 1. ASYNC_TX_FENCE not set in submit->flags 2. DMA_PREP_FENCE not set in dma_flags 3. src_cnt (= (disks - 2)) is greater than dma_maxpq(dma, dma_flags) This patch fixes DMA_PREP_FENCE usage in do_async_gen_syndrome() taking inspiration from do_async_xor() implementation. Signed-off-by: Anup Patel Reviewed-by: Ray Jui Reviewed-by: Scott Branden --- crypto/async_tx/async_pq.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/crypto/async_tx/async_pq.c b/crypto/async_tx/async_pq.c index f83de99..56bd612 100644 --- a/crypto/async_tx/async_pq.c +++ b/crypto/async_tx/async_pq.c @@ -62,9 +62,6 @@ do_async_gen_syndrome(struct dma_chan *chan, dma_addr_t dma_dest[2]; int src_off = 0; - if (submit->flags & ASYNC_TX_FENCE) - dma_flags |= DMA_PREP_FENCE; - while (src_cnt > 0) { submit->flags = flags_orig; pq_src_cnt = min(src_cnt, dma_maxpq(dma, dma_flags)); @@ -83,6 +80,8 @@ do_async_gen_syndrome(struct dma_chan *chan, if (cb_fn_orig) dma_flags |= DMA_PREP_INTERRUPT; } + if (submit->flags & ASYNC_TX_FENCE) + dma_flags |= DMA_PREP_FENCE; /* Drivers force forward progress in case they can not provide * a descriptor