← Documents Documentation/PCI/endpoint/pci-endpoint-cfs.rst GitHub 원문 ↗

Linux 6.18.37 · PCI

Configfs PCI endpoint 구성

Configfs에서 EPF를 만들고 PF/VF·dual EPC 관계를 구성한 뒤 controller에 bind하고 시작하는 방법입니다.

Source pathDocumentation/PCI/endpoint/pci-endpoint-cfs.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

요약·해설

pci-endpoint-cfs.rst:1-138

`functions`에서 EPF header와 관계를 구성하고 `controllers`에 physical EPF symlink를 만든 뒤 `start=1`로 host link를 준비합니다.

NTB의 dual EPC는 `primary`·`secondary` link를, SR-IOV 관계는 PF 아래 VF symlink를 사용합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0
2
3 =======================================
4 Configuring PCI Endpoint Using CONFIGFS
5 =======================================
6
7 :Author: Kishon Vijay Abraham I <[email protected]>
8
9 The PCI Endpoint Core exposes configfs entry (pci_ep) to configure the
10 PCI endpoint function and to bind the endpoint function
11 with the endpoint controller. (For introducing other mechanisms to
12 configure the PCI Endpoint Function refer to [1]).
13
14 Mounting configfs
15 =================
16
17 The PCI Endpoint Core layer creates pci_ep directory in the mounted configfs
18 directory. configfs can be mounted using the following command::
19
20 mount -t configfs none /sys/kernel/config
21
22 Directory Structure
23 ===================
24
25 The pci_ep configfs has two directories at its root: controllers and
26 functions. Every EPC device present in the system will have an entry in
27 the *controllers* directory and every EPF driver present in the system
28 will have an entry in the *functions* directory.
29 ::
30
31 /sys/kernel/config/pci_ep/
32 .. controllers/
33 .. functions/
34
35 Creating EPF Device
36 ===================
37
38 Every registered EPF driver will be listed in controllers directory. The
39 entries corresponding to EPF driver will be created by the EPF core.
40 ::
41
42 /sys/kernel/config/pci_ep/functions/
43 .. <EPF Driver1>/
44 ... <EPF Device 11>/
45 ... <EPF Device 21>/
46 ... <EPF Device 31>/
47 .. <EPF Driver2>/
48 ... <EPF Device 12>/
49 ... <EPF Device 22>/
50
51 In order to create a <EPF device> of the type probed by <EPF Driver>, the
52 user has to create a directory inside <EPF DriverN>.
53
54 Every <EPF device> directory consists of the following entries that can be
55 used to configure the standard configuration header of the endpoint function.
56 (These entries are created by the framework when any new <EPF Device> is
57 created)
58 ::
59
60 .. <EPF Driver1>/
61 ... <EPF Device 11>/
62 ... vendorid
63 ... deviceid
64 ... revid
65 ... progif_code
66 ... subclass_code
67 ... baseclass_code
68 ... cache_line_size
69 ... subsys_vendor_id
70 ... subsys_id
71 ... interrupt_pin
72 ... <Symlink EPF Device 31>/
73 ... primary/
74 ... <Symlink EPC Device1>/
75 ... secondary/
76 ... <Symlink EPC Device2>/
77
78 If an EPF device has to be associated with 2 EPCs (like in the case of
79 Non-transparent bridge), symlink of endpoint controller connected to primary
80 interface should be added in 'primary' directory and symlink of endpoint
81 controller connected to secondary interface should be added in 'secondary'
82 directory.
83
84 The <EPF Device> directory can have a list of symbolic links
85 (<Symlink EPF Device 31>) to other <EPF Device>. These symbolic links should
86 be created by the user to represent the virtual functions that are bound to
87 the physical function. In the above directory structure <EPF Device 11> is a
88 physical function and <EPF Device 31> is a virtual function. An EPF device once
89 it's linked to another EPF device, cannot be linked to an EPC device.
90
91 EPC Device
92 ==========
93
94 Every registered EPC device will be listed in controllers directory. The
95 entries corresponding to EPC device will be created by the EPC core.
96 ::
97
98 /sys/kernel/config/pci_ep/controllers/
99 .. <EPC Device1>/
100 ... <Symlink EPF Device11>/
101 ... <Symlink EPF Device12>/
102 ... start
103 .. <EPC Device2>/
104 ... <Symlink EPF Device21>/
105 ... <Symlink EPF Device22>/
106 ... start
107
108 The <EPC Device> directory will have a list of symbolic links to
109 <EPF Device>. These symbolic links should be created by the user to
110 represent the functions present in the endpoint device. Only <EPF Device>
111 that represents a physical function can be linked to an EPC device.
112
113 The <EPC Device> directory will also have a *start* field. Once
114 "1" is written to this field, the endpoint device will be ready to
115 establish the link with the host. This is usually done after
116 all the EPF devices are created and linked with the EPC device.
117 ::
118
119 | controllers/
120 | <Directory: EPC name>/
121 | <Symbolic Link: Function>
122 | start
123 | functions/
124 | <Directory: EPF driver>/
125 | <Directory: EPF device>/
126 | vendorid
127 | deviceid
128 | revid
129 | progif_code
130 | subclass_code
131 | baseclass_code
132 | cache_line_size
133 | subsys_vendor_id
134 | subsys_id
135 | interrupt_pin
136 | function
137
138 [1] Documentation/PCI/endpoint/pci-endpoint.rst
139

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

