From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B04323760 for ; Fri, 22 Dec 2023 15:45:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=flygoat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flygoat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b="CE0wOMBN"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="dNC8d1TP" Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id B8A963200A28; Fri, 22 Dec 2023 10:45:39 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 22 Dec 2023 10:45:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1703259939; x=1703346339; bh=6zFESOLYOJ1DDdmVNp/WKfFuDXzWx4mPHU++2AdAS2g=; b= CE0wOMBNfNkM5XslHkcIoMwIII73hgIWhectOKaBavXEURdejv5SkIt/AmUEIOB2 VtmlXetJnVsIHm3YBTV9/tIHkVigfANDBoYL3zy2lQv3PyH1+106swdLJ6ehpYwV p2ilAP65ViFjfUgwsG2xxUZ9pIY4K3nHxEEIpIvGGDsa4coB7E+So2RrUnCxLiRu n9r4yRdJV8XJCmFK5TAnRLWxdIWJ0ttpO/NNcNlg6xec8M5KuDwhQyHXNpXP40Rb q9EKE8Io399D5T2sWn6g0dUIOpNCHJAzUTkyTP0BrWxa5obBkbo3smNJZsCVCxZm wATeiKpkEee0ifRPtnuv6A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1703259939; x= 1703346339; bh=6zFESOLYOJ1DDdmVNp/WKfFuDXzWx4mPHU++2AdAS2g=; b=d NC8d1TPuieHSHEmdIbIcvr2O+PE//rfojR7jBxJ/WYHaXsWaS4tL3k6Cdc+bRTmb O3CkS+Ks11zxOYFYN0Fcu6DfswY1MvhB2aWCpfT5Hp+mdvNW6bkoAFxq2Nvnj57f eJBNsf7hKi7wVuirD/ylgYjQ2n0PQkGIx+pBwB6ntyDudwUwz/+UdhQKd1QfTtBY MMQF+UdI+L+Vcn1KddVtPQxUmGR2pkHdZQf3Mne+kyxLKdQfWLCVzSI5nqP7aOAF pG6XaUZpwy20qEUCx3Z/Xf9FH9ymSb9jE4fCdjzyiOIgoPh7dc9ToQ08x55/E4mq oFBkEhE51zpAeEFd2P1tQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvddujedgjeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddtvdejnecuhfhrohhmpeflihgr gihunhcujggrnhhguceojhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomheqne cuggftrfgrthhtvghrnhepleeuffehheegleeuvdelgffhueekjeetueevuefhffdtgfeu hfeggfeukefffedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 22 Dec 2023 10:45:37 -0500 (EST) Message-ID: <7bc138f7-d5e9-471a-ae82-d6c490645623@flygoat.com> Date: Fri, 22 Dec 2023 15:45:34 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/1] riscv: set ARCH_DMA_DEFAULT_COHERENT if RISCV_DMA_NONCOHERENT is not set Content-Language: en-US To: Maxim Kochetkov , Conor Dooley Cc: Christoph Hellwig , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, robh@kernel.org, mpe@ellerman.id.au, aou@eecs.berkeley.edu, palmer@dabbelt.com, paul.walmsley@sifive.com References: <20231221185152.327231-1-fido_max@inbox.ru> <20231221-discount-decade-e306e5878c46@spud> <20231222041428.GA2803@lst.de> <20231222-outburst-spoiling-75082a7826dd@spud> From: Jiaxun Yang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 在 2023/12/22 15:38, Maxim Kochetkov 写道: > > > On 22.12.2023 17:54, Conor Dooley wrote: > >>> etc..) do not have this feature. These devices will use value from >>> device_initialize(). And we have no possibility to change >>> dma_default_coherent value by disabling ARCH_DMA_DEFAULT_COHERENT. >>> Moreover, changing dma_default_coherent from false to true may cause >>> regression for other devices. >> >> How can there be a regression when dma has been coherent by default for >> the RISC-V kernel from day 1? > > Before ARCH_DMA_DEFAULT_COHERENT patch dma_default_coherent was used > unassigned as "false" in device_initialize(): > .......... > #if defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE) || \ >     defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU) || \ >     defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL) >     dev->dma_coherent = dma_default_coherent; > #endif > .......... > And now it becomes "true". It may change behavior of other non-DT > drivers. I don't see any problem here, default is default. Actually leaving those device with  dev->dma_coherent = false is risky, because we can't guarantee underlying cache flush functions are here. If a non-dt device do need to override it, it should be done in arch_setup_dma_ops. Thanks - Jiaxun