Documentation/driver-api/cxl/conventions.rst GitHub 원문 ↗

Linux 6.18.37 · Driver API / CXL

Compute Express Link: Linux Conventions

CXL 사양과 플랫폼 구현의 차이를 기록하는 규약 템플릿과 CFMWS Low Memory Hole 예외를 설명합니다.

Source pathDocumentation/driver-api/cxl/conventions.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약과 해설

conventions.rst:1-182

CXL 사양과 플랫폼 구현의 차이를 기록하는 규약 템플릿과 CFMWS Low Memory Hole 예외를 설명합니다. 영어 원문 전체와 한국어 전문 번역을 함께 제공하며 표, protocol 이름, symbol, source path와 원문 줄 좌표를 보존합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0
2 .. include:: <isonum.txt>
3
4 =======================================
5 Compute Express Link: Linux Conventions
6 =======================================
7
8 There exists shipping platforms that bend or break CXL specification
9 expectations. Record the details and the rationale for those deviations.
10 Borrow the ACPI Code First template format to capture the assumptions
11 and tradeoffs such that multiple platform implementations can follow the
12 same convention.
13
14 <(template) Title>
15 ==================
16
17 Document
18 --------
19 CXL Revision <rev>, Version <ver>
20
21 License
22 -------
23 SPDX-License Identifier: CC-BY-4.0
24
25 Creator/Contributors
26 --------------------
27
28 Summary of the Change
29 ---------------------
30
31 <Detail the conflict with the specification and where available the
32 assumptions and tradeoffs taken by the hardware platform.>
33
34
35 Benefits of the Change
36 ----------------------
37
38 <Detail what happens if platforms and Linux do not adopt this
39 convention.>
40
41 References
42 ----------
43
44 Detailed Description of the Change
45 ----------------------------------
46
47 <Propose spec language that corrects the conflict.>
48
49
50 Resolve conflict between CFMWS, Platform Memory Holes, and Endpoint Decoders
51 ============================================================================
52
53 Document
54 --------
55
56 CXL Revision 3.2, Version 1.0
57
58 License
59 -------
60
61 SPDX-License Identifier: CC-BY-4.0
62
63 Creator/Contributors
64 --------------------
65
66 - Fabio M. De Francesco, Intel
67 - Dan J. Williams, Intel
68 - Mahesh Natu, Intel
69
70 Summary of the Change
71 ---------------------
72
73 According to the current Compute Express Link (CXL) Specifications (Revision
74 3.2, Version 1.0), the CXL Fixed Memory Window Structure (CFMWS) describes zero
75 or more Host Physical Address (HPA) windows associated with each CXL Host
76 Bridge. Each window represents a contiguous HPA range that may be interleaved
77 across one or more targets, including CXL Host Bridges. Each window has a set
78 of restrictions that govern its usage. It is the Operating System-directed
79 configuration and Power Management (OSPM) responsibility to utilize each window
80 for the specified use.
81
82 Table 9-22 of the current CXL Specifications states that the Window Size field
83 contains the total number of consecutive bytes of HPA this window describes.
84 This value must be a multiple of the Number of Interleave Ways (NIW) * 256 MB.
85
86 Platform Firmware (BIOS) might reserve physical addresses below 4 GB where a
87 memory gap such as the Low Memory Hole for PCIe MMIO may exist. In such cases,
88 the CFMWS Range Size may not adhere to the NIW * 256 MB rule.
89
90 The HPA represents the actual physical memory address space that the CXL devices
91 can decode and respond to, while the System Physical Address (SPA), a related
92 but distinct concept, represents the system-visible address space that users can
93 direct transaction to and so it excludes reserved regions.
94
95 BIOS publishes CFMWS to communicate the active SPA ranges that, on platforms
96 with LMH's, map to a strict subset of the HPA. The SPA range trims out the hole,
97 resulting in lost capacity in the Endpoints with no SPA to map to that part of
98 the HPA range that intersects the hole.
99
100 E.g, an x86 platform with two CFMWS and an LMH starting at 2 GB:
101
102 +--------+------------+-------------------+------------------+-------------------+------+
103 | Window | CFMWS Base | CFMWS Size | HDM Decoder Base | HDM Decoder Size | Ways |
104 +========+============+===================+==================+===================+======+
105 |  0 | 0 GB | 2 GB | 0 GB | 3 GB | 12 |
106 +--------+------------+-------------------+------------------+-------------------+------+
107 |  1 | 4 GB | NIW*256MB Aligned | 4 GB | NIW*256MB Aligned | 12 |
108 +--------+------------+-------------------+------------------+-------------------+------+
109
110 HDM decoder base and HDM decoder size represent all the 12 Endpoint Decoders of
111 a 12 ways region and all the intermediate Switch Decoders. They are configured
112 by the BIOS according to the NIW * 256MB rule, resulting in a HPA range size of
113 3GB. Instead, the CFMWS Base and CFMWS Size are used to configure the Root
114 Decoder HPA range that results smaller (2GB) than that of the Switch and
115 Endpoint Decoders in the hierarchy (3GB).
116
117 This creates 2 issues which lead to a failure to construct a region:
118
119 1) A mismatch in region size between root and any HDM decoder. The root decoders
120 will always be smaller due to the trim.
121
122 2) The trim causes the root decoder to violate the (NIW * 256MB) rule.
123
124 This change allows a region with a base address of 0GB to bypass these checks to
125 allow for region creation with the trimmed root decoder address range.
126
127 This change does not allow for any other arbitrary region to violate these
128 checks - it is intended exclusively to enable x86 platforms which map CXL memory
129 under 4GB.
130
131 Despite the HDM decoders covering the PCIE hole HPA region, it is expected that
132 the platform will never route address accesses to the CXL complex because the
133 root decoder only covers the trimmed region (which excludes this). This is
134 outside the ability of Linux to enforce.
135
136 On the example platform, only the first 2GB will be potentially usable, but
137 Linux, aiming to adhere to the current specifications, fails to construct
138 Regions and attach Endpoint and intermediate Switch Decoders to them.
139
140 There are several points of failure that due to the expectation that the Root
141 Decoder HPA size, that is equal to the CFMWS from which it is configured, has
142 to be greater or equal to the matching Switch and Endpoint HDM Decoders.
143
144 In order to succeed with construction and attachment, Linux must construct a
145 Region with Root Decoder HPA range size, and then attach to that all the
146 intermediate Switch Decoders and Endpoint Decoders that belong to the hierarchy
147 regardless of their range sizes.
148
149 Benefits of the Change
150 ----------------------
151
152 Without the change, the OSPM wouldn't match intermediate Switch and Endpoint
153 Decoders with Root Decoders configured with CFMWS HPA sizes that don't align
154 with the NIW * 256MB constraint, and so it leads to lost memdev capacity.
155
156 This change allows the OSPM to construct Regions and attach intermediate Switch
157 and Endpoint Decoders to them, so that the addressable part of the memory
158 devices total capacity is made available to the users.
159
160 References
161 ----------
162
163 Compute Express Link Specification Revision 3.2, Version 1.0
164 <https://www.computeexpresslink.org/>
165
166 Detailed Description of the Change
167 ----------------------------------
168
169 The description of the Window Size field in table 9-22 needs to account for
170 platforms with Low Memory Holes, where SPA ranges might be subsets of the
171 endpoints HPA. Therefore, it has to be changed to the following:
172
173 "The total number of consecutive bytes of HPA this window represents. This value
174 shall be a multiple of NIW * 256 MB.
175
176 On platforms that reserve physical addresses below 4 GB, such as the Low Memory
177 Hole for PCIe MMIO on x86, an instance of CFMWS whose Base HPA range is 0 might
178 have a size that doesn't align with the NIW * 256 MB constraint.
179
180 Note that the matching intermediate Switch Decoders and the Endpoint Decoders
181 HPA range sizes must still align to the above-mentioned rule, but the memory
182 capacity that exceeds the CFMWS window size won't be accessible.".
183

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-99

CXL 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  |
+--------+------------+-------------------+------------------+-------------------+------+
WindowCFMWS BaseCFMWS SizeHDM Decoder BaseHDM Decoder SizeWays
??0 GB2 GB0 GB3 GB12
??4 GBNIW*256MB Aligned4 GBNIW*256MB Aligned12

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-148

HDM 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를 초과하는 메모리 용량에는 접근할 수 없습니다.