요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GPL-2.0
.. include:: <isonum.txt>
=======================================
Compute Express Link: Linux Conventions
=======================================
There exists shipping platforms that bend or break CXL specification
expectations. Record the details and the rationale for those deviations.
Borrow the ACPI Code First template format to capture the assumptions
and tradeoffs such that multiple platform implementations can follow the
same convention.
<(template) Title>
==================
Document
--------
CXL Revision <rev>, Version <ver>
License
-------
SPDX-License Identifier: CC-BY-4.0
Creator/Contributors
--------------------
Summary of the Change
---------------------
<Detail the conflict with the specification and where available the
assumptions and tradeoffs taken by the hardware platform.>
Benefits of the Change
----------------------
<Detail what happens if platforms and Linux do not adopt this
convention.>
References
----------
Detailed Description of the Change
----------------------------------
<Propose spec language that corrects the conflict.>
Resolve conflict between CFMWS, Platform Memory Holes, and Endpoint Decoders
============================================================================
Document
--------
CXL Revision 3.2, Version 1.0
License
-------
SPDX-License Identifier: CC-BY-4.0
Creator/Contributors
--------------------
- Fabio M. De Francesco, Intel
- Dan J. Williams, Intel
- Mahesh Natu, Intel
Summary of the Change
---------------------
According to the current Compute Express Link (CXL) Specifications (Revision
3.2, Version 1.0), the CXL Fixed Memory Window Structure (CFMWS) describes zero
or more Host Physical Address (HPA) windows associated with each CXL Host
Bridge. Each window represents a contiguous HPA range that may be interleaved
across one or more targets, including CXL Host Bridges. Each window has a set
of restrictions that govern its usage. It is the Operating System-directed
configuration and Power Management (OSPM) responsibility to utilize each window
for the specified use.
Table 9-22 of the current CXL Specifications states that the Window Size field
contains the total number of consecutive bytes of HPA this window describes.
This value must be a multiple of the Number of Interleave Ways (NIW) * 256 MB.
Platform Firmware (BIOS) might reserve physical addresses below 4 GB where a
memory gap such as the Low Memory Hole for PCIe MMIO may exist. In such cases,
the CFMWS Range Size may not adhere to the NIW * 256 MB rule.
The HPA represents the actual physical memory address space that the CXL devices
can decode and respond to, while the System Physical Address (SPA), a related
but distinct concept, represents the system-visible address space that users can
direct transaction to and so it excludes reserved regions.
BIOS publishes CFMWS to communicate the active SPA ranges that, on platforms
with LMH's, map to a strict subset of the HPA. The SPA range trims out the hole,
resulting in lost capacity in the Endpoints with no SPA to map to that part of
the HPA range that intersects the hole.
E.g, an x86 platform with two CFMWS and an LMH starting at 2 GB:
+--------+------------+-------------------+------------------+-------------------+------+
| Window | CFMWS Base | CFMWS Size | HDM Decoder Base | HDM Decoder Size | Ways |
+========+============+===================+==================+===================+======+
| 0 | 0 GB | 2 GB | 0 GB | 3 GB | 12 |
+--------+------------+-------------------+------------------+-------------------+------+
| 1 | 4 GB | NIW*256MB Aligned | 4 GB | NIW*256MB Aligned | 12 |
+--------+------------+-------------------+------------------+-------------------+------+
HDM decoder base and HDM decoder size represent all the 12 Endpoint Decoders of
a 12 ways region and all the intermediate Switch Decoders. They are configured
by the BIOS according to the NIW * 256MB rule, resulting in a HPA range size of
3GB. Instead, the CFMWS Base and CFMWS Size are used to configure the Root
Decoder HPA range that results smaller (2GB) than that of the Switch and
Endpoint Decoders in the hierarchy (3GB).
This creates 2 issues which lead to a failure to construct a region:
1) A mismatch in region size between root and any HDM decoder. The root decoders
will always be smaller due to the trim.
2) The trim causes the root decoder to violate the (NIW * 256MB) rule.
This change allows a region with a base address of 0GB to bypass these checks to
allow for region creation with the trimmed root decoder address range.
This change does not allow for any other arbitrary region to violate these
checks - it is intended exclusively to enable x86 platforms which map CXL memory
under 4GB.
Despite the HDM decoders covering the PCIE hole HPA region, it is expected that
the platform will never route address accesses to the CXL complex because the
root decoder only covers the trimmed region (which excludes this). This is
outside the ability of Linux to enforce.
On the example platform, only the first 2GB will be potentially usable, but
Linux, aiming to adhere to the current specifications, fails to construct
Regions and attach Endpoint and intermediate Switch Decoders to them.
There are several points of failure that due to the expectation that the Root
Decoder HPA size, that is equal to the CFMWS from which it is configured, has
to be greater or equal to the matching Switch and Endpoint HDM Decoders.
In order to succeed with construction and attachment, Linux must construct a
Region with Root Decoder HPA range size, and then attach to that all the
intermediate Switch Decoders and Endpoint Decoders that belong to the hierarchy
regardless of their range sizes.
Benefits of the Change
----------------------
Without the change, the OSPM wouldn't match intermediate Switch and Endpoint
Decoders with Root Decoders configured with CFMWS HPA sizes that don't align
with the NIW * 256MB constraint, and so it leads to lost memdev capacity.
This change allows the OSPM to construct Regions and attach intermediate Switch
and Endpoint Decoders to them, so that the addressable part of the memory
devices total capacity is made available to the users.
References
----------
Compute Express Link Specification Revision 3.2, Version 1.0
<https://www.computeexpresslink.org/>
Detailed Description of the Change
----------------------------------
The description of the Window Size field in table 9-22 needs to account for
platforms with Low Memory Holes, where SPA ranges might be subsets of the
endpoints HPA. Therefore, it has to be changed to the following:
"The total number of consecutive bytes of HPA this window represents. This value
shall be a multiple of NIW * 256 MB.
On platforms that reserve physical addresses below 4 GB, such as the Low Memory
Hole for PCIe MMIO on x86, an instance of CFMWS whose Base HPA range is 0 might
have a size that doesn't align with the NIW * 256 MB constraint.
Note that the matching intermediate Switch Decoders and the Endpoint Decoders
HPA range sizes must still align to the above-mentioned rule, but the memory
capacity that exceeds the CFMWS window size won't be accessible.".
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
Linux CXL 규약의 목적
1-12.. SPDX-License-Identifier: GPL-2.0
.. include:: <isonum.txt>
출시된 플랫폼 중에는 CXL 사양의 기대를 굽히거나 위반하는 구현이 있습니다. 이 문서는 그러한 차이의 세부 사항과 근거를 기록합니다.
여러 플랫폼 구현이 같은 규약을 따를 수 있도록 ACPI Code First 템플릿 형식을 빌려 가정과 tradeoff를 명시합니다.
규약 제안 템플릿
13-49각 규약은 `<(template) Title>`로 시작하며 적용할 `CXL Revision <rev>, Version <ver>`를 Document 항목에 적습니다.
License 항목에는 `SPDX-License Identifier: CC-BY-4.0`을 기록하고, Creator/Contributors에 작성자와 기여자를 나열합니다.
Summary of the Change에는 사양과 충돌하는 부분을 자세히 적고, 가능한 경우 하드웨어 플랫폼이 선택한 가정과 tradeoff도 설명합니다.
Benefits of the Change에는 플랫폼과 Linux가 이 규약을 채택하지 않을 때 발생하는 결과를 적습니다. References에는 근거 자료를 나열하고, Detailed Description of the Change에는 충돌을 바로잡을 사양 문구를 제안합니다.
CFMWS와 memory hole 충돌 규약
50-69이 규약의 제목은 “CFMWS, 플랫폼 memory hole과 Endpoint Decoder 사이의 충돌 해결”입니다. 기준 문서는 CXL Revision 3.2, Version 1.0이고 라이선스는 `CC-BY-4.0`입니다.
기여자는 Intel의 Fabio M. De Francesco, Dan J. Williams와 Mahesh Natu입니다.
주소 window와 Low Memory Hole
70-99CXL 3.2 사양의 CXL Fixed Memory Window Structure(CFMWS)는 각 CXL Host Bridge와 연결된 0개 이상의 Host Physical Address(HPA) window를 기술합니다. 각 window는 하나 이상의 CXL Host Bridge를 포함한 target 사이에서 interleave될 수 있는 연속 HPA 범위이며, 사용 제약을 가집니다. 지정된 용도로 각 window를 사용하는 책임은 OSPM에 있습니다.
현행 CXL 사양의 표 9-22에 따르면 Window Size는 해당 window가 나타내는 연속 HPA byte 수이며 `Number of Interleave Ways(NIW) * 256 MB`의 배수여야 합니다.
그러나 BIOS는 PCIe MMIO용 Low Memory Hole처럼 4 GB 아래의 물리 주소를 예약할 수 있습니다. 이 경우 CFMWS Range Size가 `NIW * 256 MB` 규칙을 따르지 못할 수 있습니다.
HPA는 CXL 장치가 실제로 decode하고 응답할 수 있는 물리 메모리 주소 공간입니다. 관련되지만 구별되는 System Physical Address(SPA)는 사용자가 transaction을 보낼 수 있는 시스템 가시 주소 공간이므로 예약 영역은 제외합니다.
BIOS는 활성 SPA 범위를 알리기 위해 CFMWS를 게시합니다. Low Memory Hole이 있는 플랫폼에서는 SPA가 HPA의 엄격한 부분집합이 됩니다. SPA에서 hole을 잘라 내면 그 hole과 겹치는 HPA 부분에 대응할 SPA가 없어 Endpoint 용량 일부를 잃습니다.
0 GB CFMWS 예제와 검사 예외
100-129다음은 2 GB에서 시작하는 Low Memory Hole과 CFMWS 두 개를 가진 x86 플랫폼 예입니다.
+--------+------------+-------------------+------------------+-------------------+------+
| Window | CFMWS Base | CFMWS Size | HDM Decoder Base | HDM Decoder Size | Ways |
+========+============+===================+==================+===================+======+
| 0 | 0 GB | 2 GB | 0 GB | 3 GB | 12 |
+--------+------------+-------------------+------------------+-------------------+------+
| 1 | 4 GB | NIW*256MB Aligned | 4 GB | NIW*256MB Aligned | 12 |
+--------+------------+-------------------+------------------+-------------------+------+
| Window | CFMWS Base | CFMWS Size | HDM Decoder Base | HDM Decoder Size | Ways |
|---|---|---|---|---|---|
| ?? | 0 GB | 2 GB | 0 GB | 3 GB | 12 |
| ?? | 4 GB | NIW*256MB Aligned | 4 GB | NIW*256MB Aligned | 12 |
HDM decoder base와 size는 12-way region의 Endpoint Decoder 12개와 중간 Switch Decoder 전체를 나타냅니다. BIOS는 `NIW * 256 MB` 규칙에 따라 이들을 구성해 HPA 범위를 3 GB로 만듭니다. 반면 CFMWS Base와 Size로 구성한 Root Decoder HPA 범위는 계층의 Switch 및 Endpoint Decoder 범위 3 GB보다 작은 2 GB가 됩니다.
이 차이는 region 생성을 막는 두 문제를 만듭니다. 첫째, 잘라 낸 Root Decoder는 항상 작으므로 root와 HDM decoder의 region size가 일치하지 않습니다. 둘째, 이 trim 때문에 Root Decoder가 `NIW * 256 MB` 규칙을 위반합니다.
제안된 변경은 base address가 0 GB인 region만 이 검사를 건너뛰어 잘린 Root Decoder 주소 범위로 region을 만들 수 있게 합니다. 다른 임의의 region에 위반을 허용하는 것이 아니라, 4 GB 아래에 CXL 메모리를 mapping하는 x86 플랫폼만을 위한 예외입니다.
Linux region 구성 방식
130-148HDM decoder가 PCIe hole의 HPA 영역까지 덮더라도 Root Decoder는 hole을 제외한 잘린 영역만 덮으므로 플랫폼이 이 주소 접근을 CXL complex로 routing하지 않을 것으로 기대합니다. 이는 Linux가 강제할 수 있는 범위를 벗어납니다.
예제 플랫폼에서 실제로 사용할 가능성이 있는 용량은 처음 2 GB뿐입니다. 그러나 현행 사양을 따르려는 Linux는 region을 만들고 Endpoint와 중간 Switch Decoder를 연결하지 못합니다.
CFMWS로 구성한 Root Decoder HPA size가 대응하는 Switch와 Endpoint HDM Decoder보다 크거나 같아야 한다는 기대 때문에 여러 실패 지점이 생깁니다.
구성과 연결에 성공하려면 Linux는 Root Decoder HPA 범위 크기로 region을 만든 다음, 범위 크기와 관계없이 해당 계층에 속한 모든 중간 Switch Decoder와 Endpoint Decoder를 연결해야 합니다.
변경의 이점과 참고 사양
149-165이 변경이 없으면 OSPM은 `NIW * 256 MB` 제약에 맞지 않는 CFMWS HPA size로 구성된 Root Decoder를 중간 Switch 및 Endpoint Decoder와 대응시키지 못해 memdev 용량을 잃습니다.
변경을 적용하면 OSPM이 region을 구성하고 중간 Switch와 Endpoint Decoder를 연결해 메모리 장치 전체 용량 중 주소를 지정할 수 있는 부분을 사용자에게 제공할 수 있습니다.
참고 문서는 Compute Express Link Specification Revision 3.2, Version 1.0이며 `https://www.computeexpresslink.org/`에서 확인할 수 있습니다.
제안하는 사양 문구
166-182표 9-22의 Window Size 설명은 Low Memory Hole 때문에 SPA 범위가 Endpoint HPA의 부분집합이 될 수 있는 플랫폼을 고려해야 합니다. 따라서 다음과 같은 의미로 변경해야 합니다.
Window Size는 이 window가 나타내는 연속 HPA byte의 총수이며 `NIW * 256 MB`의 배수여야 합니다.
다만 x86의 PCIe MMIO용 Low Memory Hole처럼 4 GB 아래의 물리 주소를 예약한 플랫폼에서는 HPA base가 0인 CFMWS 인스턴스의 크기가 `NIW * 256 MB` 제약에 맞지 않을 수 있습니다.
대응하는 중간 Switch Decoder와 Endpoint Decoder의 HPA 범위 크기는 여전히 이 규칙에 맞아야 하지만, CFMWS window size를 초과하는 메모리 용량에는 접근할 수 없습니다.
요약과 해설
conventions.rst:1-182CXL 사양과 플랫폼 구현의 차이를 기록하는 규약 템플릿과 CFMWS Low Memory Hole 예외를 설명합니다. 영어 원문 전체와 한국어 전문 번역을 함께 제공하며 표, protocol 이름, symbol, source path와 원문 줄 좌표를 보존합니다.