From patchwork Thu Feb 16 06:48:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 9576571 X-Patchwork-Delegate: herbert@gondor.apana.org.au 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 A71D860244 for ; Thu, 16 Feb 2017 06:50:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 97903284FE for ; Thu, 16 Feb 2017 06:50:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8C2B12853F; Thu, 16 Feb 2017 06:50:36 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 462712858B for ; Thu, 16 Feb 2017 06:50:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754095AbdBPGuc (ORCPT ); Thu, 16 Feb 2017 01:50:32 -0500 Received: from mail-wr0-f180.google.com ([209.85.128.180]:35403 "EHLO mail-wr0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753893AbdBPGua (ORCPT ); Thu, 16 Feb 2017 01:50:30 -0500 Received: by mail-wr0-f180.google.com with SMTP id c4so4906020wrd.2 for ; Wed, 15 Feb 2017 22:50:29 -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=J/MeYMFTh6OovHv1Yyx5Xcf1mL11JOB3HCBOKRsJN/hj1/YJn4V41Ifv29i0Mk3TKT xo2FC3qSTWiuXO5n+6IUDu8NmhJYpxDnabOZ+nJn0cWfsbJyBB/60NiyTcSs7IxshGfV zz78wO3yzdGWhzXi+fwKSvLAknlCX2PAnHk7E= 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=n4Ql2JM2YzSOFnqDtoW62GgBBLfBQZDj+qmjf43L7amhJaUrRqPpjxBf/UrXiggSzn LY2oZ2w/tnkBhMUdkwI8nxzdmzbToyPh8v2rU3h6thOVCol1aitoeO6VNoTyTyGhwp8z U/dLvyJenvfw93EN8gJnW4KG5PH4LhqHyaQWMri7qtdW3MwvXJfYO1GXuLgUcz0YxFgX 96S0Me2xSvANh30alhN5cQL3bknslReJRmi6++bje3c3OzKYGE62XYdrfksisSS14ILB udnnZk0vIzy3AZ1qcC4zUfWjLJHoMkVDkhE8KTa0fn/klJtxV8FwhzBwANY/f9TD0n4a ud6Q== X-Gm-Message-State: AMke39nl6S561y9BSrRLfoL7kyLqvG0uPs3ku5FAk+l0yAAeui+4mv5NRSXS3SCSvAIqXgsu X-Received: by 10.223.164.150 with SMTP id g22mr636069wrb.148.1487227828677; Wed, 15 Feb 2017 22:50:28 -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 t30sm7628634wra.52.2017.02.15.22.50.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 15 Feb 2017 22:50:28 -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 v5 2/4] async_tx: Fix DMA_PREP_FENCE usage in do_async_gen_syndrome() Date: Thu, 16 Feb 2017 12:18:13 +0530 Message-Id: <1487227695-965-3-git-send-email-anup.patel@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487227695-965-1-git-send-email-anup.patel@broadcom.com> References: <1487227695-965-1-git-send-email-anup.patel@broadcom.com> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@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