Configfs interface

1-13

저자는 Kishon Vijay Abraham I입니다. PCI Endpoint Core는 endpoint function을 설정하고 endpoint controller와 bind하는 configfs entry `pci_ep`를 제공합니다. 다른 구성 mechanism을 도입하는 방법은 [1]을 참조합니다.

.. SPDX-License-Identifier: GPL-2.0

=======================================
Configuring PCI Endpoint Using CONFIGFS
=======================================

:Author: Kishon Vijay Abraham I <[email protected]>

The PCI Endpoint Core exposes configfs entry (pci_ep) to configure the
PCI endpoint function and to bind the endpoint function
with the endpoint controller. (For introducing other mechanisms to
configure the PCI Endpoint Function refer to [1]).

Configfs mount

14-21

PCI Endpoint Core layer는 mount된 configfs에 `pci_ep` directory를 만듭니다. Configfs는 다음과 같이 mount합니다.

mount -t configfs none /sys/kernel/config
Mounting configfs
=================

The PCI Endpoint Core layer creates pci_ep directory in the mounted configfs
directory. configfs can be mounted using the following command::

        mount -t configfs none /sys/kernel/config

Root directory 구조

22-34

`pci_ep` root에는 `controllers`와 `functions` directory가 있습니다. System의 각 EPC device는 `controllers` 아래에, 각 EPF driver는 `functions` 아래에 entry를 가집니다.

pci_ep root
/sys/kernel/config/pci_epcontrollersEPC devices
/sys/kernel/config/pci_epfunctionsEPF drivers

Controller와 function namespace를 분리합니다.

Directory Structure
===================

The pci_ep configfs has two directories at its root: controllers and
functions. Every EPC device present in the system will have an entry in
the *controllers* directory and every EPF driver present in the system
will have an entry in the *functions* directory.
::

        /sys/kernel/config/pci_ep/
                .. controllers/
                .. functions/

EPF device 생성과 표준 header

35-77

등록된 각 EPF driver는 `functions` directory에 나열되고 EPF core가 driver entry를 만듭니다. 특정 EPF driver type의 device를 만들려면 해당 driver directory 안에 새 directory를 만듭니다.

Framework는 새 EPF device directory에 endpoint function의 표준 configuration header를 설정하는 entry를 만듭니다.

Standard EPF entries
구분Entry
Identityvendorid, deviceid, revid
Classprogif_code, subclass_code, baseclass_code
Systemcache_line_size, subsys_vendor_id, subsys_id
Interruptinterrupt_pin
AssociationsPF-VF symlink, primary EPC symlink, secondary EPC symlink

새 EPF device에 생성되는 configuration field입니다.

EPF driver hierarchy
functionsEPF Driver1EPF Device11Standard fields
functionsEPF Driver1EPF Device21
functionsEPF Driver2EPF Device12

한 driver 아래 여러 EPF device와 선택적 PF/VF·EPC link가 위치합니다.

Creating EPF Device
===================

Every registered EPF driver will be listed in controllers directory. The
entries corresponding to EPF driver will be created by the EPF core.
::

        /sys/kernel/config/pci_ep/functions/
                .. <EPF Driver1>/
                        ... <EPF Device 11>/
                        ... <EPF Device 21>/
                        ... <EPF Device 31>/
                .. <EPF Driver2>/
                        ... <EPF Device 12>/
                        ... <EPF Device 22>/

In order to create a <EPF device> of the type probed by <EPF Driver>, the
user has to create a directory inside <EPF DriverN>.

Every <EPF device> directory consists of the following entries that can be
used to configure the standard configuration header of the endpoint function.
(These entries are created by the framework when any new <EPF Device> is
created)
::

                .. <EPF Driver1>/
                        ... <EPF Device 11>/
                                ... vendorid
                                ... deviceid
                                ... revid
                                ... progif_code
                                ... subclass_code
                                ... baseclass_code
                                ... cache_line_size
                                ... subsys_vendor_id
                                ... subsys_id
                                ... interrupt_pin
                                ... <Symlink EPF Device 31>/
                                ... primary/
                                        ... <Symlink EPC Device1>/
                                ... secondary/
                                        ... <Symlink EPC Device2>/

