요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GPL-2.0
=====================
Devices and Protocols
=====================
The type of CXL device (Memory, Accelerator, etc) dictates many configuration steps. This section
covers some basic background on device types and on-device resources used by the platform and OS
which impact configuration.
Protocols
=========
There are three core protocols to CXL. For the purpose of this documentation,
we will only discuss very high level definitions as the specific hardware
details are largely abstracted away from Linux. See the CXL specification
for more details.
CXL.io
------
The basic interaction protocol, similar to PCIe configuration mechanisms.
Typically used for initialization, configuration, and I/O access for anything
other than memory (CXL.mem) or cache (CXL.cache) operations.
The Linux CXL driver exposes access to .io functionality via the various sysfs
interfaces and /dev/cxl/ devices (which exposes direct access to device
mailboxes).
CXL.cache
---------
The mechanism by which a device may coherently access and cache host memory.
Largely transparent to Linux once configured.
CXL.mem
---------
The mechanism by which the CPU may coherently access and cache device memory.
Largely transparent to Linux once configured.
Device Types
============
Type-1
------
A Type-1 CXL device:
* Supports cxl.io and cxl.cache protocols
* Implements a fully coherent cache
* Allows Device-to-Host coherence and Host-to-Device snoops.
* Does NOT have host-managed device memory (HDM)
Typical examples of type-1 devices is a Smart NIC - which may want to
directly operate on host-memory (DMA) to store incoming packets. These
devices largely rely on CPU-attached memory.
Type-2
------
A Type-2 CXL Device:
* Supports cxl.io, cxl.cache, and cxl.mem protocols
* Optionally implements coherent cache and Host-Managed Device Memory
* Is typically an accelerator device with high bandwidth memory.
The primary difference between a type-1 and type-2 device is the presence
of host-managed device memory, which allows the device to operate on a
local memory bank - while the CPU still has coherent DMA to the same memory.
This allows things like GPUs to expose their memory via DAX devices or file
descriptors, allows drivers and programs direct access to device memory
rather than use block-transfer semantics.
Type-3
------
A Type-3 CXL Device
* Supports cxl.io and cxl.mem
* Implements Host-Managed Device Memory
* May provide either Volatile or Persistent memory capacity (or both).
A basic example of a type-3 device is a simple memory expander, whose
local memory capacity is exposed to the CPU for access directly via
basic coherent DMA.
Switch
------
A CXL switch is a device capable of routing any CXL (and by extension, PCIe)
protocol between an upstream, downstream, or peer devices. Many devices, such
as Multi-Logical Devices, imply the presence of switching in some manner.
Logical Devices and Heads
-------------------------
A CXL device may present one or more "Logical Devices" to one or more hosts
(via physical "Heads").
A Single-Logical Device (SLD) is a device which presents a single device to
one or more heads.
A Multi-Logical Device (MLD) is a device which may present multiple devices
to one or more upstream devices.
A Single-Headed Device exposes only a single physical connection.
A Multi-Headed Device exposes multiple physical connections.
MHSLD
~~~~~
A Multi-Headed Single-Logical Device (MHSLD) exposes a single logical
device to multiple heads which may be connected to one or more discrete
hosts. An example of this would be a simple memory-pool which may be
statically configured (prior to boot) to expose portions of its memory
to Linux via :doc:`CEDT <../platform/acpi/cedt>`.
MHMLD
~~~~~
A Multi-Headed Multi-Logical Device (MHMLD) exposes multiple logical
devices to multiple heads which may be connected to one or more discrete
hosts. An example of this would be a Dynamic Capacity Device or which
may be configured at runtime to expose portions of its memory to Linux.
Example Devices
===============
Memory Expander
---------------
The simplest form of Type-3 device is a memory expander. A memory expander
exposes Host-Managed Device Memory (HDM) to Linux. This memory may be
Volatile or Non-Volatile (Persistent).
Memory Expanders will typically be considered a form of Single-Headed,
Single-Logical Device - as its form factor will typically be an add-in-card
(AIC) or some other similar form-factor.
The Linux CXL driver provides support for static or dynamic configuration of
basic memory expanders. The platform may program decoders prior to OS init
(e.g. auto-decoders), or the user may program the fabric if the platform
defers these operations to the OS.
Multiple Memory Expanders may be added to an external chassis and exposed to
a host via a head attached to a CXL switch. This is a "memory pool", and
would be considered an MHSLD or MHMLD depending on the management capabilities
provided by the switch platform.
As of v6.14, Linux does not provide a formalized interface to manage non-DCD
MHSLD or MHMLD devices.
Dynamic Capacity Device (DCD)
-----------------------------
A Dynamic Capacity Device is a Type-3 device which provides dynamic management
of memory capacity. The basic premise of a DCD to provide an allocator-like
interface for physical memory capacity to a "Fabric Manager" (an external,
privileged host with privileges to change configurations for other hosts).
A DCD manages "Memory Extents", which may be volatile or persistent. Extents
may also be exclusive to a single host or shared across multiple hosts.
As of v6.14, Linux does not provide a formalized interface to manage DCD
devices, however there is active work on LKML targeting future release.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
CXL 장치와 프로토콜
1-10.. SPDX-License-Identifier: GPL-2.0
Memory, Accelerator 같은 CXL 장치 유형에 따라 많은 구성 단계가 달라집니다. 이 문서는 구성에 영향을 주며 플랫폼과 OS가 사용하는 장치 유형과 장치 내 자원의 기본 배경을 설명합니다.
세 가지 핵심 프로토콜
11-40CXL에는 세 가지 핵심 프로토콜이 있습니다. 구체적인 하드웨어 세부 사항은 대부분 Linux에서 추상화되므로 여기서는 상위 수준의 정의만 설명하며, 자세한 내용은 CXL 사양을 참고하십시오.
`CXL.io`는 PCIe 구성 메커니즘과 비슷한 기본 상호작용 프로토콜입니다. 보통 초기화, 구성, 그리고 memory(`CXL.mem`)나 cache(`CXL.cache`) 이외의 I/O 접근에 사용합니다.
Linux CXL 드라이버는 여러 sysfs 인터페이스와 장치 mailbox에 직접 접근하게 하는 `/dev/cxl/` 장치를 통해 `.io` 기능 접근을 제공합니다.
`CXL.cache`는 장치가 host memory에 coherent하게 접근하고 이를 cache할 수 있게 하는 메커니즘입니다. 구성한 뒤에는 대부분 Linux에 투명합니다.
`CXL.mem`은 CPU가 device memory에 coherent하게 접근하고 이를 cache할 수 있게 하는 메커니즘입니다. 이 역시 구성한 뒤에는 대부분 Linux에 투명합니다.
Type-1 장치
41-58Type-1 CXL 장치는 다음 특성을 가집니다.
- `CXL.io`와 `CXL.cache` 프로토콜을 지원합니다.
- 완전한 coherent cache를 구현합니다.
- Device-to-Host coherence와 Host-to-Device snoop을 허용합니다.
- Host-Managed Device Memory(HDM)는 갖지 않습니다.
일반적인 예는 들어오는 packet을 저장하기 위해 host memory에 직접 DMA하려는 Smart NIC입니다. 이런 장치는 대체로 CPU에 연결된 메모리에 의존합니다.
Type-2 장치
59-75Type-2 CXL 장치는 다음 특성을 가집니다.
- `CXL.io`, `CXL.cache`, `CXL.mem` 프로토콜을 모두 지원합니다.
- coherent cache와 Host-Managed Device Memory를 선택적으로 구현합니다.
- 보통 high-bandwidth memory를 가진 accelerator 장치입니다.
Type-1과 Type-2의 주된 차이는 host-managed device memory의 존재입니다. 장치는 local memory bank에서 동작할 수 있고 CPU도 같은 메모리에 coherent DMA할 수 있습니다.
따라서 GPU 같은 장치는 자신의 메모리를 DAX 장치나 file descriptor로 노출할 수 있고, 드라이버와 프로그램은 block-transfer 방식 대신 device memory에 직접 접근할 수 있습니다.
Type-3 장치
76-88Type-3 CXL 장치는 다음 특성을 가집니다.
- `CXL.io`와 `CXL.mem`을 지원합니다.
- Host-Managed Device Memory를 구현합니다.
- volatile 또는 persistent memory 용량 중 하나나 둘 다 제공할 수 있습니다.
기본적인 예는 단순 memory expander입니다. 그 local memory 용량을 CPU에 노출해 기본 coherent DMA로 직접 접근하게 합니다.
CXL switch
89-95CXL switch는 upstream, downstream 또는 peer 장치 사이에서 모든 CXL 프로토콜과 확장상 PCIe 프로토콜을 routing할 수 있습니다. Multi-Logical Device를 비롯한 여러 장치는 어떤 형태로든 switching이 있음을 전제로 합니다.
Logical Device와 Head
96-126CXL 장치는 물리적 `Head`를 통해 하나 이상의 host에 하나 이상의 Logical Device를 제시할 수 있습니다. Single-Logical Device(SLD)는 하나 이상의 head에 단일 장치를 제시하고, Multi-Logical Device(MLD)는 하나 이상의 upstream 장치에 여러 장치를 제시할 수 있습니다.
Single-Headed Device는 물리 연결 하나만 노출하며 Multi-Headed Device는 여러 물리 연결을 노출합니다.
Multi-Headed Single-Logical Device(MHSLD)는 여러 head에 단일 logical device를 노출하며, head는 하나 이상의 개별 host에 연결될 수 있습니다. 예를 들어 부팅 전에 정적으로 구성해 `CEDT <../platform/acpi/cedt>`를 통해 메모리 일부를 Linux에 노출하는 단순 memory pool이 있습니다.
Multi-Headed Multi-Logical Device(MHMLD)는 여러 logical device를 여러 head에 노출하며, head는 하나 이상의 개별 host에 연결될 수 있습니다. 실행 중에 메모리 일부를 Linux에 노출하도록 구성할 수 있는 Dynamic Capacity Device가 예입니다.
Memory Expander
127-152가장 단순한 Type-3 장치는 memory expander입니다. Host-Managed Device Memory(HDM)를 Linux에 노출하며 이 메모리는 volatile 또는 non-volatile(persistent)일 수 있습니다.
Memory Expander는 보통 add-in card(AIC)나 비슷한 form factor이므로 Single-Headed, Single-Logical Device로 간주합니다.
Linux CXL 드라이버는 기본 memory expander의 정적 또는 동적 구성을 지원합니다. 플랫폼이 OS 초기화 전에 decoder를 프로그래밍할 수도 있고, 플랫폼이 이 작업을 OS에 미룬다면 사용자가 fabric을 프로그래밍할 수도 있습니다.
여러 Memory Expander를 외부 chassis에 추가하고 CXL switch에 연결된 head를 통해 host에 노출하면 memory pool이 됩니다. switch 플랫폼의 관리 기능에 따라 MHSLD 또는 MHMLD로 간주합니다.
Linux v6.14 기준으로 non-DCD MHSLD 또는 MHMLD 장치를 관리하는 정형화된 인터페이스는 없습니다.
Dynamic Capacity Device
153-165Dynamic Capacity Device(DCD)는 메모리 용량의 동적 관리를 제공하는 Type-3 장치입니다. 기본 개념은 물리 메모리 용량에 allocator와 비슷한 인터페이스를 Fabric Manager에 제공하는 것입니다. Fabric Manager는 다른 host의 구성을 바꿀 권한을 가진 외부의 privileged host입니다.
DCD는 volatile 또는 persistent일 수 있는 Memory Extent를 관리합니다. Extent는 한 host 전용일 수도 있고 여러 host가 공유할 수도 있습니다.
Linux v6.14 기준으로 DCD 장치를 관리하는 정형화된 인터페이스는 없지만, 향후 릴리스를 목표로 LKML에서 개발이 활발히 진행 중입니다.
요약과 해설
device-types.rst:1-165CXL.io, CXL.cache, CXL.mem과 Type-1·2·3, switch, logical device와 DCD를 설명합니다. 영어 원문 전체와 한국어 전문 번역을 함께 제공하며 표, protocol 이름, symbol, source path와 원문 줄 좌표를 보존합니다.