From nobody Mon Feb 9 01:22:22 2026 Received: from mail-vs1-f67.google.com (mail-vs1-f67.google.com [209.85.217.67]) (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 5043721E08D for ; Thu, 18 Dec 2025 17:08:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.67 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766077708; cv=none; b=WidyGF7DbhZRonJ/ZoD89+dgNopnyjA1/X7UU2+Ytr0eYwt+uRNpVIDPxzjh4ed8qJayperxn3MgKKxY1Ktp5ouUZV6Z2rAYFGvT08xIuBI4Gz45gdBVZFiAhzgLwCLhXjNbOGcgHku4GiFIhOMCOLsez9zdOBsL9Sf6q+MCd8k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766077708; c=relaxed/simple; bh=8ye9FD0BFmVlW+0teHeZBRRFLyYOXqRaeSCCyvdA6iQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=eEs0fsCiNpL4h9eVMh94Gd8VsyW+mr0Eyuyf1RhtP38OufZuXcq+AyYHXF3AdvGwOjJCfNwUTJ8EJJRBTvwnq/YDPuueCwqvsNO3XT0h+IMxRnjhWxXsafnCeUzg8Usnj0fC6PA30J2P2bwK0LoNmzVbqTMj2cKxMVJ3DuDfExg= 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=ssLttwpL; arc=none smtp.client-ip=209.85.217.67 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="ssLttwpL" Received: by mail-vs1-f67.google.com with SMTP id ada2fe7eead31-5dfd2148bf3so263887137.1 for ; Thu, 18 Dec 2025 09:08:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1766077705; x=1766682505; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=4Ya4unRoujhVC5tGQqPhGTBiLoZbxvuuVtCstkzd5+M=; b=ssLttwpLcnlzjVXrr+dQDTqJfXF3X+Ro3uMaia9IJB2PiRkn1mv+LcGpVhvtd+gkR8 9OGyuRReXTviKVbj+32ofb9RuwFLPkclD7rXvfo9ZZyM8llVrMoH2vw/5lP6lB076kiz XEb2QFgSo5eGzDYqMWFGNcf1ueuK7v9OvcFvkn6BMRkBcNEaKjm0PT05x5pZzUZt/T32 VPFtBOfH9EPgtfSAJcidDwkb6RkJzUBjjzBddqiG2JO95II0riYO2xgeJukh1bp7x0Jk O6KmzqiIkZhEoDdbXfBSX0//rQ2hPiWIKwUX9rgBCZsd94MSSKZWbaS2+xc01kPAcEkq K2CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766077705; x=1766682505; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=4Ya4unRoujhVC5tGQqPhGTBiLoZbxvuuVtCstkzd5+M=; b=I/xsXteGft7tlWxhS+wFavwsqwCvUxHTz5Soa1E3PFJIAcYP/C1y2wsDTw0oKBHvSM vZ+C3JQ9FvPF0fNiLRYDFQpBAlYyBB9WkbVhlR+kAywzO6MHpm8M2ujIVxiXLcpgB7km mF89/oMUsNOwwA6/v2fF6vaLd+93a4/Ug3zVOdHM0YBFQQmjJquJs/3Xqr8xjYY3W+qV YDmIDA/jEeXbkICKONSwQazFvk0zl+4aIAWVbYYezcFXcJiMjzlJ+MkNUlRaAS6m1epV MsXB3iGPX39GpkXj8LlL+ENxu0KUb1r1w7fdprOK/MsRxCoMx5lfam8Ed8ZjHqydf4Ia sa/g== X-Forwarded-Encrypted: i=1; AJvYcCUKE09zZ/pNuJxq42E44HFBRbPeD+uOw4VvnFE6xGvUHE58sLrU88f7p5DoC/3MSBTSQNHkf+yse+eY1mc=@vger.kernel.org X-Gm-Message-State: AOJu0YyLNph4FP0VuUZkPNMN5sBK+ZfPKOgnW/YEwZtWDC0ZzfhlCnAD T+eu3SY9IqeEiaiyct8XqNiBDad2nG0NbTAuvAPRGYCChL0anoiCkorcElrBcq7pVxc= X-Gm-Gg: AY/fxX40jdvFK5YBni9MuDPNef9IyY4N+I0BCiQgk2DZWmLYyfxCTk9brZCjpRiEnaJ yYMyMkvc168Nq8oF54ohIsmRKvfrdhIjHg9eoqTFctPwd97KZvNfe/n2/dSr6TktDUkHSNNzHD0 efK5CiRJuGvLz+lHSOCUvMUiUmMSdxvxWUDDhQxN//J0UCZtDA/TkgKsM2ndczZ6VeAFiLuIixC lpgFs/+YDPIbgI17e8jQtY8mDQZQouGYuMcdh0PwFiSFN6Fiz+ojdBO7gOvwJnf2BJ+iueAAozn ROKr+ZnOm7O5DmJ9iYDKDHWhSqhGqVaOrkxMFjD3lZlbqPlPjIanH2DHUOuxXgFx5A2fF61xj/V cgiQN2cKfAdB8OdnpLaB0HDZbvNNHY4pF5hqbKNNC8jyEBjPNdMPtNQtl+5WGrhVcXNQsLHPhiX lXPFw/MIs0lj7h8a06AqTmUB3gqYXrSTEPYrTsu2RJYm8pUvmHkCUGX/uN6VE3XwVk4nSJ8vyJq tUsEVLFsva56w== X-Google-Smtp-Source: AGHT+IFSHbw0chfOWEQxtTLWjVKiGVd/5ep5H3OHMkfwYCMbPQeVBTd2RA/79NAFdzsJerniQ+4zzg== X-Received: by 2002:a05:6102:3e84:b0:5db:cf38:f4f3 with SMTP id ada2fe7eead31-5e8277cde55mr7853764137.28.1766077704903; Thu, 18 Dec 2025 09:08:24 -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 6a1803df08f44-88d9623ffe8sm222186d6.12.2025.12.18.09.08.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Dec 2025 09:08:24 -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 Subject: [PATCH v2] Documentation/driver-api/cxl: device hotplug section Date: Thu, 18 Dec 2025 12:07:47 -0500 Message-ID: <20251218170747.1278327-1-gourry@gourry.net> X-Mailer: git-send-email 2.52.0 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. Signed-off-by: Gregory Price Reviewed-by: Jonathan Cameron Reviewed-by: Randy Dunlap Tested-by: Randy Dunlap --- v2: Jonathan's clarifications and diagrams. Documentation/driver-api/cxl/index.rst | 1 + .../cxl/platform/device-hotplug.rst | 112 ++++++++++++++++++ 2 files changed, 113 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/device-hotplug.rst b/Doc= umentation/driver-api/cxl/platform/device-hotplug.rst new file mode 100644 index 000000000000..617e340bd556 --- /dev/null +++ b/Documentation/driver-api/cxl/platform/device-hotplug.rst @@ -0,0 +1,112 @@ +.. 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). + +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 will 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 has +sufficient 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 +-------------------------------------------- +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. + +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. + +To support memory hotplug directly on the host bridge, or on a switch +downstream of the host bridge (but not contained within a CXL memory devic= e), +a platform must construct a CEDT CFMWS at boot 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