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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C95A7CCD1BC for ; Thu, 23 Oct 2025 11:13:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1DE698E0002; Thu, 23 Oct 2025 07:13:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1B4C08E0013; Thu, 23 Oct 2025 07:13:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0A52D8E0002; Thu, 23 Oct 2025 07:13:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id E82CD8E0012 for ; Thu, 23 Oct 2025 07:13:50 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 9D20E1A0AFB for ; Thu, 23 Oct 2025 11:13:50 +0000 (UTC) X-FDA: 84029119020.22.BB64ACC Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by imf12.hostedemail.com (Postfix) with ESMTP id 4A63D4000F for ; Thu, 23 Oct 2025 11:13:48 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=none; spf=pass (imf12.hostedemail.com: domain of jonathan.cameron@huawei.com designates 185.176.79.56 as permitted sender) smtp.mailfrom=jonathan.cameron@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1761218028; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4BOW5hxTfLOmIVdIDox+jTV1yxmuQmFgSZvwUrdXBZ0=; b=7+uhSq/bAWhU1yjVAy/xoPU6g1QRpvCXsPHSUBXHOsr3V68984j6IAweRTLZp/0qU1ceGf 1AbtCXSsza1esA6eUUdcu5k5Li6gsJBHj8xLB2FZMWxja3R7AkeFwArKWPR6fF2v0yTNOU s6OAARNCbVeqRi+LF08sMZTLDfHPM6w= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=none; spf=pass (imf12.hostedemail.com: domain of jonathan.cameron@huawei.com designates 185.176.79.56 as permitted sender) smtp.mailfrom=jonathan.cameron@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1761218028; a=rsa-sha256; cv=none; b=kVgvxnP4C9iCOE6NZ0Ikw895+zbx2eL+502WjJebP7et5ruhzRaiIGzN+X30ONlceORlDO gQ1gmTWK7O2y1JlJ48r7Ry/Ue9+XmJgsdFYGGLX1V37AJDKiGM2O7k7Jrab7FUSlRZSG+q hMShcZ0BHcBn7i9yC049wNmGXP0GRc0= Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4csjx65rM2z6M4gf; Thu, 23 Oct 2025 19:10:02 +0800 (CST) Received: from dubpeml100005.china.huawei.com (unknown [7.214.146.113]) by mail.maildlp.com (Postfix) with ESMTPS id 42B8B140279; Thu, 23 Oct 2025 19:13:44 +0800 (CST) Received: from localhost (10.203.177.15) by dubpeml100005.china.huawei.com (7.214.146.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 23 Oct 2025 12:13:43 +0100 Date: Thu, 23 Oct 2025 12:13:41 +0100 From: Jonathan Cameron To: Conor Dooley CC: Catalin Marinas , , , , , Dan Williams , "H . Peter Anvin" , Peter Zijlstra , "Andrew Morton" , , Will Deacon , Davidlohr Bueso , , Yushan Wang , "Lorenzo Pieralisi" , Mark Rutland , Dave Hansen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , , Andy Lutomirski , "Dave Jiang" Subject: Re: [PATCH v4 3/6] lib: Support ARCH_HAS_CPU_CACHE_INVALIDATE_MEMREGION Message-ID: <20251023121341.0000765c@huawei.com> In-Reply-To: <20251022-tried-alright-752fa98ff086@spud> References: <20251022113349.1711388-1-Jonathan.Cameron@huawei.com> <20251022113349.1711388-4-Jonathan.Cameron@huawei.com> <20251022-tried-alright-752fa98ff086@spud> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.42; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.203.177.15] X-ClientProxiedBy: lhrpeml100009.china.huawei.com (7.191.174.83) To dubpeml100005.china.huawei.com (7.214.146.113) X-Rspamd-Queue-Id: 4A63D4000F X-Rspamd-Server: rspam11 X-Rspam-User: X-Stat-Signature: ogau9ubec9be41ed6recof1rppc6w8rx X-HE-Tag: 1761218028-133563 X-HE-Meta: U2FsdGVkX1+WwNwLbf1txJDjJL6QyNL8aS27AFBNO+wOLJTIDs0uQIFmlV8up+l9ddhatp1vjOKg4K3yDTVbuF3YZ0ftM30YnHsWunD/2VvkQVIcEA+Ewap27BQavqEjZhwPH0Wros6R/Erq3wXchOv3ByPUwyj5zWToI4II0UOk5+OEpqHrVQ72jj1/1ttfzqyDqDZxL7BX8POyCUSlVsNqtL6OTM4b0sroQkfLNJSIc2spLr7XFtBrHI+vtL0a+a+06u8vK1RzJZYrpCz4o95RvkJ+bT5OvyPwlLmY2bkxMklXq6KbeoctNIEwn+7/AhygdRX4IhwAs4+CMK7JioPsLdBj5uE0HIQeUbfDj5aZ0+cR2nPr3YaBZH+7G7mEnAypdfjdoIxdYM8tW9QYQIajw65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org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Wed, 22 Oct 2025 22:11:12 +0100 Conor Dooley wrote: > On Wed, Oct 22, 2025 at 12:33:46PM +0100, Jonathan Cameron wrote: > > From: Yicong Yang > > > > ARCH_HAS_CPU_CACHE_INVALIDATE_MEMREGION provides the mechanism for > > invalidating certain memory regions in a cache-incoherent manner. Currently > > this is used by NVDIMM and CXL memory drivers in cases where it is > > necessary to flush all data from caches by physical address range. > > > > In some architectures these operations are supported by system components > > that may become available only later in boot as they are either present > > on a discoverable bus, or via a firmware description of an MMIO interface > > (e.g. ACPI DSDT). Provide a framework to handle this case. > > > > Architectures can opt in for this support via > > CONFIG_GENERIC_CPU_CACHE_MAINTENANCE > > > > Add a registration framework. Each driver provides an ops structure and > > the first op is Write Back and Invalidate by PA Range. The driver may > > over invalidate. > > > > An optional completion check operation is also provided. If present > > that should be called to ensure that the action has finished. > > > > When multiple agents are present in the system each should register with > > this framework and the core code will issue the invalidate to all of them > > before checking for completion on each. This is done to avoid need for > > filtering in the core code which can become complex when interleave, > > potentially across different cache coherency hardware is going on, so it > > is easier to tell everyone and let those who don't care do nothing. > > > > Signed-off-by: Yicong Yang > > Co-developed-by: Jonathan Cameron > > Signed-off-by: Jonathan Cameron > > Acked-by: Conor Dooley > > I'm fine with this stuff. I do wonder though, have you actually > encountered systems with the multiple "agents" or is that something > theoretical? Yes to multiple agents. There are a multiple instances in the HiSi platform. The multiple heterogeneous agents case is more theoretical today. Similar components for other purposes are heterogeneous so I'd be surprised if it doesn't surface at some point. Our initial internal driver for the hisi_hha wrapped up the multiple instances in a fake front end, but it meant we ended up with multiple levels of registration and it was just simpler to relax assumption that they were all handled by one driver. Jonathan