From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 6A082DDC5; Tue, 24 Jun 2025 16:16:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750781813; cv=none; b=I9cb4nNUo4V497nifNhre7hXIqoO2yxrK4+uu1bwaRskNUAwdeP3cvx+dZiY37RYfsqZmt8YXKAe65ISt9L7k+0qb49OLGA24dt1lM77FcsrhYHoPUlNk2H5kthOUm9A35516FTlW+6FFe172+iOjIlgttZ+decO12ZvMH5eRyY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750781813; c=relaxed/simple; bh=8gl1rLZNofAk2fof2YGBHaM5ebdXQZzyZfIQBIqfrGI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Fp2bFpwBNEEfRtMPrenisBzGQ0PYB5K/63zVaBHX+5lDdGUaPyhJo2HdhEcSgdRifmaC9gsF7VKElkSK9g0UQdkf3wpkq/MhW511tkVIIvHwBKRzLXBI574t7e6yVX8a02m1IPuk83NkHU7LuFPMfDygcZ9B6oA/oJLOS9HzSkA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=qW+iT8/r; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="qW+iT8/r" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7092CC4CEE3; Tue, 24 Jun 2025 16:16:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750781812; bh=8gl1rLZNofAk2fof2YGBHaM5ebdXQZzyZfIQBIqfrGI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qW+iT8/rsJkuyydGDGHb8KNzu5Fem+I5+k86517u6RHxYUMT3QX+o7hLK8Qaf+v5P Ucpo6f9iuC5p59VlLBER+lJwCjJ+0excGOnQEkIhR4PdLsSdZSLdxvtsIR8ERIGYJk PdyGDvUBZLGO5mE2WaXTxs/YYp+Tz7zl2Mc5LjeM= Date: Tue, 24 Jun 2025 17:16:50 +0100 From: Greg KH To: Jonathan Cameron Cc: Catalin Marinas , james.morse@arm.com, linux-cxl@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, Will Deacon , Dan Williams , Davidlohr Bueso , Yicong Yang , linuxarm@huawei.com, Yushan Wang , Lorenzo Pieralisi , Mark Rutland , Dave Hansen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, H Peter Anvin , Andy Lutomirski , Peter Zijlstra Subject: Re: [PATCH v2 2/8] generic: Support ARCH_HAS_CPU_CACHE_INVALIDATE_MEMREGION Message-ID: <2025062439-submitter-affection-324b@gregkh> References: <20250624154805.66985-1-Jonathan.Cameron@huawei.com> <20250624154805.66985-3-Jonathan.Cameron@huawei.com> Precedence: bulk X-Mailing-List: linux-arch@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250624154805.66985-3-Jonathan.Cameron@huawei.com> On Tue, Jun 24, 2025 at 04:47:58PM +0100, Jonathan Cameron wrote: > From: Yicong Yang > > ARCH_HAS_CPU_CACHE_INVALIDATE_MEMREGION provides the mechanism for > invalidate certain memory regions in a cache-incoherent manner. > Currently is used by NVIDMM adn CXL memory. This is mainly done > by the system component and is implementation define per spec. > Provides a method for the platforms register their own invalidate > method and implement ARCH_HAS_CPU_CACHE_INVALIDATE_MEMREGION. > > Architectures can opt in for this support via > CONFIG_GENERIC_CPU_CACHE_INVALIDATE_MEMREGION. > > Signed-off-by: Yicong Yang > Signed-off-by: Jonathan Cameron > --- > drivers/base/Kconfig | 3 +++ > drivers/base/Makefile | 1 + > drivers/base/cache.c | 46 ++++++++++++++++++++++++++++++++ > include/asm-generic/cacheflush.h | 12 +++++++++ > 4 files changed, 62 insertions(+) > > diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig > index 064eb52ff7e2..cc6df87a0a96 100644 > --- a/drivers/base/Kconfig > +++ b/drivers/base/Kconfig > @@ -181,6 +181,9 @@ config SYS_HYPERVISOR > bool > default n > > +config GENERIC_CPU_CACHE_INVALIDATE_MEMREGION > + bool > + > config GENERIC_CPU_DEVICES > bool > default n > diff --git a/drivers/base/Makefile b/drivers/base/Makefile > index 8074a10183dc..0fbfa4300b98 100644 > --- a/drivers/base/Makefile > +++ b/drivers/base/Makefile > @@ -26,6 +26,7 @@ obj-$(CONFIG_DEV_COREDUMP) += devcoredump.o > obj-$(CONFIG_GENERIC_MSI_IRQ) += platform-msi.o > obj-$(CONFIG_GENERIC_ARCH_TOPOLOGY) += arch_topology.o > obj-$(CONFIG_GENERIC_ARCH_NUMA) += arch_numa.o > +obj-$(CONFIG_GENERIC_CPU_CACHE_INVALIDATE_MEMREGION) += cache.o > obj-$(CONFIG_ACPI) += physical_location.o > > obj-y += test/ > diff --git a/drivers/base/cache.c b/drivers/base/cache.c > new file mode 100644 > index 000000000000..8d351657bbef > --- /dev/null > +++ b/drivers/base/cache.c > @@ -0,0 +1,46 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Generic support for CPU Cache Invalidate Memregion > + */ > + > +#include > +#include > +#include > + > + > +static const struct system_cache_flush_method *scfm_data; > +DEFINE_SPINLOCK(scfm_lock); Shouldn't this lock be static? I don't see it being used outside of this file, and it's not exported. thanks, greg k-h