Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2776856rwl; Mon, 27 Mar 2023 05:17:25 -0700 (PDT) X-Google-Smtp-Source: AKy350aYX6XQ6MwBTGRTglGQX/IGMRC0OBt6FavxXoXKwfp6EDN41tkKgHQHEPaGmWVFBKbhwI3C X-Received: by 2002:a17:906:5592:b0:878:72f7:bd87 with SMTP id y18-20020a170906559200b0087872f7bd87mr11853811ejp.6.1679919445658; Mon, 27 Mar 2023 05:17:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679919445; cv=none; d=google.com; s=arc-20160816; b=biy2yrsZ2LAJdjelqG7A4f3P3wrkiBR66AURgosSk94lU9DYrml1tDF7BweFq0cntZ opt7qyN3X8LEpbKJ3yeBEYuoK/S74ycEdohILC2j7G/ZQo/K2eQVwK/DTPUOwIwoThLH tc5bO73HqXMntMjQj3qqs4waqx/x9jreYwKec/KW80bO50hO7x+3oyy8ircZHXOAkrLi zTth6tRrBddIkaFYjxeYypLu2BzKMHLR+F/7Df1pKWuTOo8vnKRNgx8S8x60AWdEFaUc CP+hrXHrO72whzW/B5hcuMttF6eYXmGhG0iIgaoEqrK6iGdb6Dj67PdSGnNj7N9PoXxa Al/w== 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=IOekqzjy7jGOx63VYkHdaoc9pHdxNxTZ/tpsyoEladE=; b=bG9lP8s+E4z35d3vOMRgXjdocc94gvCxXijJJStEA6hoouR8cLMo6FfSv+UMpO4Oe2 4A/Box6g50td5vlqG2VrUX1vCkR8eZCMcWscDqcdQJ+JrbhhnKJNegseO/CY0ULYNqyR X1uuL1r5YjF8fze792+IUzbEcub0xCPY4cBOnQLBtm8dcZv7oE4cg2xLy7w3cMmm8aXx EFU40m7s/VnCFnCm2xK4W/ukFbGgKwUYOsuMC02VqmzMrorUimlUyCdg+4Z9JOzfz09z CUi8AKtbBG3SGUY9Zn2wmhdEREJ926kWpfa2ttt6slBZScIRRpDv1d357th2vZphkDUR qgbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=k7yTj16M; 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 y8-20020a17090614c800b009334d9758c6si21621353ejc.66.2023.03.27.05.16.59; Mon, 27 Mar 2023 05:17:25 -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=k7yTj16M; 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 S232887AbjC0MQA (ORCPT + 99 others); Mon, 27 Mar 2023 08:16:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232734AbjC0MP2 (ORCPT ); Mon, 27 Mar 2023 08:15:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A86F4220; Mon, 27 Mar 2023 05:15:09 -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 6C199B8117B; Mon, 27 Mar 2023 12:15:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A790C4339E; Mon, 27 Mar 2023 12:14:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679919307; bh=p+eG9OtxIwlFEHuBl1BynARl6RQHBxG84PbOJSDaMSg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k7yTj16MC4QC0lUkI+OlRgN70GEfUAXZsHUm34awwsfDq+uuBVpGn8XzMpAYzrKep rzfZf9IvuTrt/evwGGuCXfuT5QwwzcXZODB9YgjYpxv0iZgT9rwRfHG1vVFKHMnR80 WkjKXapkPoQqpX0z8bvvlpG0YOBt+p7Spw/IdU0XpPUFOYiASiKd39EeZPyxyEYUJn 9ZY055tF4c7BVKMQhNCmNKfo+NgnV/grwYyrPuAwvgV7tJNlhsepLbNs91InZGtrtI 0UOObEmqhXtHeujJTAybyrsno6jtIGCIZbfee+GXSUa8z2HvG7G/GO5AeAihPvul14 jCOgl+Q3LDa9w== 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 08/21] riscv: dma-mapping: only invalidate after DMA, not flush Date: Mon, 27 Mar 2023 14:13:04 +0200 Message-Id: <20230327121317.4081816-9-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=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,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 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. Signed-off-by: Arnd Bergmann --- arch/riscv/mm/dma-noncoherent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.39.2