linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Conor Dooley <conor@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	<linux-cxl@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	Linux-Arch <linux-arch@vger.kernel.org>, <linux-mm@kvack.org>,
	Dan Williams <dan.j.williams@intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"Peter Zijlstra" <peterz@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Drew Fustini <fustini@kernel.org>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	James Morse <james.morse@arm.com>, Will Deacon <will@kernel.org>,
	Davidlohr Bueso <dave@stgolabs.net>, <linuxarm@huawei.com>,
	Yushan Wang <wangyushan12@huawei.com>,
	Lorenzo Pieralisi <lpieralisi@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	<x86@kernel.org>, Andy Lutomirski <luto@kernel.org>,
	Dave Jiang <dave.jiang@intel.com>
Subject: Re: [PATCH v5 0/6]  Cache coherency management subsystem
Date: Fri, 14 Nov 2025 15:57:46 +0000	[thread overview]
Message-ID: <20251114155746.00003719@huawei.com> (raw)
In-Reply-To: <02244119-d6b8-4ef4-833f-b8fba7a73f43@app.fastmail.com>

On Fri, 14 Nov 2025 15:07:33 +0100
"Arnd Bergmann" <arnd@arndb.de> wrote:

> On Fri, Nov 14, 2025, at 13:52, Conor Dooley wrote:
> > On Fri, Nov 14, 2025 at 12:49:58PM +0000, Jonathan Cameron wrote:  
> >> On Sat, 8 Nov 2025 20:02:52 +0000 Conor Dooley <conor@kernel.org> wrote:  
> >> > 
> >> > On Fri, Oct 31, 2025 at 11:17:03AM +0000, Jonathan Cameron wrote:  
> >> > > Support system level interfaces for cache maintenance as found on some
> >> > > ARM64 systems. It is expected that systems using other CPU architectures
> >> > > (such as RiscV) that support CXL memory and allow for native OS flows
> >> > > will also use this. This is needed for correct functionality during
> >> > > various forms of memory hotplug (e.g. CXL). Typical hardware has MMIO
> >> > > interface found via ACPI DSDT. A system will often contain multiple
> >> > > hardware instances.
> >> > > 
> >> > > Includes parameter changes to cpu_cache_invalidate_memregion() but no
> >> > > functional changes for architectures that already support this call.
> >> > > 
> >> > > How to merge?
> >> > > - Current suggestion would be via Conor's drivers/cache tree which routes
> >> > >   through the SoC tree.    
> >> > 
> >> > I was gonna put this in linux-next, but I'm not really sure that Arnd
> >> > was satisfied with the discussion on the previous version about
> >> > suitability of the directory: https://lore.kernel.org/all/20251028114348.000006ed@huawei.com/
> >> > 
> >> > Arnd, did that response satisfy you, or nah?  
> >> 
> >> Seems Arnd is busy.  Conor, if you are happy doing so, maybe push it to a tree
> >> linux-next picks up, but hold off on the pull request until Arnd has had a chance
> >> to reply?  
> >
> > Yeah, I did step one of that last night and will put it in linux-next
> > from Monday. Ultimately the PR goes to Arnd, so he can judge it there
> > anyway.  
> 
> Sorry about the delay on my side. I've read up on it again and understand
> better where we are with this now.
> 
> I think the implementation is fine, and placing it in drivers/cache/
> is also ok, given that we don't have a better place for it.
> 
> However, this does feel sufficiently different from the three existing
> drivers in drivers/cache that I think we should have separate
> submenus in Kconfig and describe them differently:
> 
> - the arch/riscv drivers are specifically for managing coherency
>   between the CPU and any device driver using the linux/dma-mapping.h
>   interfaces to manage coherency using CPU specific interfaces.
> 
> - the new driver does not interface with linux/dma-mapping.h
>   or a CPU specific register set, and as I understand that would
>   make no sense here. The only similarities are that it manages
>   coherency between multiple entities that access the same memory
>   and have private caches for that.
> 
> If we can come up with better names for the two things, I'd
> like them to have distinct submenus. Something like the draft
> below for the existing drivers would work, in addition to
> a new menu that only contains the one driver for now. I've
> moved the 'depends on RISCV' into the 'menu' here, since that
> is the only thing using it today (32-bit arm has the same thing
> in arch/arm/mm/cache-*.S with a different interface, most others
> only have an architected interface).

Hi Arnd,

Thanks for taking another look.

Agreed splitting the menus reduces chance of confusion, so makes
sense to me as well.

Implementation wise I think we have to use menuconfig + bool if we want
to have help and dependencies and then an if block under that.
The syntax for Kconfig always leaves me finding an example to copy
rather than finding it intuitive

