Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2777261rwl; Mon, 27 Mar 2023 05:17:46 -0700 (PDT) X-Google-Smtp-Source: AKy350by+TUR6E5uks1Qby2srwqG6Thv5ql50e4ze069WICAvp4PQmVmrCDdyfsVmTfHsuCGVG68 X-Received: by 2002:a17:907:9728:b0:93e:5baa:d443 with SMTP id jg40-20020a170907972800b0093e5baad443mr14491064ejc.63.1679919466484; Mon, 27 Mar 2023 05:17:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679919466; cv=none; d=google.com; s=arc-20160816; b=jWDpxriGJHz5wW8YnzH2+9pWWX7VB7Q9HL1q/qMoH5DMHWPH3DianiwZJzGhoxhyCZ FHse1ahWH6VcBg8NqzjfkKe0/jAuDUn/91q3rrQdI+jUBDjCvIoU5ZKaJI6Z5nTx9pv+ 6QeOoLzfEAasmzL/CuF57tnAEEONNRKZFoMybIGcjAh2MzKE9nr4FsNdIfXutG0sl+0o i1oxWc6MWG4pxMk8ZGZiokkovuTOwwf0SH7+Xe2Fvbhv2GXdGtEFuJ9iDsG8ua2jGd2V VOOocOOim5+GBcBCmTFwfvHwbr4A/Iz1r5ES4/x6xcHP8aLs9qepgmOrqSxusy1rW/pb MtHQ== 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=R0tMvo6tsEmWBJsmUg3HXu43+cdgs6Tc2xxMv2+c4HA=; b=SNKsGWPDCvJdLkwfNu7PwTv0rlBqB5M28Ardnu9WLQ9Sp0N61KqJgFotEbgDLvXHxm 3OhpxIFlXQJMJqldGmcC3cZecWB5HOoGaC9l+Z0EGjM+Ai+3FWZH5swuz6sa69GMowC8 ogc/e9BP8wkfLQl7tfRae6+hGAk9bZ6HYuVNNhy7HY9xlZUxO0D0UxInbLyYg4tXB3g0 AfEykPUFWnYgB9bjLzvJOH8ILO1jTX7Dcv0seDar9HadM6rKzp7RouoAGgYfryDWnoNr ZHTh43Z8hG45EFo+OUixldZBrU77t5fjMnS19Jz+jAIXK0j8vYyBQXxpjbLscUhMgIPz TE+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="gF/2rqKM"; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pw13-20020a17090720ad00b00923c54e9ad0si26358775ejb.585.2023.03.27.05.17.20; Mon, 27 Mar 2023 05:17:46 -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=@kernel.org header.s=k20201202 header.b="gF/2rqKM"; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232812AbjC0MRK (ORCPT + 99 others); Mon, 27 Mar 2023 08:17:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231970AbjC0MQ3 (ORCPT ); Mon, 27 Mar 2023 08:16:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE5A33C2D; Mon, 27 Mar 2023 05:15:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 96F3BB81151; Mon, 27 Mar 2023 12:15:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C656C4339B; Mon, 27 Mar 2023 12:15:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679919350; bh=WcyJUuclgspkZHSwVclV5Jksx+zy3hY89ahpztaj0hM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gF/2rqKM1LHnyfHfzF1g693XZNfrbHBqd2oKlgoQ2jGFc8xTOws4qsH2njENSW1Si OGeqBCL1Lt3BSCm5fmGZhO1H6HKEoKzetUEYMk3Soh/1yhM8nZtCol16EHntqcT8Er pM+o9uzAgZL1iYBAWUy3z6yGzIeoUU0K+TXymgHYz7EqbCIvcrn8MMo6RRjBuEtKTx 6l+8vcM3FOZ1WkoHQ1Wlf6+gyjrHJP0Ci4xI/sPZptxVi/W3OXZggPcMTH3OeaOXte UVzqZh+or7dDyFm/ogv6Vz88DYJfSiZ34SmQ2duChP+VAO1veqEJjztWBBm3dd9c41 y9Yt0CcmM/sAw== From: Arnd Bergmann To: linux-kernel@vger.kernel.org Cc: Arnd Bergmann , Vineet Gupta , Russell King , Neil Armstrong , Linus Walleij , Catalin Marinas , Will Deacon , Guo Ren , Brian Cain , Geert Uytterhoeven , Michal Simek , Thomas Bogendoerfer , Dinh Nguyen , Stafford Horne , Helge Deller , Michael Ellerman , Christophe Leroy , Paul Walmsley , Palmer Dabbelt , Rich Felker , John Paul Adrian Glaubitz , "David S. Miller" , Max Filippov , Christoph Hellwig , Robin Murphy , Lad Prabhakar , Conor Dooley , linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-oxnas@groups.io, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-xtensa@linux-xtensa.org Subject: [PATCH 13/21] arc: dma-mapping: skip invalidating before bidirectional DMA Date: Mon, 27 Mar 2023 14:13:09 +0200 Message-Id: <20230327121317.4081816-14-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230327121317.4081816-1-arnd@kernel.org> References: <20230327121317.4081816-1-arnd@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=unavailable 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: Arnd Bergmann Some architectures that need to invalidate buffers after bidirectional DMA because of speculative prefetching only do a simpler writeback before that DMA, while architectures that don't need to do the second invalidate tend to have a combined writeback+invalidate before the DMA. arc is one of the architectures that does both, which seems unnecessary. Change it to behave like arm/arm64/xtensa instead, and use just a writeback before the DMA when we do the invalidate afterwards. Signed-off-by: Arnd Bergmann --- arch/arc/mm/dma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arc/mm/dma.c b/arch/arc/mm/dma.c index 2a7fbbb83b70..ddb96786f765 100644 --- a/arch/arc/mm/dma.c +++ b/arch/arc/mm/dma.c @@ -40,7 +40,7 @@ void arch_dma_prep_coherent(struct page *page, size_t size) * |---------------------------------------------------------------- * TO_DEV | writeback writeback | none none * FROM_DEV | invalidate invalidate | invalidate* invalidate* - * BIDIR | writeback+inv writeback+inv | invalidate invalidate + * BIDIR | writeback writeback | invalidate invalidate * * [*] needed for CPU speculative prefetches * @@ -61,7 +61,7 @@ void arch_sync_dma_for_device(phys_addr_t paddr, size_t size, break; case DMA_BIDIRECTIONAL: - dma_cache_wback_inv(paddr, size); + dma_cache_wback(paddr, size); break; default: -- 2.39.2