Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1760051rwd; Fri, 9 Jun 2023 01:31:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4aoG3a0pzsG0FiVfiJ0kG+CubeMZSa2IG842Fyt+kuNjA2vJK45AQ34cwQ/HVbjYqXvEdq X-Received: by 2002:a17:90a:10c9:b0:258:fdd9:585a with SMTP id b9-20020a17090a10c900b00258fdd9585amr753291pje.3.1686299512646; Fri, 09 Jun 2023 01:31:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686299512; cv=none; d=google.com; s=arc-20160816; b=BCIRobedDFug1o22YiGcZkA3Eu9C7iCe0cXqQekyIiSFBRQQBgUL2WJ+I6QiUUB+0O WjkHpMtlZnHkjsNOUFH8kLpHaJ9eCClMYSwXOaG+Pky6ndSNuZIQGrmx0Jt+300pWDL8 AV08PjDJj/R9iOroWdI0U/B9oqyflDcCnXSF2fEtaCmJi0LlJeQxYKPCSr8fQIc6Rw5t 5u2FHcK02qUBG27u7imsZttjuTQA7eq2JVpyjgGEphe0FMsnvcsvPMyW46at7HTIZGMK Kyq4zPj0L3u0QCN0J6+cpskSo83RWfJ7JANgkbjjGB57ax+QneZ018cxtO952OnY/Rjr SPIg== 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=ZA+S0v6iLr2wkmRPyH+qWvvhx/TnOH2owT01i8MhK3U=; b=NNSjeX8oyehIY3i25b9DYJqgK0Q8O0fUUicu2NhBIs7TfCWFLvY7kg85afoRN4QDxH 6932IKON2+S1dzLgW/fSVotEAKFnsArh9ytMbAI2KhpBzDEzAZiTYaAL6WOcqnEDZRsx qAPK3NSHT5+XkewmpHe3YdxuNARFpJm9dU8IsUrlhqpna0fYtZG9PXaKPBCFepVq8mIv nw8OsOh+bUIThnfcNwQUrxdOFVb82YqQ/ZeNTzpZzfAskEX7Be7FUvpBuXXIEDQ8speG gtIDio0darvoVJ0STRQzFPJXGqU3OcDYbV2WqH/dmj5/s08XnhR/jUdTDc/brS+pgPqx haDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=PKfIeo5I; 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 z3-20020a17090a6d0300b0024e11f7a011si2299010pjj.100.2023.06.09.01.31.39; Fri, 09 Jun 2023 01:31:52 -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=PKfIeo5I; 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 S240464AbjFIISZ (ORCPT + 99 others); Fri, 9 Jun 2023 04:18:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240274AbjFIIRs (ORCPT ); Fri, 9 Jun 2023 04:17:48 -0400 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::226]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7865130EC; Fri, 9 Jun 2023 01:17:14 -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=1686298625; 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=ZA+S0v6iLr2wkmRPyH+qWvvhx/TnOH2owT01i8MhK3U=; b=PKfIeo5Idiacxg521v7LF2oTJXigoQW/18p/KEPAo44SGR0/PPVw4kJXW2qpLQVKbogDLb vfMcoIAPliXK3BtdMbpT4k2pm4qWpTynj31/tKkh4pHzW/diVPNd5uT4xgFcQnO2L2/eNY OXuA3OvJCygSS4qXY0HhCxz4q9/7ILy4VE7ly9t69G6pPGE5hJrv4HbDwrKKKgi1De1Z70 PX6QfN+tjxKJiNNh7HAVQ1Hr5ngnVzLUJRO2g9ITc+v2zIrU20Marb1oqPe78DkzMg5LT4 rbDH6gFhURB3Oyn5Mrrh0FEVSmaS1P8n9JauFqKVVomSKBq1s3Utg1N1PQzceg== 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 AE98AC0012; Fri, 9 Jun 2023 08:17:04 +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 8/9] dmaengine: dw-edma: eDMA: Fix possible race condition in remote setup Date: Fri, 9 Jun 2023 10:16:53 +0200 Message-Id: <20230609081654.330857-9-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,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 When writing the linked list elements and pointer the control need to be written at the end. If the control is written and the SAR and DAR not stored we could face a race condition. Fixes: 7e4b8a4fbe2c ("dmaengine: Add Synopsys eDMA IP version 0 support") Signed-off-by: Kory Maincent --- drivers/dma/dw-edma/dw-edma-v0-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-v0-core.c b/drivers/dma/dw-edma/dw-edma-v0-core.c index 2e872d6f2c04..a5d921ef54ec 100644 --- a/drivers/dma/dw-edma/dw-edma-v0-core.c +++ b/drivers/dma/dw-edma/dw-edma-v0-core.c @@ -291,10 +291,10 @@ static void dw_edma_v0_write_ll_data(struct dw_edma_chunk *chunk, int i, } else { struct dw_edma_v0_lli __iomem *lli = chunk->ll_region.vaddr.io + ofs; - writel(control, &lli->control); writel(size, &lli->transfer_size); writeq(sar, &lli->sar.reg); writeq(dar, &lli->dar.reg); + writel(control, &lli->control); } } @@ -311,8 +311,8 @@ static void dw_edma_v0_write_ll_link(struct dw_edma_chunk *chunk, } else { struct dw_edma_v0_llp __iomem *llp = chunk->ll_region.vaddr.io + ofs; - writel(control, &llp->control); writeq(pointer, &llp->llp.reg); + writel(control, &llp->control); } } -- 2.25.1