menuconfig CACHEMAINT_FOR_DMA
	bool "Cache management for noncoherent DMA"
	depends on RISCV
	help
	  These drivers implement support for noncoherent DMA master devices
	  on platforms that lack the standard CPU interfaces for this.

if CACHEMAINT_FOR_DMA
... drivers here...

endif #CACHEMAINT_FOR_DMA

menuconfig CACHEMAINT_FOR_HOTPLUG
	bool "Cache management for hotplug like operations"
	depends on GENERIC_CPU_CACHE_MAINTENANCE
	help
	   These drivers implement support for cache management flows
	   as required for action such as memory hotplug on platforms
	   where this is done by platform specific interfaces.

if CACHEMAINT_FOR_HOTPLUG
... drivers here

endif #CACHEMAINT_FOR_HOTPLUG

Alternative would be to hope the short text is enough and use

menu "Cache management for noncoherent DMA"
	visible if RISCV

endmenu

I'm not sure if the 'hotplug like' is close enough to all the cases
for device drivers that provide the services needed to implement
ARCH_HAS_CPU_CACHE_INVALIDATE_MEMEGION

Alternative might be to phrase around pushing beyond the point of
coherence, but that seems to be an ARM specific term and would
seem to incorporate fine grained sharing where this interface might
work but isn't a good solution.

Thanks,

Jonathan

> 
>     Arnd
> 
> ---
> diff --git a/drivers/cache/Kconfig b/drivers/cache/Kconfig
> index db51386c663a..8a49086eb8af 100644
> --- a/drivers/cache/Kconfig
> +++ b/drivers/cache/Kconfig
> @@ -1,9 +1,12 @@
>  # SPDX-License-Identifier: GPL-2.0
> -menu "Cache Drivers"
> +menu "Cache management for noncoherent DMA"
> +       depends on RISCV
> +       help
> +         These drivers implement support for noncoherent DMA master devices
> +         on platforms that lack the standard CPU interfaces for this.

>  
>  config AX45MP_L2_CACHE
>         bool "Andes Technology AX45MP L2 Cache controller"
> -       depends on RISCV
>         select RISCV_NONSTANDARD_CACHE_OPS
>         help
>           Support for the L2 cache controller on Andes Technology AX45MP platforms.
> @@ -16,7 +19,6 @@ config SIFIVE_CCACHE
>  
>  config STARFIVE_STARLINK_CACHE
>         bool "StarFive StarLink Cache controller"
> -       depends on RISCV
>         depends on ARCH_STARFIVE
>         depends on 64BIT
>         select RISCV_DMA_NONCOHERENT


  reply	other threads:[~2025-11-14 15:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-31 11:17 [PATCH v5 0/6] Cache coherency management subsystem Jonathan Cameron
2025-10-31 11:17 ` [PATCH v5 1/6] memregion: Drop unused IORES_DESC_* parameter from cpu_cache_invalidate_memregion() Jonathan Cameron
2025-10-31 11:17 ` [PATCH v5 2/6] memregion: Support fine grained invalidate by cpu_cache_invalidate_memregion() Jonathan Cameron
2025-10-31 11:17 ` [PATCH v5 3/6] lib: Support ARCH_HAS_CPU_CACHE_INVALIDATE_MEMREGION Jonathan Cameron
2025-10-31 11:17 ` [PATCH v5 4/6] arm64: Select GENERIC_CPU_CACHE_MAINTENANCE Jonathan Cameron
2025-10-31 11:17 ` [PATCH v5 5/6] MAINTAINERS: Add Jonathan Cameron to drivers/cache and add lib/cache_maint.c + header Jonathan Cameron
2025-10-31 11:17 ` [PATCH v5 6/6] cache: Support cache maintenance for HiSilicon SoC Hydra Home Agent Jonathan Cameron
2025-11-08 20:02 ` [PATCH v5 0/6] Cache coherency management subsystem Conor Dooley
2025-11-14 12:49   ` Jonathan Cameron
2025-11-14 12:52     ` Conor Dooley
2025-11-14 14:07       ` Arnd Bergmann
2025-11-14 15:57         ` Jonathan Cameron [this message]
2025-11-14 16:03           ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251114155746.00003719@huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=arnd@arndb.de \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --cc=conor@kernel.org \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=fustini@kernel.org \
    --cc=hpa@zytor.com \
    --cc=james.morse@arm.com \
    --cc=krzk@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linuxarm@huawei.com \
    --cc=lpieralisi@kernel.org \
    --cc=luto@kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=wangyushan12@huawei.com \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).