Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1170703rwl; Wed, 29 Mar 2023 13:50:56 -0700 (PDT) X-Google-Smtp-Source: AKy350a0iDnu/njrRhQbiXNQIzaxVpIo8AKtJ4wgbp+VrhKRvG9tq4C4dcrKKsR7/iVIcfdITvNA X-Received: by 2002:a17:906:6a8d:b0:933:9918:665d with SMTP id p13-20020a1709066a8d00b009339918665dmr3557008ejr.11.1680123055652; Wed, 29 Mar 2023 13:50:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680123055; cv=none; d=google.com; s=arc-20160816; b=ITlmF9k/kDtFUEHjtdDYKBUXblwdYH4uT9GtrcXDj5usZMcfZBAMvvbkFYwXSEMFdV DlJgiIdAc3DekZTfeim8+DtcaAe1us7R8+MQQqCsP6TRzkWYcB63JUjVYKe1MQTa1gB5 FNCW1Szh4EE7D+qXADhdMaboh6xPBbNVO86/fo5Fh9mdvybBdx9x/eApGiNggx3IzV9h /qs6v3od+PsS8xBwzFaKvqw3yvLMYbe6uBKRXxRw0VWYxCutYoJk0Yts72b5KdDWFDl8 //GnaWZuZM2uBc8DzC/D/taBcVCxxVBIMLqrgVJ5+K0BvRL/xkc+5UhTA7oOdnWyq2X3 mDCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=7fbDt7WPupsHPkDZCUJVH3jrT2jlfRSHBzRZ0FxQxZs=; b=LvP8aYhbbsCpHe5hzA953xJcgwrWddioFOl3/kpx0E/mjhrRlQf5WkeQyOzxPrII8c MStn49XU0Fs/vQRfxgQfegPzq3Rslb5P27C55eN7gv9YhPihDd38GyLiC5HAq9b5cZkU HN+QG1DYqI1qIGxcpGk0rtSmi93IBsxDkBnq5LKER4NP3eLCqbxu4Gsvlg4V3P6JlJNd 56hz0I2g+uhFaVPww3RaxAXRiHEgwcQ7dA01DywHnFms1Lapqhoq6XHdxLWjfBUr8LO9 FPnTFknFTjNoz9W0vD/fus4nuwCR4GQrDpjG66i/C9N0zvDrPH8yTegsyviOilcHJgq+ 4m9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=boCWhpdB; 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 z7-20020a17090674c700b008db13af5641si31093967ejl.261.2023.03.29.13.50.29; Wed, 29 Mar 2023 13:50:55 -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=boCWhpdB; 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 S229919AbjC2UsV (ORCPT + 99 others); Wed, 29 Mar 2023 16:48:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229479AbjC2UsU (ORCPT ); Wed, 29 Mar 2023 16:48:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD3661990; Wed, 29 Mar 2023 13:48:19 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 58B9E61E4C; Wed, 29 Mar 2023 20:48:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0B6DC433D2; Wed, 29 Mar 2023 20:48:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680122898; bh=1FYJm+9Wk+njTFrcUWRvLdevGIDr+W6Tthp7LWzQkuU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=boCWhpdBtoliUn63FbbfND/v9Mp/RWyo9JXf+EnIrqGcts24RG6WSsaX8OyyMGpmR OMhsdzI6wjHZ9L9dRgyM81y9GcdEGjJbQ79P89OVt+ES0GP7Dab665WOCD3VG6YGrA QdNC7Z/6qjDNQcC72DoCALVe17ZlH3sMsJ8P/IOLvgrMuYTNGz+ml1q07Ok7jWvsWU B3at/aLp5IMLfrV1PTn7Moz0cGHMllPHtGc4hbYxsce+5WQaL0vhZbd/zaOLetW4Wx Xp1CXJmoO48d6OQNzqYx6AfUxQeMqIO245DQTnKIpDIYzxX7MyaWN5fbqCYcz99XKE SxWP3/q/5qgvQ== Date: Wed, 29 Mar 2023 21:48:08 +0100 From: Conor Dooley To: Arnd Bergmann Cc: linux-kernel@vger.kernel.org, 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, samuel@sholland.org Subject: Re: [PATCH 08/21] riscv: dma-mapping: only invalidate after DMA, not flush Message-ID: <2668e232-ae83-4576-beaa-08e420236996@spud> References: <20230327121317.4081816-1-arnd@kernel.org> <20230327121317.4081816-9-arnd@kernel.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="kOOpdYQXwAfFVnAo" Content-Disposition: inline In-Reply-To: <20230327121317.4081816-9-arnd@kernel.org> 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 --kOOpdYQXwAfFVnAo Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Mar 27, 2023 at 02:13:04PM +0200, Arnd Bergmann wrote: > 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. So does this need a Fixes: 1631ba1259d6 ("riscv: Add support for non-coherent devices using zic= bom extension") then, even if the cacheline really should not have been touched by the CPU? Also, minor typo, s/drive/driver/. In the thread we had that sparked this, I went digging for the source of the flushes, and it came from a review comment: https://lore.kernel.org/linux-riscv/342e3c12-ebb0-badf-7d4c-c444a2b842b2@sh= olland.org/ But *surely* if no other arch needs to do that, then we are safe to also not do it... Your logic seems right by me at least, especially given the lack of flushes elsewhere. Reviewed-by: Conor Dooley Cheers, Conor. > 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-noncoher= ent.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 si= ze, > 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 --kOOpdYQXwAfFVnAo Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZCSkCAAKCRB4tDGHoIJi 0pCKAQCFyZKqUabYSSJXqqHCLgZcuhg7cae4P41SpPSV+c3z5gEA/c0XOLzsLOMI IgRP+ghvnIZnEAVO3yHmHKYu0MBqmQM= =36EO -----END PGP SIGNATURE----- --kOOpdYQXwAfFVnAo--