From nobody Tue Feb 10 07:40:25 2026 Received: from mail-qk1-f196.google.com (mail-qk1-f196.google.com [209.85.222.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 17F3B33B6E8 for ; Fri, 19 Dec 2025 17:06:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.196 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766163988; cv=none; b=FoZBSIScTTSj0GLN3+lHhOFXYXtINgzPNF/ZhSIkYd9FASa8ZinyBHqyGjD3GrTUJJg7zNqo2QNeuwb0Wmq2tY5fDg/gzcp9gcu0dH6tAWG0xbLrHUDuvK2YbzvlTQz7USADlCGbNGhBTNr0P41ZiluVMXs8UcY45n/9oJKSQzg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766163988; c=relaxed/simple; bh=Y+71PUVRfwuvUKxaHdzqE9jx5sqntnX+4UWIz5GKPsk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Irrpo70waPyVJPQc4eYzrZQrOJBbSPBaxlyOPEIDfsWR8Pbmhjy8Feut32budu+16t3U7OHbrJkpeYIkkEGqlZ9lN2MPwyRRblxXh4J3ylFidLTrndSeHpwCsdBQWUfor26CiJKPiDANdKJpJECKPYbz89FaVkL+CFdpUwyxuMc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net; spf=pass smtp.mailfrom=gourry.net; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b=erBE4GC4; arc=none smtp.client-ip=209.85.222.196 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gourry.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b="erBE4GC4" Received: by mail-qk1-f196.google.com with SMTP id af79cd13be357-8b2d6df99c5so294347285a.1 for ; Fri, 19 Dec 2025 09:06:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1766163984; x=1766768784; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ve73z4RK/cYcNMBA2t4ADqsjJbpaVx1NScHqoDm2Vdk=; b=erBE4GC4Inpl1kZlITE3hnD+U9NVUqo5T9x0GfFt0MYjlPcjix1elMFZq9Zqeb533K qXHmpvV7x8ink+nv8aE5UqCDBg5U2KnesSuVee+0u/qcAYN+GN9y9E5tDQKOJLiRKfVE dCZK8HYwq1SWUjC+MkS0M29L8dy3y1xy0pzd3TsE6vnSUUMRPJ+OZnUTPZG0h5PCCKYw F2ZNF/ap51NxMLwqJqB2M7J4K6PrrNC9gLraksGV2gTgezpv8MJgtgTQwi9bytKBa525 4cokFih8UrJlcOHc16NMHiMLjZEb/p9h9tcufttXrkbsJMIElnwBQkpkk6BRT2l05/Ib cAOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766163984; x=1766768784; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Ve73z4RK/cYcNMBA2t4ADqsjJbpaVx1NScHqoDm2Vdk=; b=ln+Dpa9JrdLjnvBF0mbmCc59ZgFj/Qokq6oZF6BJ3FA88O3Z1gzcjJT99e3XeQdO3y geNyOaJR33UhptAGrqTO89EEvpR7iY5zgboq5vBYUZHCf761wHwIaC2FWjj+Ug2/J8Be 8GL4kx9ouj1lEN++oSVbUQwYEovW6FiowaXr8TiA62FziYZ9sbt6IaUo91dcJw1iaLhk i13JtNOZXBiuMUiYq6LqgycUhxEeSbqnSI144eVX4Am9s3Bkz/ekS74UWWT0QU36tap1 vtIJvrySH8xKxu8j6Dlxp+WLKqidz1gmcKEK/OeAC5jT5950x1m1R+DExZunnTs2usfG be1A== X-Forwarded-Encrypted: i=1; AJvYcCVpmIt/OJoM/Weun26FsyhoUqM14oTOmPYx3wILFSyp7Jj3UWC5sa+gvdcBeXpzpv65Y/A0hF/FRs/cJQg=@vger.kernel.org X-Gm-Message-State: AOJu0Yzay9Mj2mjL398kSuuGEDiGrmjDEwUCRjvI8Ew5F4JsfZDuSOTs I4Ch9tr+bXyr+qiBUWRCYgv7RYMSKvG8bajDYiMqL7AQVObIFQipIV8da05w3+nVDTE= X-Gm-Gg: AY/fxX6j/nyYqaNjDyAqRr21bZcR70uqTt1v1DCDcdwtQFo8gXjIjhHj66pLzMG2Ne/ PkskJvYz0FCeo29bF2ijuyfqI1CXKpA/vJp+K/bAM8RPzrqi4SMTnE7CUqKT2xKACAZl0gSViMT f8/Is3RbTWVgByJJ4L+wUqop/x8kY6GrA2+xPf2CSkKImGENRnacnXDC6eeluir5J44fhJJRK4s vT1DHU2p0hhnuMmdOV9oxaNCH7hxnTOyv7/8b28wN3Lz0z60N18iV2DR9RQmioQRjqo61R6YF0a Rlws+szIFsG5+iBD/I1k6PjInaX1pp71MYLIFTRF9+hC7GAlqwiX5RigugIzSVn0Nc4BGrQEx22 ZxsuCGv54YVn/LcKwd8nPB0b93LW4cOWXQCWRLygpEMAUYHNUyDCUmveYmXRsL1/ci4yM8MXbEA l7JevJPDBZTJnBWDf1T3lX+iVQJJ3IdgmJBQzzza+6tBmniLQSUouG/KPUg3LTfqjD3aHAysWZB Lk= X-Google-Smtp-Source: AGHT+IGhL++VzFeCqDT/tB5Cvy1Ps114ykiQjB+fbR/l94srArH+8w2+c687M3sNwAIPyDyiArGerA== X-Received: by 2002:a05:620a:4495:b0:8a3:c4fa:9b5b with SMTP id af79cd13be357-8bee682063amr943344385a.12.1766163983905; Fri, 19 Dec 2025 09:06:23 -0800 (PST) Received: from gourry-fedora-PF4VCD3F.lan (pool-96-255-20-138.washdc.ftas.verizon.net. [96.255.20.138]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c096787536sm223197185a.4.2025.12.19.09.06.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Dec 2025 09:06:23 -0800 (PST) From: Gregory Price To: linux-cxl@vger.kernel.org Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, dave@stgolabs.net, jonathan.cameron@huawei.com, dave.jiang@intel.com, alison.schofield@intel.com, vishal.l.verma@intel.com, ira.weiny@intel.com, dan.j.williams@intel.com, corbet@lwn.net, gourry@gourry.net, rakuram.e96@gmail.com, alucerop@amd.com Subject: [PATCH v3 2/2] Documentation/driver-api/cxl: device hotplug section Date: Fri, 19 Dec 2025 12:05:38 -0500 Message-ID: <20251219170538.1675743-3-gourry@gourry.net> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251219170538.1675743-1-gourry@gourry.net> References: <20251219170538.1675743-1-gourry@gourry.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Describe cxl memory device hotplug implications, in particular how the platform CEDT CFMWS must be described to support successful hot-add of memory devices. Reviewed-by: Jonathan Cameron Signed-off-by: Gregory Price Reviewed-by: Alejandro Lucero Palau Reviewed-by: Alison Schofield Reviewed-by: Dave Jiang --- v3: Jonathan updates, change some italics to bold, add some bits about Linux's expectations for BIOS/EFI behavior at runtime. Documentation/driver-api/cxl/index.rst | 1 + .../driver-api/cxl/platform/bios-and-efi.rst | 3 + .../cxl/platform/device-hotplug.rst | 130 ++++++++++++++++++ 3 files changed, 134 insertions(+) create mode 100644 Documentation/driver-api/cxl/platform/device-hotplug.rst diff --git a/Documentation/driver-api/cxl/index.rst b/Documentation/driver-= api/cxl/index.rst index c1106a68b67c..5a734988a5af 100644 --- a/Documentation/driver-api/cxl/index.rst +++ b/Documentation/driver-api/cxl/index.rst @@ -30,6 +30,7 @@ that have impacts on each other. The docs here break up = configurations steps. platform/acpi platform/cdat platform/example-configs + platform/device-hotplug =20 .. toctree:: :maxdepth: 2 diff --git a/Documentation/driver-api/cxl/platform/bios-and-efi.rst b/Docum= entation/driver-api/cxl/platform/bios-and-efi.rst index 9034c206cf8e..a4b44c018f09 100644 --- a/Documentation/driver-api/cxl/platform/bios-and-efi.rst +++ b/Documentation/driver-api/cxl/platform/bios-and-efi.rst @@ -49,6 +49,9 @@ up without requiring CXL driver support. These platform = vendors should test their configurations with the existing CXL driver and provide driver support for their auto-configurations if features like RAS are required. =20 +Platforms requiring boot-time programming and/or locking of CXL fabric +components may prevent features, such as device hot-plug, from working. + UEFI Settings =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D If your platform supports it, the :code:`uefisettings` command can be used= to diff --git a/Documentation/driver-api/cxl/platform/device-hotplug.rst b/Doc= umentation/driver-api/cxl/platform/device-hotplug.rst new file mode 100644 index 000000000000..e4a065fdd3ec --- /dev/null +++ b/Documentation/driver-api/cxl/platform/device-hotplug.rst @@ -0,0 +1,130 @@ +.. SPDX-License-Identifier: GPL-2.0 + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +CXL Device Hotplug +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Device hotplug refers to *physical* hotplug of a device (addition or remov= al +of a physical device from the machine). + +BIOS/EFI software is expected to configure sufficient resources **at boot +time** to allow hotplugged devices to be configured by software (such as +proximity domains, HPA regions, and host-bridge configurations). + +BIOS/EFI is not expected (**nor suggested**) to configure hotplugged +devices at hotplug time (i.e. HDM decoders should be left unprogrammed). + +This document covers some examples of those resources, but should not +be considered exhaustive. + +Hot-Remove +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +Hot removal of a device typically requires careful removal of software +constructs (memory regions, associated drivers) which manage these devices. + +Hard-removing a CXL.mem device without carefully tearing down driver stacks +is likely to cause the system to machine-check (or at least SIGBUS if memo= ry +access is limited to user space). + +Memory Device Hot-Add +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +A device present at boot may be associated with a CXL Fixed Memory Window +reported in :doc:`CEDT`. That CFMWS may match the size of the +device, but the construction of the CEDT CFMWS is platform-defined. + +Hot-adding a memory device requires this pre-defined, **static** CFMWS to +have sufficient HPA space to describe that device. + +There are a few common scenarios to consider. + +Single-Endpoint Memory Device Present at Boot +--------------------------------------------- +A device present at boot likely had its capacity reported in the +:doc:`CEDT`. If a device is removed and a new device hotplugge= d, +the capacity of the new device will be limited to the original CFMWS capac= ity. + +Adding capacity larger than the original device will cause memory region +creation to fail if the region size is greater than the CFMWS size. + +The CFMWS is **static** and cannot be adjusted. Platforms which may expect +different sized devices to be hotplugged must allocate sufficient CFMWS sp= ace +**at boot time** to cover all future expected devices. + +Multi-Endpoint Memory Device Present at Boot +-------------------------------------------- +Non-switch-based Multi-Endpoint devices are outside the scope of what the +CXL specification describes, but they are technically possible. We describe +them here for instructive reasons only - this does not imply Linux support. + +A hot-plug capable CXL memory device, such as one which presents multiple +expanders as a single large-capacity device, should report the **maximum +possible capacity** for the device at boot. :: + + HB0 + RP0 + | + [Multi-Endpoint Memory Device] + _____|_____ + | | + [Endpoint0] [Empty] + + +Limiting the size to the capacity preset at boot will limit hot-add support +to replacing capacity that was present at boot. + +No CXL Device Present at Boot +----------------------------- +When no CXL memory device is present on boot, some platforms omit the CFMWS +in the :doc:`CEDT`. When this occurs, hot-add is not possible. + +This describes the base case for any given device not being present at boo= t. +If a future possible device is not described in the CEDT at boot, hot-add +of that device is either limited or not possible. + +For a platform to support hot-add of a full memory device, it must allocate +a CEDT CFMWS region with sufficient memory capacity to cover all future +potentially added capacity (along with any relevant CEDT CHBS entry). + +To support memory hotplug directly on the host bridge/root port, or on a s= witch +downstream of the host bridge, a platform must construct a CEDT CFMWS at b= oot +with sufficient resources to support the max possible (or expected) hotplug +memory capacity. :: + + HB0 HB1 + RP0 RP1 RP2 + | | | + Empty Empty USP + ________|________ + | | | | + DSP DSP DSP DSP + | | | | + All Empty + +For example, a BIOS/EFI may expose an option to configure a CEDT CFMWS with +a pre-configured amount of memory capacity (per host bridge, or host bridge +interleave set), even if no device is attached to Root Ports or Downstream +Ports at boot (as depicted in the figure above). + + +Interleave Sets +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Host Bridge Interleave +---------------------- +Host-bridge interleaved memory regions are defined **statically** in the +:doc:`CEDT`. To apply cross-host-bridge interleave, a CFMWS en= try +describing that interleave must have been provided **at boot**. Hotplugged +devices cannot add host-bridge interleave capabilities at hotplug time. + +See the :doc:`Flexible CEDT Configuration` +example to see how a platform can provide this kind of flexibility regardi= ng +hotplugged memory devices. BIOS/EFI software should consider options to +present flexible CEDT configurations with hotplug support. + +HDM Interleave +-------------- +Decoder-applied interleave can flexibly handle hotplugged devices, as deco= ders +can be re-programmed after hotplug. + +To add or remove a device to/from an existing HDM-applied interleaved regi= on, +that region must be torn down an re-created. --=20 2.52.0