From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13414C36002 for ; Fri, 21 Mar 2025 22:32:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 80FBE280002; Fri, 21 Mar 2025 18:32:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7BF67280001; Fri, 21 Mar 2025 18:32:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 68783280002; Fri, 21 Mar 2025 18:32:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 4A6BD280001 for ; Fri, 21 Mar 2025 18:32:22 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 9C19E1407EA for ; Fri, 21 Mar 2025 22:32:23 +0000 (UTC) X-FDA: 83247008166.04.B53D379 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf11.hostedemail.com (Postfix) with ESMTP id 1AB4340010 for ; Fri, 21 Mar 2025 22:32:21 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=oDTGb5ab; spf=pass (imf11.hostedemail.com: domain of conor@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=conor@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1742596342; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=xK9Qm6/xTRU/x1rTDkdKbqtKlovHDKLBQ5YH7f1Z2IU=; b=oJwzSpEG5VVm2zxpuNvNLLEANfwj6bY182Ql3bpIcmDaHsi7RyRmStITBxXXH/yTdBaHFh bEs8sDXJq2MgJRmJA72sNyC7U18/trvos0Ee0A8ywlpgOv3UZdz1aXjwre7QDrPZydh7E5 GpU9xGAXcv+2l/mSClLYQZ41MtLA2UE= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=oDTGb5ab; spf=pass (imf11.hostedemail.com: domain of conor@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=conor@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1742596342; a=rsa-sha256; cv=none; b=4NqK1yvKB/lb3Ha0ERBkdjG9AnQTpJw5F5zAG9G0eZy7NgeclCBGElrnhT8rdeESV/0OAJ 863v7m8/P/i84wYAeZoxThw5R9kVFSznqTRPj/JaXtFFFBqRx9qd3/HkVAa1JgJDfei347 4cKNun7VC5eeNZ893afOcMtXOiu/SYE= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 0634B5C6CD2; Fri, 21 Mar 2025 22:30:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF287C4CEE3; Fri, 21 Mar 2025 22:32:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1742596340; bh=UzLNiQ5Wvn9rKAUANHTjv00uwdzSTTzEUgki6vN47rE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=oDTGb5abR2KDLvK+8ds6skrd6W1UtIQ/hokDvvG5OHnrB5GRHzihjplyW9Dr6mGpr tEFr6YgI0z7nOq6Kx1wY3wBBfL5doWPuT5YcTSDhhAUucE8NvOQMIA0N9ya7UAm4fU Pb3O3ag7abVK/wR4RA8RqfmEbPRIEgpRBdh7dyJtt9VAYOPHFmnSzMGyM2u6cZusYc mWDW9sq91fVXSWYLo2rhrIdcTxgPAzhU0SAyO+t38GtP/8FppDTrHGkR3eLlvoEzoD 3mwDR9Fy85FsneXge0VU8VtdxCaPsGl6+nMjgHrPGVaYbRTWumxuYDjRLg6I5kWrhN Aom54EoL5NaEQ== Date: Fri, 21 Mar 2025 22:32:15 +0000 From: Conor Dooley To: Jonathan Cameron Cc: linux-cxl@vger.kernel.org, linux-arm-kernel@lists.infradead.org, james.morse@arm.com, Yicong Yang , linux-acpi@vger.kernel.org, linux-arch@vger.kernel.org, linuxarm@huawei.com, Yushan Wang , linux-mm@kvack.org, gregkh@linuxfoundation.org, Lorenzo Pieralisi , Mark Rutland , Catalin Marinas , Will Deacon , Dan Williams Subject: Re: [RFC PATCH 0/6] Cache coherency management subsystem Message-ID: <20250321-failing-squatted-37a88909bde2@spud> References: <20250320174118.39173-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="eWBfxz5cC1rG3K4K" Content-Disposition: inline In-Reply-To: <20250320174118.39173-1-Jonathan.Cameron@huawei.com> X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 1AB4340010 X-Stat-Signature: 3khfniirg7ppfpof3rkz5ftpm5swmcgn X-HE-Tag: 1742596341-102388 X-HE-Meta: U2FsdGVkX18UZIMaO+4CASELTmYm25fWUepMe6XBmr6JAN6LnMmR4b23RCA6+NE0EoPqfsuBM5HX5J6THTTbstbA7OaA/J3/i5I23mZyyaL7o6VEMr7uQJW7rUDdSGTDzl/HBr9ikGLBEpSv19P8XcXza09bAIB0/pw9nzPklp3TEvR7GhH4q72WhkFx8wXyq1va3lbTJoIGrjrEGeYElMtgF1nqhIgDVIwgG9dkHcLTRQBOr+JkWTaGf1PjAh6+joz3yuYXXc2L7QuhHvoKzeWCSj1yaYGBxa5w0Z67rtkp8xTV3pv5hz5OUag93eAlT4uVeW1/uF0RUjmBL8BdEMDCWmMLy9YAbfo9hpPIpbjKj9oKfkeZD0l3QRp/zbET8yEHmf6+slrhsLJuHhMkcWPszHodaD3/3DFOQk32lMYCLNVMOF0jGWrvW0YkqSQZvwPVl9QMwYmEJDIb2obG6PrKcrl9DauD8kC5+G1w1f0WGTuChXoI/PabV8bpkeoGPSd3YCUctgm4BF6eUqigxk2ci7FHxva7fWIxDZZ2z7MIqd83nLPMTpm6a3r9HeJunMZJqLUy5geqjzZe/tb3n+1DIE2sGLfK3OdtlIklcBBv9uU0gfdiJIQDC5ZOYPz1gqAIejDN+d0ZEqg8pNotzu3GKFLLqSrZwTQw0CXXLD3gTaoFFNpvClnBxgSKcG0cgt68DIJUEgSC0tvBFZ4GzBJ8I8dD52UksOJMjoObb6ehICwA9J3iYv2W+MwnhBDKuV6FQn2nqPNAk6Ydbnq/fOeHg8aTTdGP+KqePm85e9EFD0xfBg9fBDceXvoMnyluD1TseekvvxD2V4rM0NtWkPukBqVP3APYLQnc2bmn3EH8DLFCRb6XCb7nfomOaEDLpkBaeDxRBBUdqpmqEFJwwsFgmU9lUTUKhE4pWqMYEbKM7rZbuG+Q5wWu5gvzoVyqVu1/PLpF93zyZVbE9N/ u08hNKVa 5gEnXTuocGHYpe7LR+7Lya9VwUQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: --eWBfxz5cC1rG3K4K Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Mar 20, 2025 at 05:41:12PM +0000, Jonathan Cameron wrote: > Note that I've only a vague idea of who will care about this > so please do +CC others as needed. >=20 > On x86 there is the much loved WBINVD instruction that causes a write back > and invalidate of all caches in the system. It is expensive but it is > necessary in a few corner cases. These are cases where the contents of > Physical Memory may change without any writes from the host. Whilst there > are a few reasons this might happen, the one I care about here is when > we are adding or removing mappings on CXL. So typically going from > there being actual memory at a host Physical Address to nothing there > (reads as zero, writes dropped) or visa-versa. That involves the > reprogramming of address decoders (HDM Decoders); in the near future > it may also include the device offering dynamic capacity extents. The > thing that makes it very hard to handle with CPU flushes is that the > instructions are normally VA based and not guaranteed to reach beyond > the Point of Coherence or similar. You might be able to (ab)use > various flush operations intended to ensure persistence memory but > in general they don't work either. >=20 > So on other architectures such as ARM64 we have no instruction similar to > WBINVD but we may have device interfaces in the system that provide a way > to ensure a PA range undergoes the write back and invalidate action. This > RFC is to find a way to support those cache maintenance device interfaces. > The ones I know about are much more flexible than WBINVD, allowing > invalidation of particular PA ranges, or a much richer set of flush types > (not supported yet as not needed for upstream use cases). >=20 > To illustrate how a solution might work, I've taken both a HiSilicon > design (slight quirk as registers overlap with existing PMU driver) > and more controversially a firmware interface proposal from ARM > (wrapped up in made up ACPI) that was dropped from the released spec > but for which the alpha spec is still available. >=20 > Why drivers/cache? > - Mainly because it exists and smells like a reasonable place. > - Conor, you are maintainer for this currently do you mind us putting this > stuff in there? drivers/cache was just something to put the cache controller drivers we have on RISC-V that implement the various arch_dma*() callbacks in non-standard ways that made more sense than drivers/soc/ since the controllers are IP provided by CPU vendors. There's only two drivers here now, but I am aware of another two non-standard CMO mechanisms if the silicon with them so there'll likely be more in the future :) I'm only really maintainer of it to avoid it being another thing for Palmer to look after :) I've only skimmed this for now, but I think it is reasonable to put them here. Maybe my skim is showing, but it would not surprise me to see a driver providing both non-standard arch_dma*() callbacks as well as dealing with CXL mappings via this new class on RISC-V in the future.. Either way, I think it'd probably be a good idea to add ?you? as a co-maintainer if the directory is going to be used for your proposed interface/drivers, for what I hope is an obvious reason! --eWBfxz5cC1rG3K4K Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZ93o7wAKCRB4tDGHoIJi 0qSeAQCDYiitjFXwNZKbbEFUkUXhfIYYuu03HmpuYwBJ0POhpgEAmO04672uw1BL hytebcnudQFH53/qJg2okVO4XHPPLAw= =cvbz -----END PGP SIGNATURE----- --eWBfxz5cC1rG3K4K--