Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp892246rdb; Fri, 22 Dec 2023 08:02:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IFCGOlvz/KbWqxhZke1KWUHYE/TT6VrvqzMUq9c02GilWF9QxLFDuhnPn8xFPJnuAdbbTKD X-Received: by 2002:a17:90a:4b4e:b0:28b:de13:c7bd with SMTP id o14-20020a17090a4b4e00b0028bde13c7bdmr939015pjl.13.1703260935420; Fri, 22 Dec 2023 08:02:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703260935; cv=none; d=google.com; s=arc-20160816; b=gSWMjJGN5Gx6F4skqVcR3H36eLb0Pq2v1hLjSdAFdjT8FfhjCJw/rL2ePNjH5O6gJX pl0mJPzJsR1NUSrPu8Twmm7pFh0xl66TSQjid222uy3BQjDeZFK3bhKzpZQ/9afqaDAm cD07AjFJKIVjW3ZbWb6340L0lMSFwQT8T7fqsYt+Ve8PHPM7O/S2XtZmmyEwwJXfD3jy 6oLwabyVSkUy33XgMB0blFdM0DikBagxVNRSq2NcbCEBk6LBLYDrX35Myu/n4vPuizyW RaMqsRzF1fDFgve8dmvhVdWnRoTC+NUU8ThRMeo9hBJB3s76SexUHuz50yUAhyX2Gug8 wHaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:feedback-id :dkim-signature:dkim-signature; bh=M1tjCvjXqFax0LN2CzOpX/zS+U5B5Gyb2YsaY1tLXjg=; fh=Ge1c6b6zx3/vcFsDbDbQh1Sd45cTdKC0G9PbgG+Ordo=; b=AzuZ7ZpUHc1Sv6uAaZFZFrsb6g/dj0UM+MyRu9zYrzzpkjHqFJyemu/O3Y3niq4Btg +c950QnK6WP53RteFSLv58PAZY05ROmTgvTe3p5D8Pg85utWmk1mtXsGMNFSoYTNM5yE BG47quUMwGWQnGne9zGFsfmiOY25hrNCciQdcRXD8CECwSkq7es7Jjw6Eh4awUStLmUZ m2XXSr7ZD4niq38+fdUEVQRSRBh4lL+BzZp8DmxxjXXJHQTOyhZsdzgf3zJaFMm5F1dp Uqz8nBGUy+1r8RLv7q6i9uufYyWmO/89nVrQsQnb6PwSUmReZJitzuUGfxuIiaTbU0zr C90w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm3 header.b=L+wsFcMc; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=kmCx2J0m; spf=pass (google.com: domain of linux-kernel+bounces-9861-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9861-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id q16-20020a17090a065000b0028b62774a1bsi6752234pje.125.2023.12.22.08.02.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 08:02:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9861-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm3 header.b=L+wsFcMc; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=kmCx2J0m; spf=pass (google.com: domain of linux-kernel+bounces-9861-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9861-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 0A177B22EDA for ; Fri, 22 Dec 2023 16:02:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 311D0249FD; Fri, 22 Dec 2023 16:01:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b="L+wsFcMc"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="kmCx2J0m" X-Original-To: linux-kernel@vger.kernel.org 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 694762420E for ; Fri, 22 Dec 2023 16:01:48 +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 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id C5D733200A04; Fri, 22 Dec 2023 11:01:46 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Fri, 22 Dec 2023 11:01:47 -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=1703260906; x=1703347306; bh=M1tjCvjXqFax0LN2CzOpX/zS+U5B5Gyb2YsaY1tLXjg=; b= L+wsFcMcWp8klqBnr9ffs7VxUkRRQCKTQ8vgsURTa4JMmkhBqoq9d/jU0abuWdCC weY8e1lPb3SAO6YGvsyHecxgtIpLv1RDJD+IA+b1nCyUQ2YRYO2NAMFU6t1d/gJH NpXsFVlqWVMfJ//kw6Bp1L2HONJ6qMpuuTJSyVqPPabx2ZDGKTi2u/cwIkU5Q0/Q dyZxJ9JD86iRQNTI+dWtKIaFGeViw6AbrFVjWRUj+6gfowcG64rSKWmEiHCfLtzu R9ek6kC46xjoa4DCG4ez+RjkNkEC1HVPrVoPMj9IcSpJ864txYHqrgIT2ij1LRzL Pb4oBTuF5yvWXOXhJ31v1Q== 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=1703260906; x= 1703347306; bh=M1tjCvjXqFax0LN2CzOpX/zS+U5B5Gyb2YsaY1tLXjg=; b=k mCx2J0mdUsPR3XI8sF9I0GQVzVjKofWu4PcoGChB7wbsfZGwBdEPhzHtZEGpb6xN FcYy9aViZwekcEfZjaqiM8rxYlStkxd24Y17a0FlYjJGdynDZ8j55NXhHx+s1N4A FdH/XohUyLeOo05GqC6Q51Nye/WZGvKYVEw4QMLZxVdQ/ErfddcW1sbKfXyrFTla 43dnPTTzJIDRgXX1XkLGdoioWiT3dRQ9TyXaQynBak8AvcAARt65hQEbOgm2mDb0 W07baEtc2i4T7jWfn1tMTIrsZtvq9dwilUYUqjjbK86tB3jEUh3qJM6pA5Vk9YLw AWgXpgaI3Aw7Q/7au7FiQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvddujedgkeduucetufdoteggodetrfdotf 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 11:01:43 -0500 (EST) Message-ID: Date: Fri, 22 Dec 2023 16:01:43 +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> <7bc138f7-d5e9-471a-ae82-d6c490645623@flygoat.com> <6fe34090-656d-491f-8173-217d20144166@inbox.ru> From: Jiaxun Yang In-Reply-To: <6fe34090-656d-491f-8173-217d20144166@inbox.ru> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 在 2023/12/22 15:53, Maxim Kochetkov 写道: > > > On 22.12.2023 18:45, Jiaxun Yang wrote: >> >> >> 在 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. > > But arch_setup_dma_ops() is called only from of_dma_configure_id() and > acpi_dma_configure_id(). So it works only for DT and ACPI devices. What > about platform_device? Ah I see, that's the problem, in MIPS's use case all DMA capable devices are following platform's default coherency. For RISC-V we assume all device are enabled by ACPI or DT. Perhaps you can override it in driver, but that will make drivers platform dependent. I'll leave this question to Christoph. Thanks - Jiaxun