Dual EPC와 PF/VF link

78-90

Non-transparent bridge처럼 EPF device 하나를 EPC 두 개와 연결해야 한다면 primary interface의 endpoint controller symlink는 `primary` directory에, secondary interface symlink는 `secondary` directory에 추가합니다.

EPF device directory는 다른 EPF device를 가리키는 symbolic link 목록을 가질 수 있습니다. 사용자가 physical function에 bind된 virtual function 관계를 나타내도록 이 link를 만듭니다.

원문 예에서 `EPF Device 11`은 physical function이고 `EPF Device 31`은 virtual function입니다. 한 EPF device가 다른 EPF device에 link되면 EPC device에는 link할 수 없습니다.

EPF association rules
EPF deviceprimaryPrimary EPC
EPF devicesecondarySecondary EPC
Physical EPFVirtual-function symlinkVirtual EPF

NTB dual interface와 PF/VF 관계는 서로 다른 symlink 위치를 사용합니다.

If an EPF device has to be associated with 2 EPCs (like in the case of
Non-transparent bridge), symlink of endpoint controller connected to primary
interface should be added in 'primary' directory and symlink of endpoint
controller connected to secondary interface should be added in 'secondary'
directory.

The <EPF Device> directory can have a list of symbolic links
(<Symlink EPF Device 31>) to other <EPF Device>. These symbolic links should
be created by the user to represent the virtual functions that are bound to
the physical function. In the above directory structure <EPF Device 11> is a
physical function and <EPF Device 31> is a virtual function. An EPF device once
it's linked to another EPF device, cannot be linked to an EPC device.

EPC device와 endpoint 시작

91-117

등록된 EPC device는 `controllers` directory에 나열되고 EPC core가 entry를 만듭니다. EPC directory에는 endpoint device의 function을 나타내는 EPF device symlink를 사용자가 만듭니다.

EPC device에는 physical function을 나타내는 EPF device만 link할 수 있습니다.

EPC directory의 `start` field에 `1`을 쓰면 endpoint device가 host와 link를 맺을 준비를 합니다. 일반적으로 모든 EPF device를 만들고 EPC에 link한 뒤 시작합니다.

EPC controller hierarchy
controllersEPC Device1EPF Device11 symlink
controllersEPC Device1EPF Device12 symlink
controllersEPC Device1start = 1

Controller가 physical EPF symlink를 모으고 start field로 link를 활성화합니다.

EPC Device
==========

Every registered EPC device will be listed in controllers directory. The
entries corresponding to EPC device will be created by the EPC core.
::

        /sys/kernel/config/pci_ep/controllers/
                .. <EPC Device1>/
                        ... <Symlink EPF Device11>/
                        ... <Symlink EPF Device12>/
                        ... start
                .. <EPC Device2>/
                        ... <Symlink EPF Device21>/
                        ... <Symlink EPF Device22>/
                        ... start

The <EPC Device> directory will have a list of symbolic links to
<EPF Device>. These symbolic links should be created by the user to
represent the functions present in the endpoint device. Only <EPF Device>
that represents a physical function can be linked to an EPC device.

The <EPC Device> directory will also have a *start* field. Once
"1" is written to this field, the endpoint device will be ready to
establish the link with the host. This is usually done after
all the EPF devices are created and linked with the EPC device.
::

전체 configfs 관계와 참고문서

118-138

전체 구조에서 `controllers/<EPC name>/`에는 function symlink와 `start`가 있고, `functions/<EPF driver>/<EPF device>/`에는 표준 PCI field와 function-specific entry가 있습니다.

PCI endpoint configfs
functions / EPF driver / EPF devicevendorid·deviceid·class·interrupt fieldsfunction-specific settingssymlink to controllercontrollers / EPC / start

Function을 구성한 뒤 controller에 symlink하고 start를 활성화합니다.

다른 PCI Endpoint Function 구성 mechanism을 도입하는 방법은 [1] `Documentation/PCI/endpoint/pci-endpoint.rst`를 참조합니다.


                         | controllers/
                                | <Directory: EPC name>/
                                        | <Symbolic Link: Function>
                                        | start
                         | functions/
                                | <Directory: EPF driver>/
                                        | <Directory: EPF device>/
                                                | vendorid
                                                | deviceid
                                                | revid
                                                | progif_code
                                                | subclass_code
                                                | baseclass_code
                                                | cache_line_size
                                                | subsys_vendor_id
                                                | subsys_id
                                                | interrupt_pin
                                                | function

[1] Documentation/PCI/endpoint/pci-endpoint.rst