Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1234539rwl; Wed, 29 Mar 2023 14:52:39 -0700 (PDT) X-Google-Smtp-Source: AKy350ZfiWN3iNtKCNgEozQUIYx9q42XA+BLBjcJf1emBw+dOGH9FTbm0UI9phhPsxFRehpt20PI X-Received: by 2002:a17:902:e485:b0:1a1:cce7:94ed with SMTP id i5-20020a170902e48500b001a1cce794edmr15352756ple.67.1680126759042; Wed, 29 Mar 2023 14:52:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680126759; cv=none; d=google.com; s=arc-20160816; b=ui59cTVuMKkd8Tm4JD6wI/lAn1jYwL9tCJzQgshx8x1BrcGnEnFJ0GcYJd1pF4nE6R HGlk2rkUs5phCogu1MktUt287X3aeQlJYyrL9zWQTmuNRsJfh2UN2jQAgjB8DZhclVvF KPFxiPiaPV794AVkSIYQaZctpi3fusF7KG/HgIpLNeh4u6AHh53M4PEfwkc+AnB3E9f2 H7IqgmJQfHUbp37acYHA3D4AClSao+unKX0rK0SSEDp2iyHUMbs9WuvO5P5Op2Q1c0WZ xrEU07/FXfcdtDfShOC04DW26L0VhP0ei8O4M/3G4ffvosdpiRyiMa5UWPl+ScOq2zFD g9Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=mR/Zj1PB00aaXey9QznQEyL9cgsnbEviFfaDBojU/PA=; b=PvHpnqzQ84uqSzIPgyIEBOuKkW9o0S5//Y2XuNzuoMnPmoKu9gIsOB98XMAyLmYK4s GbuOHbySUntFjDkkLgoXjuJ6cfp5I3JUtWEJTxIuX1xiEm0zk/49Vbm9dq3ctXL64bDX EGzspi/wfDTzq7gPAqvU2mQiyMtnBm4Ucj25nmU5TB0yS3Dvlq5HUFWcDxjwvh9J3XE+ 5KOE4DEvT1qFfN4Kr3X8/r6flw1EaZPtZmMA3MF5NjP33H49pn4r0vElEpu/Ddo/5ix5 Tq0dnTYoR/eMArT3mHYzsJ+sA3KbbJrGX0rVnnTEw6YuZ4MHanHA9BQ5H2OkqIhzr5i1 p4nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@jrtc27.com header.s=gmail.jrtc27.user header.b=X0RSiXgH; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j1-20020a632301000000b004fb7e7ef77fsi31946948pgj.536.2023.03.29.14.52.27; Wed, 29 Mar 2023 14:52:39 -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=@jrtc27.com header.s=gmail.jrtc27.user header.b=X0RSiXgH; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229674AbjC2VwK (ORCPT + 99 others); Wed, 29 Mar 2023 17:52:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229703AbjC2VwI (ORCPT ); Wed, 29 Mar 2023 17:52:08 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F0DC527E for ; Wed, 29 Mar 2023 14:51:58 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id l15-20020a05600c4f0f00b003ef6d684102so6990762wmq.3 for ; Wed, 29 Mar 2023 14:51:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jrtc27.com; s=gmail.jrtc27.user; t=1680126716; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=mR/Zj1PB00aaXey9QznQEyL9cgsnbEviFfaDBojU/PA=; b=X0RSiXgHE7YkzJiBvPfuECvjvZh/j9OCTlp5vS9G1kUZuHyE1mJThY46uxE8TkBE8F 26YKvU03kRSEEbihp0nG/r6HBhciobPuGf3L9XG5lP7LIGmFx1xuZOCywjcKmPOmTu8N GYJA3eb2b0Q6VlUVpDCKV/9pvTj9LkixTX22pUdw50wCneJbfivXkkSI84dON9P5F9zR aPsg4Jeh3iGHabX4d9hb5dRKHYvbcqGCgHjWCSflhUWkYsO9R2cu9K7Yx5HZpgAK9C+P FR/T+Ct46EkosCoWvECTXbDfM4FfGO3jzQMNS58kzGepVwnhUrHOmPZqrc1qrzv6vlJT efvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680126716; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mR/Zj1PB00aaXey9QznQEyL9cgsnbEviFfaDBojU/PA=; b=u/1rQ0JYlU8xJCNAJHINjrlY/dtUH2urM/NndTwwFUyAN1jXFOouW7u4nxj7w3gt3M 7Np7FygGWu2svg8lZccLKo7BMyEvZ6h2dlnvTfbk+vprSP8FxxqRnMfGDBwTaORrH3FC WNeyPq24+z7ll6S7u3ikHoxqJCy3PwUnZ0MGR4OnDDhdlV22xwQu7cpGnSSpMZ5in6RO WvNwxQfNhXPGgqu2L/6953fR0yCTn3YfoCng9Qzu3xZQ5GUCgbFA145dJG+mX2mEcKTg omcNG9dMBgraMIfh1n7FNtwFp+vyNWufAFeGCE3CYLWIoW+UaRv9ZJeOXQZWJSxR+kyy /h8w== X-Gm-Message-State: AO0yUKVC4nC4T5+QmOlF0pvmNdbiVe++Fay3Gy5qp8c3dPbT/adoUkhj K+30DbsGaXge4HDf9ou4RuQWIw== X-Received: by 2002:a7b:c413:0:b0:3ee:4531:8448 with SMTP id k19-20020a7bc413000000b003ee45318448mr17263952wmi.39.1680126716518; Wed, 29 Mar 2023 14:51:56 -0700 (PDT) Received: from smtpclient.apple (global-5-144.n-2.net.cam.ac.uk. [131.111.5.144]) by smtp.gmail.com with ESMTPSA id a18-20020a1cf012000000b003ed4f6c6234sm3437896wmb.23.2023.03.29.14.51.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Mar 2023 14:51:55 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Subject: Re: [PATCH 08/21] riscv: dma-mapping: only invalidate after DMA, not flush From: Jessica Clarke In-Reply-To: <20230327121317.4081816-9-arnd@kernel.org> Date: Wed, 29 Mar 2023 22:51:54 +0100 Cc: Linux Kernel Mailing List , 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 , 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 Content-Transfer-Encoding: quoted-printable Message-Id: <837F1B2F-7090-4F9F-A894-594ACF6A8DB2@jrtc27.com> References: <20230327121317.4081816-1-arnd@kernel.org> <20230327121317.4081816-9-arnd@kernel.org> To: Arnd Bergmann X-Mailer: Apple Mail (2.3696.120.41.1.1) X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,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 On 27 Mar 2023, at 13:13, Arnd Bergmann wrote: >=20 > From: Arnd Bergmann >=20 > No other architecture intentionally writes back dirty cache lines into > a buffer that a device has just finished writing into. If the cache is > clean, this has no effect at all, but if a cacheline in the buffer has > actually been written by the CPU, there is a drive bug that is likely > made worse by overwriting that buffer. FYI [1] proposed this same change a while ago but its justification was flawed (which was my objection at the time, not the diff itself). Jess [1] = https://lore.kernel.org/all/20220818165105.99746-1-s.miroshnichenko@yadro.= com > Signed-off-by: Arnd Bergmann > --- > arch/riscv/mm/dma-noncoherent.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/arch/riscv/mm/dma-noncoherent.c = b/arch/riscv/mm/dma-noncoherent.c > index d919efab6eba..640f4c496d26 100644 > --- a/arch/riscv/mm/dma-noncoherent.c > +++ b/arch/riscv/mm/dma-noncoherent.c > @@ -42,7 +42,7 @@ void arch_sync_dma_for_cpu(phys_addr_t paddr, size_t = size, > break; > case DMA_FROM_DEVICE: > case DMA_BIDIRECTIONAL: > - ALT_CMO_OP(flush, vaddr, size, riscv_cbom_block_size); > + ALT_CMO_OP(inval, vaddr, size, riscv_cbom_block_size); > break; > default: > break; > --=20 > 2.39.2 >=20 >=20 > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv