From patchwork Thu Jan 16 17:42:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Fontenot X-Patchwork-Id: 13942076 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 CBF9CC02183 for ; Thu, 16 Jan 2025 17:42:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 445AC6B0082; Thu, 16 Jan 2025 12:42:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3F5736B0083; Thu, 16 Jan 2025 12:42:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 26E6C6B0085; Thu, 16 Jan 2025 12:42:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 071B76B0082 for ; Thu, 16 Jan 2025 12:42:32 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 8C6FD1A10AB for ; Thu, 16 Jan 2025 17:42:31 +0000 (UTC) X-FDA: 83014034502.18.A537D22 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2056.outbound.protection.outlook.com [40.107.93.56]) by imf25.hostedemail.com (Postfix) with ESMTP id 655EDA0011 for ; Thu, 16 Jan 2025 17:42:28 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b="v9JiLU/4"; spf=pass (imf25.hostedemail.com: domain of Nathan.Fontenot@amd.com designates 40.107.93.56 as permitted sender) smtp.mailfrom=Nathan.Fontenot@amd.com; dmarc=pass (policy=quarantine) header.from=amd.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1737049348; 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: references:dkim-signature; bh=e87qt5mvEeC6IcvDEF0PTvVEApLs341171Qddy0VhRY=; b=cywR4BKQR1Qz+d6TkRWbSnJSXZYoVt0ACPWl2rjxsYI1cDiI9JogShDbv4JWtSWHV6O1VV Blz5LngJ4b/ovdfC/UxVK1tAp5b2ClZreIjZ0rOrROHVCkgNXAsVTv8UZbE4ygseu2O9XK /+djZPeycu7s1MpyKXB5NpgK1te5L6U= ARC-Authentication-Results: i=2; imf25.hostedemail.com; dkim=pass header.d=amd.com header.s=selector1 header.b="v9JiLU/4"; spf=pass (imf25.hostedemail.com: domain of Nathan.Fontenot@amd.com designates 40.107.93.56 as permitted sender) smtp.mailfrom=Nathan.Fontenot@amd.com; dmarc=pass (policy=quarantine) header.from=amd.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1737049348; a=rsa-sha256; cv=pass; b=7im/rM1RnRfT6AdvPEc3vo7R3mLur9jiOp6W7xi6ngKInbyiFqLPmchQjEm+kkBoNPWzRo LlVY2LQHX3vnDawO1vIL6M6AFozEGXdTIPhCPbgP20YfqyJs2VFAkJkwg4fbPMNzMobPRA jOJbXR3CDmUTxfyZYzzeYq/kININ1fI= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=B4UsKtJWR1OgkkOu0pUvz+znVcEY7fVjrsls+G8CRcUaVaSUCGSbWTiWdCqsYXf2s8Mox/c+MvAqzdCY2i4Y3+9aQb+J9BMaD0p2zNjpYQwcH9+OZum6hqnfTbYUQ9K+kq2lIvRXbH9NXHmiHnESDg4/XxfWL55GZwoJFETYGYS+GGNOV/Pbrkme22DfhOByo7sQDJyY38Bc6FWoklve4M8KbPtbdvZDx6fefzVVOaq676M5o1lXkJ1D2mcO83O8+yYa/ZFpAon04aQlkwO9zUF8hkqv7B0k0rs01UbZKHPPcVKlOnskJJCUpFGZGqqg9faA0COZX/6SQMt7QdIMOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=e87qt5mvEeC6IcvDEF0PTvVEApLs341171Qddy0VhRY=; b=RbNsxPD9qk+h5kiRalDDHa2WstrhVofvF+aamVyM+9oDu0kiHqcw0sI0hzBmtpY84AkR+pKCzVLn20ygObvGSUK4R2ZOETl+a/JEtlKS+7fLrtAfkB0Jw1gmhLgXzAbfjBNr/okj51o4i7Wdo72odQVDeWeeoFau7C0+zTLGBvOU+KsbM45pnlJS4jdxw4Lh8X4kUiQxIdya9U8ebdKieqHovSXat3JLpgZOj8vkomlMZzcYOO0bNh2pjM3QBfP1Ow3li7EpTVNRBZnW0wsfYr8qd39EN4AFmhfiE9ioVwQlkujX16IwYAmXCLmoa43T2BM7g+oxo2Nb1D68un/qxg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=e87qt5mvEeC6IcvDEF0PTvVEApLs341171Qddy0VhRY=; b=v9JiLU/4JHNQ/Frw8DmiOrTtcqenUk7BE63P32EF0SWFcUbYy/nDWnZvYQSGV3Y3jkFmHRPRUndFCpyfa3mb1Tpq8F/ZkhCR1dy2bpTXePJCC+VnkUiqqGTUrr/1dX54V1eG0OyRe3wDm+2QMRawGv7it+Sp2b+aSMvC5TrdZH8= Received: from BLAPR03CA0078.namprd03.prod.outlook.com (2603:10b6:208:329::23) by SJ2PR12MB8134.namprd12.prod.outlook.com (2603:10b6:a03:4fa::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8335.17; Thu, 16 Jan 2025 17:42:24 +0000 Received: from BL6PEPF0001AB74.namprd02.prod.outlook.com (2603:10b6:208:329:cafe::96) by BLAPR03CA0078.outlook.office365.com (2603:10b6:208:329::23) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8356.14 via Frontend Transport; Thu, 16 Jan 2025 17:42:23 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL6PEPF0001AB74.mail.protection.outlook.com (10.167.242.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8356.11 via Frontend Transport; Thu, 16 Jan 2025 17:42:23 +0000 Received: from AUSNAFONTEN1.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 16 Jan 2025 11:42:22 -0600 From: Nathan Fontenot To: CC: , , , Subject: [PATCH v2 0/4] Add managed SOFT RESERVE resource handling Date: Thu, 16 Jan 2025 11:42:04 -0600 Message-ID: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB74:EE_|SJ2PR12MB8134:EE_ X-MS-Office365-Filtering-Correlation-Id: 2ee84a66-3546-4d7e-c542-08dd36552289 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: h7+cPoBTlKF8sZVJgnNsowQEIfQoW0s6P7+K85XlOqeOPXhaI8HTDgkyCzRmFBLHpbXqJVhTmt9W0FsSqZ3y3WYBmUnYQICoVKglHzUAfNSlAjHsm5xot0NKD7fp7W5aQ+CDhh3XUlsCmL+8OaFihFMkuyoZdC0wF/9TQEzc50IqlRGpRNvDitUTyZ/0pLuUa4kZAwkkgZ2tplmwyr43+d5a6A5vLMMS/RGV3FMtgnCEbsrWyL8EPetbVq3UxNBpDi/o/3s9l0vn5XgfeGWIO7kqH/OSbxltKNLNf5uK1flLYAYSPg+/SsDhYSkMwBDwFDtrpyi+Z/q2LVMwIvegTI87FmiZ7S7IRU8nPUGjmASf00NNMfQp4SbRqD/urqk7JvudRcLPM51RgVFJBXTxkfmCW9gJp25uF3AIbYrEVqb/G1bCdgXqLhDAQzcPFQEfWwqgifrfQ2+EgYLChV+g0GyHKY/D1FButxM6IMWV5MPNeh3zoaAeP50Gcuwv/cHezPPgmK7QyUjMvVcdfj6G8h/kMNXvnGA070kyOSdTLx4/VK3KhK8z6dqdvs0efydqpQ3kxft0kdMZRZjdOiwb5MSuGkWyOem4ip2WoA8oBkfHoOBk08S/Z0Z+I5PFMFuYcoMh+Jzt/vDY2P1/oU8TbcrmJswdf+8WEO4gs0MWPVRalAhrUYd52kWEs6FKi0oVcxYae0BzSy3CFt4fV0JdMIaKZjiDvZpYOIcoqRC4rXbDUfkoj6+B1mRe18JlYe9rV8KojyHgUMsVoicr+B0lNymlzfW3pgVHkS9Va3G8dCbGO4HyYQsovM0GzhuJ8Us6gbRgz3Q5ywLpl0O5wJAd5bRD6wfQ96Qa6E0m75jm8MlWHGQ7S6HXX7ylhS9LeCor3O/ki1nAiSgktRIyfxtCbRkxuWAsThL8JPtoOvo/etHLu1Xa0ht/ReJGGb0CDEgMGmXJudR7f+qUYo7IQ83+gUag7V8K1hAHLS0blg6YeYv5+Kf5YKXXBnN3V9yfDeeeP+JW1Kqyz5l3EUbwZxkAupMQNG9DUFefjIU9RSazAvdyQCzXcCKVREhzY46wQx/V1bIw4g6MK7UgjMqHxLoc526nKgTvLMcEL5hQW4FLTQPOOCZyrnr3xn935GwAluMG4KfjIvHpB4I8ErZgPI6KPINdszNYIgJsciKBVWtpGNsvO0b7/s2g2rYqXmFnensnG15Wl0rvsWhFyhOoC1OFNg0O6yI5bPYqC5Vw/kJ8Gv17N0kAVt9z12DoPraKHDGh7JZe3lIhUHWrsblMZxAcRWvjJOlJ5zfXMzS94VlOXNlGJZftRtGq+yQ7b6YnIhQUyzMj8FBxHXjUHbKOhsnbD7FBpxjzEjLjzYz1QYR6fGnQE7rK8YhV6tF5zmTway4VqMYIzkTcDhjGvtB5hCevRMzgR1iyokNYQ/Xzv1idgjqvpvbe6D1eXK3lFt2tW9AeqqobtMhsXbn+/n3clxhT+VoHaNEXIs6GS7hbBs89/mU= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(36860700013)(1800799024)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2025 17:42:23.5271 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2ee84a66-3546-4d7e-c542-08dd36552289 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF0001AB74.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8134 X-Rspamd-Queue-Id: 655EDA0011 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: idbkh7qrx9n7rqzxhefua4kb81fkysot X-HE-Tag: 1737049348-365030 X-HE-Meta: U2FsdGVkX1+QVVReQtET7xGoL6zu0v+8K62sLGUn4h0J6t1ku+yMNiIW/vM2R7ysAYpd6OiKAtkoI+Bdll9kE3k5bOCdSjtAW9IgP9fYsHQPWo+qwrn0e0ix/kis1xjZYBglOqN+csX5dU7Fe8qSy3+ItKwc0RsabFiEc62hr/0iCk7KwThke3tkuByOAqZ6+rOkhc9fXMzfytVcRzD5eumWet2K0yn1ULlPjvf0yTXAJeU5jP2BJLEnM4jIJ43Vfg2Y453QJlvVuix6Fx6c/7/T2SO9Ku2ptEjfjiqREEpkeqmrmCyzj9emUXkfrzQRpRLgYuMA/6wMeuyBw7Wms1OFmMLJJafTHrv3NU8N/AivJJY5K/JS3uRqEYn5VWK8kcV8BPBfSEVzwkbV2C/qqA8YuMIbjYMKexTX2XAwOvTiCIMPut9ZUdS6o9M2dWrp4NDrEku6gKViZ254np8e4zufV5i1ZI4hGWYUPuCgNByola/XrNCvzF306dRr70MOiZ87NvHVuSpqkjOchdcMivcdgHDS8sw8NnqVoK+iqQOJ15GRxuEp4qkGSTuvPKhN67fiEycv+0rFabVVH96NkbO9Z324AJhWEL7e1TgBl7Kf1EmgdkP06AhX9AisB5zoYXLYvByoBf3Bk+mlIwL+W9bvyrOxHYPE147PEL+FfHbYw1sfjA/Dfzx71EiPH6jRcTLYXuvZ8QPJbpZpPMucCUrMywUIc67RvuJE00WUpcrzN1v7BFrZ7HswFZbLwESgkqlVpIOjS0g+v+NFkH+BXLtXKWejgZpW9+aKdXMnJBj7JnLjxOBn4dKcZG089d76tcoNQlE3s/6Coc9hM4ROa8UcDQPoZQinrDPICNffHG5QOIwDC5FLv1XwVSLXB7DltGUGLFMdeHFp8RCWB+y69TPz5yGgwHoeGUtaPOv9hj00auk3OBU8H5OrhbiFlAKzOBooE8SJ6yLnJ/TEmoc AkzQpxAj 3XK3LeI1Es8vmxvkX8ZTO/clp3yvDqQKVbOtCTIP/X+Ju53yUIt+tUp/ber3c77lTUTolTuAOo0IYQgHUdyhX/nUIIgWaK270heXpnEKNhiXdJJFgHzVtct6VmgDF4IG7erK6LpRXKCr2/gNqX9duwGaLHh+iHWfnSUSlSXc17sP0m4r+xZuWvPopQzcZ7ehFV25OaHIId7X+ughSSaRMC8F2fbGVwqyj1TzPewtB3RrXfYyS5exchajzfUVpWEpNIGIe8nmlBRnKXSzD0ZsnElM8QBDs6deedaGGqnurkYduXl0i5HxKpZpSiyMoeNPbO1ce24TMt68dKs0JbLhB0E8NYUi0oNxcBFme0Z2rLjJaX95Uwdan7L78ot1r+yWAhI9DjUmfzh+Y42tNki1udyPqk3oehklJ/8D0lBnWPseu0YME7F3bIO0fbqUEnh3zz+sj6H/qlOu/HQ+kux8dbiLFwg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Add the ability to manage SOFT RESERVE iomem resources prior to them being added to the iomem resource tree. This allows drivers, such as CXL, to remove any pieces of the SOFT RESERVE resource that intersect with created CXL regions. The current approac of leaving the SOFT RESERVE resources as is can cause failures during hotplug of devices, such as CXL, because the resource is not available for reuse after teardown of the device. The approach is to add SOFT RESERVE resources to a separate tree during boot. This allows any drivers to update the SOFT RESERVE resources before they are merged into the iomem resource tree. In addition a notifier chain is added so that drivers can be notified when these SOFT RESERVE resources are added to the ioeme resource tree. The CXL driver is modified to use a worker thread that waits for the CXL PCI and CXL mem drivers to be loaded and for their probe routine to complete. Then walks through any created CXL regions to remove pieces that intersect with SOFT RESERVE resources from the SOFT RESERVES before adding the SOFT RESERVES to the iomem tree. The dax driver uses the new soft reserve notifier chain so it can consume any remaining SOFT RESERVES once they're added to the iomem tree. v2 updates: - Add config option SOFT_RESERVE_MANAGED to control use of the separate srmem resource tree at boot. - Only add SOFT RESERVE resources to the soft reserve tree during boot, they go to the iomem resource tree after boot. - Remove the resource trimming code in the previous patch to re-use the existing code in kernel/resource.c -Add functionality for the cxl acpi driver to wait for the cxl PCI and me drivers to load. Nathan Fontenot (4): kernel/resource: Introduce managed SOFT RESERVED resources cxl: Update Soft Reserve resources upon region creation dax: Update hmem resource/device registration Add SOFT RESERVE resource notification chain drivers/acpi/numa/hmat.c | 7 +-- drivers/cxl/Kconfig | 1 + drivers/cxl/acpi.c | 26 ++++++++++ drivers/cxl/core/Makefile | 2 +- drivers/cxl/core/region.c | 25 +++++++++- drivers/cxl/core/suspend.c | 41 +++++++++++++++ drivers/cxl/cxl.h | 3 ++ drivers/cxl/cxlmem.h | 9 ---- drivers/cxl/cxlpci.h | 2 + drivers/cxl/pci.c | 1 + drivers/dax/hmem/device.c | 14 +++--- drivers/dax/hmem/hmem.c | 34 +++++++++++-- include/linux/dax.h | 9 ++-- include/linux/ioport.h | 20 ++++++++ kernel/resource.c | 100 +++++++++++++++++++++++++++++++++++-- lib/Kconfig | 4 ++ 16 files changed, 260 insertions(+), 38 deletions(-)