Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1760455rwd; Fri, 9 Jun 2023 01:32:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7jzOp/ijSQVoZbWqVidlzf2B7zsgAnlmJUHhwrN3YoEY250+vMXDvKUm5+9l1lXpml0fiW X-Received: by 2002:a05:6808:309e:b0:39c:6a30:cc76 with SMTP id bl30-20020a056808309e00b0039c6a30cc76mr1000658oib.3.1686299540958; Fri, 09 Jun 2023 01:32:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686299540; cv=none; d=google.com; s=arc-20160816; b=Ro3Q0Y5848hbg+78Bd/M05EP0tfkdt06IwnXTMJdjMfDsTIoI52j1NcBoOz2EJ0S4C 9lGHQJj3FI1L+xfunl8hxP8sJGE1/flNalqUMgmqgojOe9rP1I+ilVJvhRzmE6UXuN1X VOuAb/c1WLeGck7lMzkuOnuJwa6AbtDUdMU5nMZt0r6NDRldqVGCwHA0yQYfimSkn3SF xgeJ8OxmC8grgZMMRZVKQareCBs3xNn2+hdiSqTcjP7ms1WSfqpZrjer2zzn1kxAU5IA TSJh5YOeqZWRgufzoL5q0F4HuL2qY8aiHTIcsvv06mka5l+OCcAPCwirqNK7+CI9I6h8 kHuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ZN4vSrdEzZbjDfKQW2lKALJhEegIaV8kRdvhAJHOihQ=; b=T+3Vi04mROu5jpTmTHemRPXD/wtypQSrmTTegOQoOTxzRXc3lulPhHT1AcBjy+SmKa wN3GMUJEVvn88nScTx6pPqFh43m22UTPT+QL/q8RuEP+1Yu8fPV7mDFOErEmEPuTeoBM 26eU20Y3YSg1Gls8saOyEAkFQp7lVaYDp4YuZ0poBIIxzPP9+ss7/ZNzXUVl6Kokmhzt FZ6i7K/EDFxpZvgWPQI/sI0t+SbTSPBnrrv4cQ3uygPf83zqHEDLGN2ffZ2xQBN59pUP Uana8JfoFsglDw6tejbCLA/aE5tAtNHLPJtzlJqdFMIJHoBIIbg0FOoTvQIlu1QwAAsj N6xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="hcG/OaQG"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d23-20020a17090ad99700b0024e01bbc60asi4095882pjv.117.2023.06.09.01.32.07; Fri, 09 Jun 2023 01:32:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="hcG/OaQG"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240431AbjFIISU (ORCPT + 99 others); Fri, 9 Jun 2023 04:18:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240237AbjFIIRl (ORCPT ); Fri, 9 Jun 2023 04:17:41 -0400 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BB3F30DB; Fri, 9 Jun 2023 01:17:10 -0700 (PDT) X-GND-Sasl: kory.maincent@bootlin.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1686298624; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZN4vSrdEzZbjDfKQW2lKALJhEegIaV8kRdvhAJHOihQ=; b=hcG/OaQGWsEJoSXYV3ZcJgpjt9j3R7FGTjZ/ONxgw9+gogqpNSHbZ9uOlMzNMebGLDA1nP rfuD1999pBUuLpUk8aiWioqyBn4Tzo5BunhzuOIL/36dfyT0j7HNSshdLfEWgCU1GnnG9i 6s+mCK+dVhvHUZNWcrGe7WHMVULdAa1t185/6r02IERNw+DRJTmpUEDFffUkEKlxg+PEoa 3DWAE1JtmiRqfz3evHdONfh5Z9Nt5jDeEHBxQLsDqXhLK1h5AuxM0BqB266FtdmKNeub9y CTTJR1IUFMjjQqbuoTqJEQTlGGenWtY5WMiTcmY37PcM17+1AXQV839sNXW1YA== X-GND-Sasl: kory.maincent@bootlin.com X-GND-Sasl: kory.maincent@bootlin.com X-GND-Sasl: kory.maincent@bootlin.com X-GND-Sasl: kory.maincent@bootlin.com X-GND-Sasl: kory.maincent@bootlin.com X-GND-Sasl: kory.maincent@bootlin.com X-GND-Sasl: kory.maincent@bootlin.com X-GND-Sasl: kory.maincent@bootlin.com X-GND-Sasl: kory.maincent@bootlin.com X-GND-Sasl: kory.maincent@bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 80D28C000E; Fri, 9 Jun 2023 08:17:03 +0000 (UTC) From: =?UTF-8?q?K=C3=B6ry=20Maincent?= To: Cai Huoqing , Manivannan Sadhasivam , Serge Semin , Vinod Koul , Gustavo Pimentel , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Thomas Petazzoni , Gustavo Pimentel , Herve Codina , Kory Maincent Subject: [PATCH 7/9] dmaengine: dw-edma: eDMA: Add memory barrier before starting the DMA transfer in remote setup Date: Fri, 9 Jun 2023 10:16:52 +0200 Message-Id: <20230609081654.330857-8-kory.maincent@bootlin.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230609081654.330857-1-kory.maincent@bootlin.com> References: <20230609081654.330857-1-kory.maincent@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-Spam-Score: 300 X-GND-Status: SPAM X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kory Maincent The Linked list element and pointer are not stored in the same memory as the eDMA controller register. If the doorbell register is toggled before the full write of the linked list a race condition error can appears. In remote setup we can only use a readl to the memory to assured the full write has occurred. Fixes: 7e4b8a4fbe2c ("dmaengine: Add Synopsys eDMA IP version 0 support") Signed-off-by: Kory Maincent --- drivers/dma/dw-edma/dw-edma-v0-core.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/dma/dw-edma/dw-edma-v0-core.c b/drivers/dma/dw-edma/dw-edma-v0-core.c index b38786f0ad79..2e872d6f2c04 100644 --- a/drivers/dma/dw-edma/dw-edma-v0-core.c +++ b/drivers/dma/dw-edma/dw-edma-v0-core.c @@ -412,6 +412,15 @@ static void dw_edma_v0_core_start(struct dw_edma_chunk *chunk, bool first) SET_CH_32(dw, chan->dir, chan->id, llp.msb, upper_32_bits(chunk->ll_region.paddr)); } + + if (!(chunk->chan->dw->chip->flags & DW_EDMA_CHIP_LOCAL)) + /* Make sure Linked List has been written. + * Linux memory barriers don't cater for what's required here. + * What's required is what's here - a read of the linked + * list region. + */ + readl(chunk->ll_region.vaddr.io); + /* Doorbell */ SET_RW_32(dw, chan->dir, doorbell, FIELD_PREP(EDMA_V0_DOORBELL_CH_MASK, chan->id)); -- 2.25.1