Bsphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget1/translations/zh_CN/userspace-api/fwctl/fwctl-cxlmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget1/translations/zh_TW/userspace-api/fwctl/fwctl-cxlmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget1/translations/it_IT/userspace-api/fwctl/fwctl-cxlmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget1/translations/ja_JP/userspace-api/fwctl/fwctl-cxlmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget1/translations/ko_KR/userspace-api/fwctl/fwctl-cxlmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget1/translations/sp_SP/userspace-api/fwctl/fwctl-cxlmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h SPDX-License-Identifier: GPL-2.0h]h SPDX-License-Identifier: GPL-2.0}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhhK/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl.rsthKubhsection)}(hhh](htitle)}(hfwctl cxl driverh]hfwctl cxl driver}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh field_list)}(hhh]hfield)}(hhh](h field_name)}(hAuthorh]hAuthor}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhKubh field_body)}(h Dave Jiang h]h paragraph)}(h Dave Jiangh]h Dave Jiang}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhubah}(h]h ]h"]h$]h&]uh1hhhubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hOverviewh]hOverview}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhK ubh)}(hX6The CXL spec defines a set of commands that can be issued to the mailbox of a CXL device or switch. It also left room for vendor specific commands to be issued to the mailbox as well. fwctl provides a path to issue a set of allowed mailbox commands from user space to the device moderated by the kernel driver.h]hX6The CXL spec defines a set of commands that can be issued to the mailbox of a CXL device or switch. It also left room for vendor specific commands to be issued to the mailbox as well. fwctl provides a path to issue a set of allowed mailbox commands from user space to the device moderated by the kernel driver.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hj hhubh)}(hThe following 3 commands will be used to support CXL Features: CXL spec r3.1 8.2.9.6.1 Get Supported Features (Opcode 0500h) CXL spec r3.1 8.2.9.6.2 Get Feature (Opcode 0501h) CXL spec r3.1 8.2.9.6.3 Set Feature (Opcode 0502h)h]hThe following 3 commands will be used to support CXL Features: CXL spec r3.1 8.2.9.6.1 Get Supported Features (Opcode 0500h) CXL spec r3.1 8.2.9.6.2 Get Feature (Opcode 0501h) CXL spec r3.1 8.2.9.6.3 Set Feature (Opcode 0502h)}(hj*hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubh)}(hXThe "Get Supported Features" return data may be filtered by the kernel driver to drop any features that are forbidden by the kernel or being exclusively used by the kernel. The driver will set the "Set Feature Size" of the "Get Supported Features Supported Feature Entry" to 0 to indicate that the Feature cannot be modified. The "Get Supported Features" command and the "Get Features" falls under the fwctl policy of FWCTL_RPC_CONFIGURATION.h]hXThe “Get Supported Features” return data may be filtered by the kernel driver to drop any features that are forbidden by the kernel or being exclusively used by the kernel. The driver will set the “Set Feature Size” of the “Get Supported Features Supported Feature Entry” to 0 to indicate that the Feature cannot be modified. The “Get Supported Features” command and the “Get Features” falls under the fwctl policy of FWCTL_RPC_CONFIGURATION.}(hj8hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubh)}(hXWFor "Set Feature" command, the access policy currently is broken down into two categories depending on the Set Feature effects reported by the device. If the Set Feature will cause immediate change to the device, the fwctl access policy must be FWCTL_RPC_DEBUG_WRITE_FULL. The effects for this level are "immediate config change", "immediate data change", "immediate policy change", or "immediate log change" for the set effects mask. If the effects are "config change with cold reset" or "config change with conventional reset", then the fwctl access policy must be FWCTL_RPC_DEBUG_WRITE or higher.h]hXsFor “Set Feature” command, the access policy currently is broken down into two categories depending on the Set Feature effects reported by the device. If the Set Feature will cause immediate change to the device, the fwctl access policy must be FWCTL_RPC_DEBUG_WRITE_FULL. The effects for this level are “immediate config change”, “immediate data change”, “immediate policy change”, or “immediate log change” for the set effects mask. If the effects are “config change with cold reset” or “config change with conventional reset”, then the fwctl access policy must be FWCTL_RPC_DEBUG_WRITE or higher.}(hjFhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubeh}(h]overviewah ]h"]overviewah$]h&]uh1hhhhhhhhK ubh)}(hhh](h)}(hfwctl cxl User APIh]hfwctl cxl User API}(hj_hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj\hhhhhK'ubhindex)}(hhh]h}(h]h ]h"]h$]h&]entries](singlefwctl_rpc_cxl (C struct)c.fwctl_rpc_cxlhNtauh1jmhj\hhhNhNubhdesc)}(hhh](hdesc_signature)}(h fwctl_rpc_cxlh]hdesc_signature_line)}(hstruct fwctl_rpc_cxlh](hdesc_sig_keyword)}(hstructh]hstruct}(hjhhhNhNubah}(h]h ]kah"]h$]h&]uh1jhjhhhf/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:41: ./include/uapi/fwctl/cxl.hhKubhdesc_sig_space)}(h h]h }(hjhhhNhNubah}(h]h ]wah"]h$]h&]uh1jhjhhhjhKubh desc_name)}(h fwctl_rpc_cxlh]h desc_sig_name)}(hjh]h fwctl_rpc_cxl}(hjhhhNhNubah}(h]h ]nah"]h$]h&]uh1jhjubah}(h]h ](sig-namedescnameeh"]h$]h&]hhuh1jhjhhhjhKubeh}(h]h ]h"]h$]h&]hh add_permalinkuh1jsphinx_line_type declaratorhjhhhjhKubah}(h]j|ah ](sig sig-objecteh"]h$]h&] is_multiline _toc_parts) _toc_namehuh1jhjhKhjhhubh desc_content)}(hhh]h)}(hioctl(FWCTL_RPC) input for CXLh]hioctl(FWCTL_RPC) input for CXL}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:41: ./include/uapi/fwctl/cxl.hhKhjhhubah}(h]h ]h"]h$]h&]uh1jhjhhhjhKubeh}(h]h ](cstructeh"]h$]h&]domainjobjtypejdesctypejnoindex noindexentrynocontentsentryuh1j~hhhj\hNhNubh container)}(hX**Definition**:: struct fwctl_rpc_cxl { __u32 opcode; __u32 flags; __u32 op_size; __u32 reserved1; union { struct cxl_mbox_get_sup_feats_in get_sup_feats_in; struct cxl_mbox_get_feat_in get_feat_in; struct cxl_mbox_set_feat_in set_feat_in; }; }; **Members** ``opcode`` CXL mailbox command opcode ``flags`` Flags for the command (input). ``op_size`` Size of input payload. ``reserved1`` Reserved. Must be 0s. ``{unnamed_union}`` anonymous ``get_sup_feats_in`` Get Supported Features input ``get_feat_in`` Get Feature input ``set_feat_in`` Set Feature inputh](h)}(h**Definition**::h](hstrong)}(h**Definition**h]h Definition}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:41: ./include/uapi/fwctl/cxl.hhKhjubh literal_block)}(hXstruct fwctl_rpc_cxl { __u32 opcode; __u32 flags; __u32 op_size; __u32 reserved1; union { struct cxl_mbox_get_sup_feats_in get_sup_feats_in; struct cxl_mbox_get_feat_in get_feat_in; struct cxl_mbox_set_feat_in set_feat_in; }; };h]hXstruct fwctl_rpc_cxl { __u32 opcode; __u32 flags; __u32 op_size; __u32 reserved1; union { struct cxl_mbox_get_sup_feats_in get_sup_feats_in; struct cxl_mbox_get_feat_in get_feat_in; struct cxl_mbox_set_feat_in set_feat_in; }; };}hj3sbah}(h]h ]h"]h$]h&]hhuh1j1hf/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:41: ./include/uapi/fwctl/cxl.hhKhjubh)}(h **Members**h]j)}(hjDh]hMembers}(hjFhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjBubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:41: ./include/uapi/fwctl/cxl.hhK!hjubhdefinition_list)}(hhh](hdefinition_list_item)}(h&``opcode`` CXL mailbox command opcode h](hterm)}(h ``opcode``h]hliteral)}(hjih]hopcode}(hjmhhhNhNubah}(h]h ]h"]h$]h&]uh1jkhjgubah}(h]h ]h"]h$]h&]uh1jehf/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:41: ./include/uapi/fwctl/cxl.hhKhjaubh definition)}(hhh]h)}(hCXL mailbox command opcodeh]hCXL mailbox command opcode}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhKhjubah}(h]h ]h"]h$]h&]uh1jhjaubeh}(h]h ]h"]h$]h&]uh1j_hjhKhj\ubj`)}(h)``flags`` Flags for the command (input). h](jf)}(h ``flags``h]jl)}(hjh]hflags}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jkhjubah}(h]h ]h"]h$]h&]uh1jehf/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:41: ./include/uapi/fwctl/cxl.hhKhjubj)}(hhh]h)}(hFlags for the command (input).h]hFlags for the command (input).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1j_hjhKhj\ubj`)}(h#``op_size`` Size of input payload. h](jf)}(h ``op_size``h]jl)}(hjh]hop_size}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jkhjubah}(h]h ]h"]h$]h&]uh1jehf/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:41: ./include/uapi/fwctl/cxl.hhKhjubj)}(hhh]h)}(hSize of input payload.h]hSize of input payload.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1j_hjhKhj\ubj`)}(h$``reserved1`` Reserved. Must be 0s. h](jf)}(h ``reserved1``h]jl)}(hjh]h reserved1}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jkhjubah}(h]h ]h"]h$]h&]uh1jehf/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:41: ./include/uapi/fwctl/cxl.hhKhjubj)}(hhh]h)}(hReserved. Must be 0s.h]hReserved. Must be 0s.}(hj1hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj-hKhj.ubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1j_hj-hKhj\ubj`)}(h``{unnamed_union}`` anonymous h](jf)}(h``{unnamed_union}``h]jl)}(hjQh]h{unnamed_union}}(hjShhhNhNubah}(h]h ]h"]h$]h&]uh1jkhjOubah}(h]h ]h"]h$]h&]uh1jehf/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:41: ./include/uapi/fwctl/cxl.hhKhjKubj)}(hhh]h)}(h anonymoush]h anonymous}(hjjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjfhKhjgubah}(h]h ]h"]h$]h&]uh1jhjKubeh}(h]h ]h"]h$]h&]uh1j_hjfhKhj\ubj`)}(h2``get_sup_feats_in`` Get Supported Features input h](jf)}(h``get_sup_feats_in``h]jl)}(hjh]hget_sup_feats_in}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jkhjubah}(h]h ]h"]h$]h&]uh1jehf/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:41: ./include/uapi/fwctl/cxl.hhKhjubj)}(hhh]h)}(hGet Supported Features inputh]hGet Supported Features input}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1j_hjhKhj\ubj`)}(h"``get_feat_in`` Get Feature input h](jf)}(h``get_feat_in``h]jl)}(hjh]h get_feat_in}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jkhjubah}(h]h ]h"]h$]h&]uh1jehf/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:41: ./include/uapi/fwctl/cxl.hhKhjubj)}(hhh]h)}(hGet Feature inputh]hGet Feature input}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1j_hjhKhj\ubj`)}(h!``set_feat_in`` Set Feature inputh](jf)}(h``set_feat_in``h]jl)}(hjh]h set_feat_in}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jkhjubah}(h]h ]h"]h$]h&]uh1jehf/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:41: ./include/uapi/fwctl/cxl.hhKhjubj)}(hhh]h)}(hSet Feature inputh]hSet Feature input}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:41: ./include/uapi/fwctl/cxl.hhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1j_hjhKhj\ubeh}(h]h ]h"]h$]h&]uh1jZhjubeh}(h]h ] kernelindentah"]h$]h&]uh1j hj\hhhNhNubjn)}(hhh]h}(h]h ]h"]h$]h&]entries](jzfwctl_rpc_cxl_out (C struct)c.fwctl_rpc_cxl_outhNtauh1jmhj\hhhNhNubj)}(hhh](j)}(hfwctl_rpc_cxl_outh]j)}(hstruct fwctl_rpc_cxl_outh](j)}(hjh]hstruct}(hjVhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjRhhhf/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:41: ./include/uapi/fwctl/cxl.hhKubj)}(h h]h }(hjdhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjRhhhjchKubj)}(hfwctl_rpc_cxl_outh]j)}(hjPh]hfwctl_rpc_cxl_out}(hjvhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjrubah}(h]h ](jjeh"]h$]h&]hhuh1jhjRhhhjchKubeh}(h]h ]h"]h$]h&]hhjuh1jjjhjNhhhjchKubah}(h]jIah ](jjeh"]h$]h&]jj)jhuh1jhjchKhjKhhubj)}(hhh]h)}(hioctl(FWCTL_RPC) output for CXLh]hioctl(FWCTL_RPC) output for CXL}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:41: ./include/uapi/fwctl/cxl.hhK'hjhhubah}(h]h ]h"]h$]h&]uh1jhjKhhhjchKubeh}(h]h ](jstructeh"]h$]h&]jjjjjjj j j uh1j~hhhj\hNhNubj )}(hX**Definition**:: struct fwctl_rpc_cxl_out { __u32 size; __u32 retval; union { struct cxl_mbox_get_sup_feats_out get_sup_feats_out; __u8 payload[]; }; }; **Members** ``size`` Size of the output payload ``retval`` Return value from device ``{unnamed_union}`` anonymous ``get_sup_feats_out`` Get Supported Features output ``payload`` raw byte stream of payloadh](h)}(h**Definition**::h](j)}(h**Definition**h]h Definition}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:41: ./include/uapi/fwctl/cxl.hhK+hjubj2)}(hstruct fwctl_rpc_cxl_out { __u32 size; __u32 retval; union { struct cxl_mbox_get_sup_feats_out get_sup_feats_out; __u8 payload[]; }; };h]hstruct fwctl_rpc_cxl_out { __u32 size; __u32 retval; union { struct cxl_mbox_get_sup_feats_out get_sup_feats_out; __u8 payload[]; }; };}hjsbah}(h]h ]h"]h$]h&]hhuh1j1hf/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:41: ./include/uapi/fwctl/cxl.hhK-hjubh)}(h **Members**h]j)}(hjh]hMembers}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:41: ./include/uapi/fwctl/cxl.hhK6hjubj[)}(hhh](j`)}(h$``size`` Size of the output payload h](jf)}(h``size``h]jl)}(hjh]hsize}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jkhjubah}(h]h ]h"]h$]h&]uh1jehf/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:41: ./include/uapi/fwctl/cxl.hhK)hjubj)}(hhh]h)}(hSize of the output payloadh]hSize of the output payload}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhK)hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1j_hjhK)hjubj`)}(h$``retval`` Return value from device h](jf)}(h ``retval``h]jl)}(hj>h]hretval}(hj@hhhNhNubah}(h]h ]h"]h$]h&]uh1jkhj<ubah}(h]h ]h"]h$]h&]uh1jehf/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:41: ./include/uapi/fwctl/cxl.hhK*hj8ubj)}(hhh]h)}(hReturn value from deviceh]hReturn value from device}(hjWhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjShK*hjTubah}(h]h ]h"]h$]h&]uh1jhj8ubeh}(h]h ]h"]h$]h&]uh1j_hjShK*hjubj`)}(h``{unnamed_union}`` anonymous h](jf)}(h``{unnamed_union}``h]jl)}(hjwh]h{unnamed_union}}(hjyhhhNhNubah}(h]h ]h"]h$]h&]uh1jkhjuubah}(h]h ]h"]h$]h&]uh1jehf/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:41: ./include/uapi/fwctl/cxl.hhK-hjqubj)}(hhh]h)}(h anonymoush]h anonymous}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhK-hjubah}(h]h ]h"]h$]h&]uh1jhjqubeh}(h]h ]h"]h$]h&]uh1j_hjhK-hjubj`)}(h4``get_sup_feats_out`` Get Supported Features output h](jf)}(h``get_sup_feats_out``h]jl)}(hjh]hget_sup_feats_out}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jkhjubah}(h]h ]h"]h$]h&]uh1jehf/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:41: ./include/uapi/fwctl/cxl.hhK+hjubj)}(hhh]h)}(hGet Supported Features outputh]hGet Supported Features output}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhK+hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1j_hjhK+hjubj`)}(h&``payload`` raw byte stream of payloadh](jf)}(h ``payload``h]jl)}(hjh]hpayload}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jkhjubah}(h]h ]h"]h$]h&]uh1jehf/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:41: ./include/uapi/fwctl/cxl.hhK+hjubj)}(hhh]h)}(hraw byte stream of payloadh]hraw byte stream of payload}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhf/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:41: ./include/uapi/fwctl/cxl.hhK,hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1j_hjhK+hjubeh}(h]h ]h"]h$]h&]uh1jZhjubeh}(h]h ] kernelindentah"]h$]h&]uh1j hj\hhhNhNubh)}(hhh](h)}(h1. Driver info queryh]h1. Driver info query}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj*hhhhhK,ubh)}(hXFirst step for the app is to issue the ioctl(FWCTL_CMD_INFO). Successful invocation of the ioctl implies the Features capability is operational and returns an all zeros 32bit payload. A ``struct fwctl_info`` needs to be filled out with the ``fwctl_info.out_device_type`` set to ``FWCTL_DEVICE_TYPE_CXL``. The return data should be ``struct fwctl_info_cxl`` that contains a reserved 32bit field that should be all zeros.h](hFirst step for the app is to issue the ioctl(FWCTL_CMD_INFO). Successful invocation of the ioctl implies the Features capability is operational and returns an all zeros 32bit payload. A }(hj;hhhNhNubjl)}(h``struct fwctl_info``h]hstruct fwctl_info}(hjChhhNhNubah}(h]h ]h"]h$]h&]uh1jkhj;ubh! needs to be filled out with the }(hj;hhhNhNubjl)}(h``fwctl_info.out_device_type``h]hfwctl_info.out_device_type}(hjUhhhNhNubah}(h]h ]h"]h$]h&]uh1jkhj;ubh set to }(hj;hhhNhNubjl)}(h``FWCTL_DEVICE_TYPE_CXL``h]hFWCTL_DEVICE_TYPE_CXL}(hjghhhNhNubah}(h]h ]h"]h$]h&]uh1jkhj;ubh. The return data should be }(hj;hhhNhNubjl)}(h``struct fwctl_info_cxl``h]hstruct fwctl_info_cxl}(hjyhhhNhNubah}(h]h ]h"]h$]h&]uh1jkhj;ubh? that contains a reserved 32bit field that should be all zeros.}(hj;hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK.hj*hhubeh}(h]driver-info-queryah ]h"]1. driver info queryah$]h&]uh1hhj\hhhhhK,ubh)}(hhh](h)}(h2. Send hardware commandsh]h2. Send hardware commands}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK6ubh)}(hX^Next step is to send the 'Get Supported Features' command to the driver from user space via ioctl(FWCTL_RPC). A ``struct fwctl_rpc_cxl`` is pointed to by ``fwctl_rpc.in``. ``struct fwctl_rpc_cxl.in_payload`` points to the hardware input structure that is defined by the CXL spec. ``fwctl_rpc.out`` points to the buffer that contains a ``struct fwctl_rpc_cxl_out`` that includes the hardware output data inlined as ``fwctl_rpc_cxl_out.payload``. This command is called twice. First time to retrieve the number of features supported. A second time to retrieve the specific feature details as the output data.h](htNext step is to send the ‘Get Supported Features’ command to the driver from user space via ioctl(FWCTL_RPC). A }(hjhhhNhNubjl)}(h``struct fwctl_rpc_cxl``h]hstruct fwctl_rpc_cxl}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jkhjubh is pointed to by }(hjhhhNhNubjl)}(h``fwctl_rpc.in``h]h fwctl_rpc.in}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jkhjubh. }(hjhhhNhNubjl)}(h#``struct fwctl_rpc_cxl.in_payload``h]hstruct fwctl_rpc_cxl.in_payload}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jkhjubhI points to the hardware input structure that is defined by the CXL spec. }(hjhhhNhNubjl)}(h``fwctl_rpc.out``h]h fwctl_rpc.out}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jkhjubh& points to the buffer that contains a }(hjhhhNhNubjl)}(h``struct fwctl_rpc_cxl_out``h]hstruct fwctl_rpc_cxl_out}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jkhjubh3 that includes the hardware output data inlined as }(hjhhhNhNubjl)}(h``fwctl_rpc_cxl_out.payload``h]hfwctl_rpc_cxl_out.payload}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jkhjubh. This command is called twice. First time to retrieve the number of features supported. A second time to retrieve the specific feature details as the output data.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK8hjhhubh)}(hXhAfter getting the specific feature details, a Get/Set Feature command can be appropriately programmed and sent. For a "Set Feature" command, the retrieved feature info contains an effects field that details the resulting "Set Feature" command will trigger. That will inform the user whether the system is configured to allowed the "Set Feature" command or not.h]hXtAfter getting the specific feature details, a Get/Set Feature command can be appropriately programmed and sent. For a “Set Feature” command, the retrieved feature info contains an effects field that details the resulting “Set Feature” command will trigger. That will inform the user whether the system is configured to allowed the “Set Feature” command or not.}(hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKAhjhhubh)}(hhh](h)}(hCode example of a Get Featureh]hCode example of a Get Feature}(hj5hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj2hhhhhKHubj2)}(hXBstatic int cxl_fwctl_rpc_get_test_feature(int fd, struct test_feature *feat_ctx, const uint32_t expected_data) { struct cxl_mbox_get_feat_in *feat_in; struct fwctl_rpc_cxl_out *out; struct fwctl_rpc rpc = {0}; struct fwctl_rpc_cxl *in; size_t out_size, in_size; uint32_t val; void *data; int rc; in_size = sizeof(*in) + sizeof(*feat_in); rc = posix_memalign((void **)&in, 16, in_size); if (rc) return -ENOMEM; memset(in, 0, in_size); feat_in = &in->get_feat_in; uuid_copy(feat_in->uuid, feat_ctx->uuid); feat_in->count = feat_ctx->get_size; out_size = sizeof(*out) + feat_ctx->get_size; rc = posix_memalign((void **)&out, 16, out_size); if (rc) goto free_in; memset(out, 0, out_size); in->opcode = CXL_MBOX_OPCODE_GET_FEATURE; in->op_size = sizeof(*feat_in); rpc.size = sizeof(rpc); rpc.scope = FWCTL_RPC_CONFIGURATION; rpc.in_len = in_size; rpc.out_len = out_size; rpc.in = (uint64_t)(uint64_t *)in; rpc.out = (uint64_t)(uint64_t *)out; rc = send_command(fd, &rpc, out); if (rc) goto free_all; data = out->payload; val = le32toh(*(__le32 *)data); if (memcmp(&val, &expected_data, sizeof(val)) != 0) { rc = -ENXIO; goto free_all; } free_all: free(out); free_in: free(in); return rc; }h]hXBstatic int cxl_fwctl_rpc_get_test_feature(int fd, struct test_feature *feat_ctx, const uint32_t expected_data) { struct cxl_mbox_get_feat_in *feat_in; struct fwctl_rpc_cxl_out *out; struct fwctl_rpc rpc = {0}; struct fwctl_rpc_cxl *in; size_t out_size, in_size; uint32_t val; void *data; int rc; in_size = sizeof(*in) + sizeof(*feat_in); rc = posix_memalign((void **)&in, 16, in_size); if (rc) return -ENOMEM; memset(in, 0, in_size); feat_in = &in->get_feat_in; uuid_copy(feat_in->uuid, feat_ctx->uuid); feat_in->count = feat_ctx->get_size; out_size = sizeof(*out) + feat_ctx->get_size; rc = posix_memalign((void **)&out, 16, out_size); if (rc) goto free_in; memset(out, 0, out_size); in->opcode = CXL_MBOX_OPCODE_GET_FEATURE; in->op_size = sizeof(*feat_in); rpc.size = sizeof(rpc); rpc.scope = FWCTL_RPC_CONFIGURATION; rpc.in_len = in_size; rpc.out_len = out_size; rpc.in = (uint64_t)(uint64_t *)in; rpc.out = (uint64_t)(uint64_t *)out; rc = send_command(fd, &rpc, out); if (rc) goto free_all; data = out->payload; val = le32toh(*(__le32 *)data); if (memcmp(&val, &expected_data, sizeof(val)) != 0) { rc = -ENXIO; goto free_all; } free_all: free(out); free_in: free(in); return rc; }}hjCsbah}(h]h ]h"]h$]h&]hhforcelanguagejhighlight_args}uh1j1hhhKJhj2hhubh)}(hTake a look at CXL CLI test directory for a detailed user code for examples on how to exercise this path.h](h'Take a look at CXL CLI test directory <}(hjUhhhNhNubh reference)}(h4https://github.com/pmem/ndctl/tree/main/test/fwctl.ch]h4https://github.com/pmem/ndctl/tree/main/test/fwctl.c}(hj_hhhNhNubah}(h]h ]h"]h$]h&]refurijauh1j]hjUubhE> for a detailed user code for examples on how to exercise this path.}(hjUhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj2hhubeh}(h]code-example-of-a-get-featureah ]h"]code example of a get featureah$]h&]uh1hhjhhhhhKHubeh}(h]send-hardware-commandsah ]h"]2. send hardware commandsah$]h&]uh1hhj\hhhhhK6ubeh}(h]fwctl-cxl-user-apiah ]h"]fwctl cxl user apiah$]h&]uh1hhhhhhhhK'ubh)}(hhh](h)}(hfwctl cxl Kernel APIh]hfwctl cxl Kernel API}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubjn)}(hhh]h}(h]h ]h"]h$]h&]entries](jz$devm_cxl_setup_features (C function)c.devm_cxl_setup_featureshNtauh1jmhjhhhNhNubj)}(hhh](j)}(h9int devm_cxl_setup_features (struct cxl_dev_state *cxlds)h]j)}(h8int devm_cxl_setup_features(struct cxl_dev_state *cxlds)h](hdesc_sig_keyword_type)}(hinth]hint}(hjhhhNhNubah}(h]h ]ktah"]h$]h&]uh1jhjhhhj/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:140: ./drivers/cxl/core/features.chKubj)}(h h]h }(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjhhhjhKubj)}(hdevm_cxl_setup_featuresh]j)}(hdevm_cxl_setup_featuresh]hdevm_cxl_setup_features}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubah}(h]h ](jjeh"]h$]h&]hhuh1jhjhhhjhKubhdesc_parameterlist)}(h(struct cxl_dev_state *cxlds)h]hdesc_parameter)}(hstruct cxl_dev_state *cxldsh](j)}(hjh]hstruct}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj)}(h h]h }(hj hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubh)}(hhh]j)}(h cxl_dev_stateh]h cxl_dev_state}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&] refdomainjreftype identifier reftargetjmodnameN classnameN c:parent_keysphinx.domains.c LookupKey)}data]j7 ASTIdentifier)}j2jsbc.devm_cxl_setup_featuresasbuh1hhjubj)}(h h]h }(hjDhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubhdesc_sig_punctuation)}(h*h]h*}(hjThhhNhNubah}(h]h ]pah"]h$]h&]uh1jRhjubj)}(hcxldsh]hcxlds}(hjchhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjubah}(h]h ]h"]h$]h&]hhuh1jhjhhhjhKubeh}(h]h ]h"]h$]h&]hhjuh1jjjhjhhhjhKubah}(h]jah ](jjeh"]h$]h&]jj)jhuh1jhjhKhjhhubj)}(hhh]h)}(h(Allocate and initialize features contexth]h(Allocate and initialize features context}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:140: ./drivers/cxl/core/features.chKhjhhubah}(h]h ]h"]h$]h&]uh1jhjhhhjhKubeh}(h]h ](jfunctioneh"]h$]h&]jjjjjjj j j uh1j~hhhjhNhNubj )}(h**Parameters** ``struct cxl_dev_state *cxlds`` CXL device context **Description** Return 0 on success or -errno on failure.h](h)}(h**Parameters**h]j)}(hjh]h Parameters}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhj/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:140: ./drivers/cxl/core/features.chKhjubj[)}(hhh]j`)}(h3``struct cxl_dev_state *cxlds`` CXL device context h](jf)}(h``struct cxl_dev_state *cxlds``h]jl)}(hjh]hstruct cxl_dev_state *cxlds}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jkhjubah}(h]h ]h"]h$]h&]uh1jehj/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:140: ./drivers/cxl/core/features.chKhjubj)}(hhh]h)}(hCXL device contexth]hCXL device context}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1j_hjhKhjubah}(h]h ]h"]h$]h&]uh1jZhjubh)}(h**Description**h]j)}(hj h]h Description}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1hhj/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:140: ./drivers/cxl/core/features.chKhjubh)}(h)Return 0 on success or -errno on failure.h]h)Return 0 on success or -errno on failure.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:140: ./drivers/cxl/core/features.chKhjubeh}(h]h ] kernelindentah"]h$]h&]uh1j hjhhhNhNubjn)}(hhh]h}(h]h ]h"]h$]h&]entries](jzcxl_features_state (C struct)c.cxl_features_statehNtauh1jmhjhhhNhNubj)}(hhh](j)}(hcxl_features_stateh]j)}(hstruct cxl_features_stateh](j)}(hjh]hstruct}(hjN hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjJ hhhe/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:142: ./include/cxl/features.hhKubj)}(h h]h }(hj\ hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjJ hhhj[ hKubj)}(hcxl_features_stateh]j)}(hjH h]hcxl_features_state}(hjn hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjj ubah}(h]h ](jjeh"]h$]h&]hhuh1jhjJ hhhj[ hKubeh}(h]h ]h"]h$]h&]hhjuh1jjjhjF hhhj[ hKubah}(h]jA ah ](jjeh"]h$]h&]jj)jhuh1jhj[ hKhjC hhubj)}(hhh]h)}(h!The Features state for the deviceh]h!The Features state for the device}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:142: ./include/cxl/features.hhK3hj hhubah}(h]h ]h"]h$]h&]uh1jhjC hhhj[ hKubeh}(h]h ](jstructeh"]h$]h&]jjjj jj j j j uh1j~hhhjhNhNubj )}(hXM**Definition**:: struct cxl_features_state { struct cxl_dev_state *cxlds; struct cxl_feat_entries { int num_features; int num_user_features; struct cxl_feat_entry ent[] ; } *entries; }; **Members** ``cxlds`` Pointer to CXL device state ``entries`` CXl feature entry contexth](h)}(h**Definition**::h](j)}(h**Definition**h]h Definition}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh:}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:142: ./include/cxl/features.hhK7hj ubj2)}(hstruct cxl_features_state { struct cxl_dev_state *cxlds; struct cxl_feat_entries { int num_features; int num_user_features; struct cxl_feat_entry ent[] ; } *entries; };h]hstruct cxl_features_state { struct cxl_dev_state *cxlds; struct cxl_feat_entries { int num_features; int num_user_features; struct cxl_feat_entry ent[] ; } *entries; };}hj sbah}(h]h ]h"]h$]h&]hhuh1j1he/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:142: ./include/cxl/features.hhK9hj ubh)}(h **Members**h]j)}(hj h]hMembers}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:142: ./include/cxl/features.hhKBhj ubj[)}(hhh](j`)}(h&``cxlds`` Pointer to CXL device state h](jf)}(h ``cxlds``h]jl)}(hj h]hcxlds}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jkhj ubah}(h]h ]h"]h$]h&]uh1jehe/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:142: ./include/cxl/features.hhK5hj ubj)}(hhh]h)}(hPointer to CXL device stateh]hPointer to CXL device state}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hK5hj ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1j_hj hK5hj ubj`)}(h%``entries`` CXl feature entry contexth](jf)}(h ``entries``h]jl)}(hj6 h]hentries}(hj8 hhhNhNubah}(h]h ]h"]h$]h&]uh1jkhj4 ubah}(h]h ]h"]h$]h&]uh1jehe/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:142: ./include/cxl/features.hhK5hj0 ubj)}(hhh]h)}(hCXl feature entry contexth]hCXl feature entry context}(hjO hhhNhNubah}(h]h ]h"]h$]h&]uh1hhe/var/lib/git/docbuild/linux/Documentation/userspace-api/fwctl/fwctl-cxl:142: ./include/cxl/features.hhK6hjL ubah}(h]h ]h"]h$]h&]uh1jhj0 ubeh}(h]h ]h"]h$]h&]uh1j_hjK hK5hj ubeh}(h]h ]h"]h$]h&]uh1jZhj ubeh}(h]h ] kernelindentah"]h$]h&]uh1j hjhhhNhNubeh}(h]fwctl-cxl-kernel-apiah ]h"]fwctl cxl kernel apiah$]h&]uh1hhhhhhhhKubeh}(h]fwctl-cxl-driverah ]h"]fwctl cxl driverah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerj error_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(j j jYjVjjjjjjj}jzj| jy u nametypes}(j jYjjjj}j| uh}(j hjVj jj\j|jjIjNjj*jjjzj2jy jjjjA jF u footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages] transformerN include_log] decorationNhhub.