€•v²Œsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ(/translations/zh_CN/arch/powerpc/vas-api”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ(/translations/zh_TW/arch/powerpc/vas-api”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ(/translations/it_IT/arch/powerpc/vas-api”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ(/translations/ja_JP/arch/powerpc/vas-api”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ(/translations/ko_KR/arch/powerpc/vas-api”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒPortuguese (Brazilian)”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ(/translations/pt_BR/arch/powerpc/vas-api”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ(/translations/sp_SP/arch/powerpc/vas-api”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒcomment”“”)”}”(hŒ SPDX-License-Identifier: GPL-2.0”h]”hŒ SPDX-License-Identifier: GPL-2.0”…””}”hh·sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1hµhhh²hh³ŒB/var/lib/git/docbuild/linux/Documentation/arch/powerpc/vas-api.rst”h´KubhŒtarget”“”)”}”(hŒ .. _VAS-API:”h]”h}”(h]”h ]”h"]”h$]”h&]”Œrefid”Œvas-api”uh1hÈh´Khhh²hh³hÇubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒ3Virtual Accelerator Switchboard (VAS) userspace API”h]”hŒ3Virtual Accelerator Switchboard (VAS) userspace API”…””}”(hhÝh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhhØh²hh³hÇh´Kubh×)”}”(hhh]”(hÜ)”}”(hŒ Introduction”h]”hŒ Introduction”…””}”(hhîh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhhëh²hh³hÇh´K ubhŒ paragraph”“”)”}”(hXãPower9 processor introduced Virtual Accelerator Switchboard (VAS) which allows both userspace and kernel communicate to co-processor (hardware accelerator) referred to as the Nest Accelerator (NX). The NX unit comprises of one or more hardware engines or co-processor types such as 842 compression, GZIP compression and encryption. On power9, userspace applications will have access to only GZIP Compression engine which supports ZLIB and GZIP compression algorithms in the hardware.”h]”hXãPower9 processor introduced Virtual Accelerator Switchboard (VAS) which allows both userspace and kernel communicate to co-processor (hardware accelerator) referred to as the Nest Accelerator (NX). The NX unit comprises of one or more hardware engines or co-processor types such as 842 compression, GZIP compression and encryption. On power9, userspace applications will have access to only GZIP Compression engine which supports ZLIB and GZIP compression algorithms in the hardware.”…””}”(hhþh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K hhëh²hubhý)”}”(hXTo communicate with NX, kernel has to establish a channel or window and then requests can be submitted directly without kernel involvement. Requests to the GZIP engine must be formatted as a co-processor Request Block (CRB) and these CRBs must be submitted to the NX using COPY/PASTE instructions to paste the CRB to hardware address that is associated with the engine's request queue.”h]”hXƒTo communicate with NX, kernel has to establish a channel or window and then requests can be submitted directly without kernel involvement. Requests to the GZIP engine must be formatted as a co-processor Request Block (CRB) and these CRBs must be submitted to the NX using COPY/PASTE instructions to paste the CRB to hardware address that is associated with the engine’s request queue.”…””}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Khhëh²hubhý)”}”(hŒ‡The GZIP engine provides two priority levels of requests: Normal and High. Only Normal requests are supported from userspace right now.”h]”hŒ‡The GZIP engine provides two priority levels of requests: Normal and High. Only Normal requests are supported from userspace right now.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Khhëh²hubhý)”}”(hŒ®This document explains userspace API that is used to interact with kernel to setup channel / window which can be used to send compression requests directly to NX accelerator.”h]”hŒ®This document explains userspace API that is used to interact with kernel to setup channel / window which can be used to send compression requests directly to NX accelerator.”…””}”(hj(h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Khhëh²hubeh}”(h]”Œ introduction”ah ]”h"]”Œ introduction”ah$]”h&]”uh1hÖhhØh²hh³hÇh´K ubh×)”}”(hhh]”(hÜ)”}”(hŒOverview”h]”hŒOverview”…””}”(hjAh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhj>h²hh³hÇh´K#ubhý)”}”(hX0Application access to the GZIP engine is provided through /dev/crypto/nx-gzip device node implemented by the VAS/NX device driver. An application must open the /dev/crypto/nx-gzip device to obtain a file descriptor (fd). Then should issue VAS_TX_WIN_OPEN ioctl with this fd to establish connection to the engine. It means send window is opened on GZIP engine for this process. Once a connection is established, the application should use the mmap() system call to map the hardware address of engine's request queue into the application's virtual address space.”h]”hX4Application access to the GZIP engine is provided through /dev/crypto/nx-gzip device node implemented by the VAS/NX device driver. An application must open the /dev/crypto/nx-gzip device to obtain a file descriptor (fd). Then should issue VAS_TX_WIN_OPEN ioctl with this fd to establish connection to the engine. It means send window is opened on GZIP engine for this process. Once a connection is established, the application should use the mmap() system call to map the hardware address of engine’s request queue into the application’s virtual address space.”…””}”(hjOh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K%hj>h²hubhý)”}”(hX;The application can then submit one or more requests to the engine by using copy/paste instructions and pasting the CRBs to the virtual address (aka paste_address) returned by mmap(). User space can close the established connection or send window by closing the file descriptor (close(fd)) or upon the process exit.”h]”hX;The application can then submit one or more requests to the engine by using copy/paste instructions and pasting the CRBs to the virtual address (aka paste_address) returned by mmap(). User space can close the established connection or send window by closing the file descriptor (close(fd)) or upon the process exit.”…””}”(hj]h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K.hj>h²hubhý)”}”(hŒ‘Note that applications can send several requests with the same window or can establish multiple windows, but one window for each file descriptor.”h]”hŒ‘Note that applications can send several requests with the same window or can establish multiple windows, but one window for each file descriptor.”…””}”(hjkh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K4hj>h²hubhý)”}”(hŒXFollowing sections provide additional details and references about the individual steps.”h]”hŒXFollowing sections provide additional details and references about the individual steps.”…””}”(hjyh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K7hj>h²hubeh}”(h]”Œoverview”ah ]”h"]”Œoverview”ah$]”h&]”uh1hÖhhØh²hh³hÇh´K#ubh×)”}”(hhh]”(hÜ)”}”(hŒNX-GZIP Device Node”h]”hŒNX-GZIP Device Node”…””}”(hj’h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjh²hh³hÇh´K;ubhý)”}”(hŒ£There is one /dev/crypto/nx-gzip node in the system and it provides access to all GZIP engines in the system. The only valid operations on /dev/crypto/nx-gzip are:”h]”hŒ£There is one /dev/crypto/nx-gzip node in the system and it provides access to all GZIP engines in the system. The only valid operations on /dev/crypto/nx-gzip are:”…””}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K=hjh²hubhŒ block_quote”“”)”}”(hŒè* open() the device for read and write. * issue VAS_TX_WIN_OPEN ioctl * mmap() the engine's request queue into application's virtual address space (i.e. get a paste_address for the co-processor engine). * close the device node. ”h]”hŒ bullet_list”“”)”}”(hhh]”(hŒ list_item”“”)”}”(hŒ%open() the device for read and write.”h]”hý)”}”(hj½h]”hŒ%open() the device for read and write.”…””}”(hj¿h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KAhj»ubah}”(h]”h ]”h"]”h$]”h&]”uh1j¹hj¶ubjº)”}”(hŒissue VAS_TX_WIN_OPEN ioctl”h]”hý)”}”(hjÔh]”hŒissue VAS_TX_WIN_OPEN ioctl”…””}”(hjÖh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KBhjÒubah}”(h]”h ]”h"]”h$]”h&]”uh1j¹hj¶ubjº)”}”(hŒ‚mmap() the engine's request queue into application's virtual address space (i.e. get a paste_address for the co-processor engine).”h]”hý)”}”(hŒ‚mmap() the engine's request queue into application's virtual address space (i.e. get a paste_address for the co-processor engine).”h]”hŒ†mmap() the engine’s request queue into application’s virtual address space (i.e. get a paste_address for the co-processor engine).”…””}”(hjíh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KChjéubah}”(h]”h ]”h"]”h$]”h&]”uh1j¹hj¶ubjº)”}”(hŒclose the device node. ”h]”hý)”}”(hŒclose the device node.”h]”hŒclose the device node.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KFhjubah}”(h]”h ]”h"]”h$]”h&]”uh1j¹hj¶ubeh}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ*”uh1j´h³hÇh´KAhj°ubah}”(h]”h ]”h"]”h$]”h&]”uh1j®h³hÇh´KAhjh²hubhý)”}”(hŒ8Other file operations on this device node are undefined.”h]”hŒ8Other file operations on this device node are undefined.”…””}”(hj'h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KHhjh²hubhý)”}”(hŒ’Note that the copy and paste operations go directly to the hardware and do not go through this device. Refer COPY/PASTE document for more details.”h]”hŒ’Note that the copy and paste operations go directly to the hardware and do not go through this device. Refer COPY/PASTE document for more details.”…””}”(hj5h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KJhjh²hubhý)”}”(hXœAlthough a system may have several instances of the NX co-processor engines (typically, one per P9 chip) there is just one /dev/crypto/nx-gzip device node in the system. When the nx-gzip device node is opened, Kernel opens send window on a suitable instance of NX accelerator. It finds CPU on which the user process is executing and determine the NX instance for the corresponding chip on which this CPU belongs.”h]”hXœAlthough a system may have several instances of the NX co-processor engines (typically, one per P9 chip) there is just one /dev/crypto/nx-gzip device node in the system. When the nx-gzip device node is opened, Kernel opens send window on a suitable instance of NX accelerator. It finds CPU on which the user process is executing and determine the NX instance for the corresponding chip on which this CPU belongs.”…””}”(hjCh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KNhjh²hubhý)”}”(hŒˆApplications may chose a specific instance of the NX co-processor using the vas_id field in the VAS_TX_WIN_OPEN ioctl as detailed below.”h]”hŒˆApplications may chose a specific instance of the NX co-processor using the vas_id field in the VAS_TX_WIN_OPEN ioctl as detailed below.”…””}”(hjQh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KVhjh²hubhý)”}”(hŒFA userspace library libnxz is available here but still in development:”h]”hŒFA userspace library libnxz is available here but still in development:”…””}”(hj_h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KYhjh²hubj¯)”}”(hŒ%https://github.com/abalib/power-gzip ”h]”hý)”}”(hŒ$https://github.com/abalib/power-gzip”h]”hŒ reference”“”)”}”(hjsh]”hŒ$https://github.com/abalib/power-gzip”…””}”(hjwh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”jsuh1juhjqubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K[hjmubah}”(h]”h ]”h"]”h$]”h&]”uh1j®h³hÇh´K[hjh²hubhý)”}”(hŒˆApplications that use inflate / deflate calls can link with libnxz instead of libz and use NX GZIP compression without any modification.”h]”hŒˆApplications that use inflate / deflate calls can link with libnxz instead of libz and use NX GZIP compression without any modification.”…””}”(hj‘h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K]hjh²hubeh}”(h]”Œnx-gzip-device-node”ah ]”h"]”Œnx-gzip device node”ah$]”h&]”uh1hÖhhØh²hh³hÇh´K;ubh×)”}”(hhh]”(hÜ)”}”(hŒOpen /dev/crypto/nx-gzip”h]”hŒOpen /dev/crypto/nx-gzip”…””}”(hjªh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhj§h²hh³hÇh´Kaubhý)”}”(hŒöThe nx-gzip device should be opened for read and write. No special privileges are needed to open the device. Each window corresponds to one file descriptor. So if the userspace process needs multiple windows, several open calls have to be issued.”h]”hŒöThe nx-gzip device should be opened for read and write. No special privileges are needed to open the device. Each window corresponds to one file descriptor. So if the userspace process needs multiple windows, several open calls have to be issued.”…””}”(hj¸h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Kchj§h²hubhý)”}”(hŒhSee open(2) system call man pages for other details such as return values, error codes and restrictions.”h]”hŒhSee open(2) system call man pages for other details such as return values, error codes and restrictions.”…””}”(hjÆh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Khhj§h²hubeh}”(h]”Œopen-dev-crypto-nx-gzip”ah ]”h"]”Œopen /dev/crypto/nx-gzip”ah$]”h&]”uh1hÖhhØh²hh³hÇh´Kaubh×)”}”(hhh]”(hÜ)”}”(hŒVAS_TX_WIN_OPEN ioctl”h]”hŒVAS_TX_WIN_OPEN ioctl”…””}”(hjßh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjÜh²hh³hÇh´Klubhý)”}”(hŒsApplications should use the VAS_TX_WIN_OPEN ioctl as follows to establish a connection with NX co-processor engine:”h]”hŒsApplications should use the VAS_TX_WIN_OPEN ioctl as follows to establish a connection with NX co-processor engine:”…””}”(hjíh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KnhjÜh²hubj¯)”}”(hX:: struct vas_tx_win_open_attr { __u32 version; __s16 vas_id; /* specific instance of vas or -1 for default */ __u16 reserved1; __u64 flags; /* For future use */ __u64 reserved2[6]; }; version: The version field must be currently set to 1. vas_id: If '-1' is passed, kernel will make a best-effort attempt to assign an optimal instance of NX for the process. To select the specific VAS instance, refer "Discovery of available VAS engines" section below. flags, reserved1 and reserved2[6] fields are for future extension and must be set to 0. The attributes attr for the VAS_TX_WIN_OPEN ioctl are defined as follows:: #define VAS_MAGIC 'v' #define VAS_TX_WIN_OPEN _IOW(VAS_MAGIC, 1, struct vas_tx_win_open_attr) struct vas_tx_win_open_attr attr; rc = ioctl(fd, VAS_TX_WIN_OPEN, &attr); The VAS_TX_WIN_OPEN ioctl returns 0 on success. On errors, it returns -1 and sets the errno variable to indicate the error. Error conditions: ====== ================================================ EINVAL fd does not refer to a valid VAS device. EINVAL Invalid vas ID EINVAL version is not set with proper value EEXIST Window is already opened for the given fd ENOMEM Memory is not available to allocate window ENOSPC System has too many active windows (connections) opened EINVAL reserved fields are not set to 0. ====== ================================================ See the ioctl(2) man page for more details, error codes and restrictions. ”h]”(hŒ literal_block”“”)”}”(hXstruct vas_tx_win_open_attr { __u32 version; __s16 vas_id; /* specific instance of vas or -1 for default */ __u16 reserved1; __u64 flags; /* For future use */ __u64 reserved2[6]; };”h]”hXstruct vas_tx_win_open_attr { __u32 version; __s16 vas_id; /* specific instance of vas or -1 for default */ __u16 reserved1; __u64 flags; /* For future use */ __u64 reserved2[6]; };”…””}”hjsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jÿh³hÇh´KshjûubhŒdefinition_list”“”)”}”(hhh]”(hŒdefinition_list_item”“”)”}”(hŒ6version: The version field must be currently set to 1.”h]”(hŒterm”“”)”}”(hŒversion:”h]”hŒversion:”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K|hjubhŒ definition”“”)”}”(hhh]”hý)”}”(hŒ-The version field must be currently set to 1.”h]”hŒ-The version field must be currently set to 1.”…””}”(hj/h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K}hj,ubah}”(h]”h ]”h"]”h$]”h&]”uh1j*hjubeh}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K|hjubj)”}”(hŒÖvas_id: If '-1' is passed, kernel will make a best-effort attempt to assign an optimal instance of NX for the process. To select the specific VAS instance, refer "Discovery of available VAS engines" section below. ”h]”(j)”}”(hŒvas_id:”h]”hŒvas_id:”…””}”(hjMh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K‚hjIubj+)”}”(hhh]”hý)”}”(hŒÍIf '-1' is passed, kernel will make a best-effort attempt to assign an optimal instance of NX for the process. To select the specific VAS instance, refer "Discovery of available VAS engines" section below.”h]”hŒÕIf ‘-1’ is passed, kernel will make a best-effort attempt to assign an optimal instance of NX for the process. To select the specific VAS instance, refer “Discovery of available VAS engines†section below.”…””}”(hj^h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Khj[ubah}”(h]”h ]”h"]”h$]”h&]”uh1j*hjIubeh}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K‚hjubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhjûubhý)”}”(hŒWflags, reserved1 and reserved2[6] fields are for future extension and must be set to 0.”h]”hŒWflags, reserved1 and reserved2[6] fields are for future extension and must be set to 0.”…””}”(hj~h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K„hjûubhý)”}”(hŒJThe attributes attr for the VAS_TX_WIN_OPEN ioctl are defined as follows::”h]”hŒIThe attributes attr for the VAS_TX_WIN_OPEN ioctl are defined as follows:”…””}”(hjŒh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K‡hjûubj)”}”(hŒÈ#define VAS_MAGIC 'v' #define VAS_TX_WIN_OPEN _IOW(VAS_MAGIC, 1, struct vas_tx_win_open_attr) struct vas_tx_win_open_attr attr; rc = ioctl(fd, VAS_TX_WIN_OPEN, &attr);”h]”hŒÈ#define VAS_MAGIC 'v' #define VAS_TX_WIN_OPEN _IOW(VAS_MAGIC, 1, struct vas_tx_win_open_attr) struct vas_tx_win_open_attr attr; rc = ioctl(fd, VAS_TX_WIN_OPEN, &attr);”…””}”hjšsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jÿh³hÇh´KŠhjûubhý)”}”(hŒ{The VAS_TX_WIN_OPEN ioctl returns 0 on success. On errors, it returns -1 and sets the errno variable to indicate the error.”h]”hŒ{The VAS_TX_WIN_OPEN ioctl returns 0 on success. On errors, it returns -1 and sets the errno variable to indicate the error.”…””}”(hj¨h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K‘hjûubhý)”}”(hŒError conditions:”h]”hŒError conditions:”…””}”(hj¶h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K”hjûubj¯)”}”(hX¾====== ================================================ EINVAL fd does not refer to a valid VAS device. EINVAL Invalid vas ID EINVAL version is not set with proper value EEXIST Window is already opened for the given fd ENOMEM Memory is not available to allocate window ENOSPC System has too many active windows (connections) opened EINVAL reserved fields are not set to 0. ====== ================================================ ”h]”hŒtable”“”)”}”(hhh]”hŒtgroup”“”)”}”(hhh]”(hŒcolspec”“”)”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jÒhjÏubjÓ)”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”K0uh1jÒhjÏubhŒtbody”“”)”}”(hhh]”(hŒrow”“”)”}”(hhh]”(hŒentry”“”)”}”(hhh]”hý)”}”(hŒEINVAL”h]”hŒEINVAL”…””}”(hj÷h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K—hjôubah}”(h]”h ]”h"]”h$]”h&]”uh1jòhjïubjó)”}”(hhh]”hý)”}”(hŒ(fd does not refer to a valid VAS device.”h]”hŒ(fd does not refer to a valid VAS device.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K—hj ubah}”(h]”h ]”h"]”h$]”h&]”uh1jòhjïubeh}”(h]”h ]”h"]”h$]”h&]”uh1jíhjêubjî)”}”(hhh]”(jó)”}”(hhh]”hý)”}”(hŒEINVAL”h]”hŒEINVAL”…””}”(hj.h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K˜hj+ubah}”(h]”h ]”h"]”h$]”h&]”uh1jòhj(ubjó)”}”(hhh]”hý)”}”(hŒInvalid vas ID”h]”hŒInvalid vas ID”…””}”(hjEh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K˜hjBubah}”(h]”h ]”h"]”h$]”h&]”uh1jòhj(ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jíhjêubjî)”}”(hhh]”(jó)”}”(hhh]”hý)”}”(hŒEINVAL”h]”hŒEINVAL”…””}”(hjeh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K™hjbubah}”(h]”h ]”h"]”h$]”h&]”uh1jòhj_ubjó)”}”(hhh]”hý)”}”(hŒ$version is not set with proper value”h]”hŒ$version is not set with proper value”…””}”(hj|h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K™hjyubah}”(h]”h ]”h"]”h$]”h&]”uh1jòhj_ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jíhjêubjî)”}”(hhh]”(jó)”}”(hhh]”hý)”}”(hŒEEXIST”h]”hŒEEXIST”…””}”(hjœh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Kšhj™ubah}”(h]”h ]”h"]”h$]”h&]”uh1jòhj–ubjó)”}”(hhh]”hý)”}”(hŒ)Window is already opened for the given fd”h]”hŒ)Window is already opened for the given fd”…””}”(hj³h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Kšhj°ubah}”(h]”h ]”h"]”h$]”h&]”uh1jòhj–ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jíhjêubjî)”}”(hhh]”(jó)”}”(hhh]”hý)”}”(hŒENOMEM”h]”hŒENOMEM”…””}”(hjÓh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K›hjÐubah}”(h]”h ]”h"]”h$]”h&]”uh1jòhjÍubjó)”}”(hhh]”hý)”}”(hŒ*Memory is not available to allocate window”h]”hŒ*Memory is not available to allocate window”…””}”(hjêh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K›hjçubah}”(h]”h ]”h"]”h$]”h&]”uh1jòhjÍubeh}”(h]”h ]”h"]”h$]”h&]”uh1jíhjêubjî)”}”(hhh]”(jó)”}”(hhh]”hý)”}”(hŒENOSPC”h]”hŒENOSPC”…””}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Kœhjubah}”(h]”h ]”h"]”h$]”h&]”uh1jòhjubjó)”}”(hhh]”hý)”}”(hŒ7System has too many active windows (connections) opened”h]”hŒ7System has too many active windows (connections) opened”…””}”(hj!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Kœhjubah}”(h]”h ]”h"]”h$]”h&]”uh1jòhjubeh}”(h]”h ]”h"]”h$]”h&]”uh1jíhjêubjî)”}”(hhh]”(jó)”}”(hhh]”hý)”}”(hŒEINVAL”h]”hŒEINVAL”…””}”(hjAh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Kžhj>ubah}”(h]”h ]”h"]”h$]”h&]”uh1jòhj;ubjó)”}”(hhh]”hý)”}”(hŒ!reserved fields are not set to 0.”h]”hŒ!reserved fields are not set to 0.”…””}”(hjXh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KžhjUubah}”(h]”h ]”h"]”h$]”h&]”uh1jòhj;ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jíhjêubeh}”(h]”h ]”h"]”h$]”h&]”uh1jèhjÏubeh}”(h]”h ]”h"]”h$]”h&]”Œcols”Kuh1jÍhjÊubah}”(h]”h ]”h"]”h$]”h&]”uh1jÈhjÄubah}”(h]”h ]”h"]”h$]”h&]”uh1j®h³hÇh´K–hjûubhý)”}”(hŒISee the ioctl(2) man page for more details, error codes and restrictions.”h]”hŒISee the ioctl(2) man page for more details, error codes and restrictions.”…””}”(hj‹h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K¡hjûubeh}”(h]”h ]”h"]”h$]”h&]”uh1j®h³hÇh´KqhjÜh²hubeh}”(h]”Œvas-tx-win-open-ioctl”ah ]”h"]”Œvas_tx_win_open ioctl”ah$]”h&]”uh1hÖhhØh²hh³hÇh´Klubh×)”}”(hhh]”(hÜ)”}”(hŒmmap() NX-GZIP device”h]”hŒmmap() NX-GZIP device”…””}”(hjªh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhj§h²hh³hÇh´K¥ubhý)”}”(hŒ’The mmap() system call for a NX-GZIP device fd returns a paste_address that the application can use to copy/paste its CRB to the hardware engines.”h]”hŒ’The mmap() system call for a NX-GZIP device fd returns a paste_address that the application can use to copy/paste its CRB to the hardware engines.”…””}”(hj¸h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K§hj§h²hubj¯)”}”(hXÐ:: paste_addr = mmap(addr, size, prot, flags, fd, offset); Only restrictions on mmap for a NX-GZIP device fd are: * size should be PAGE_SIZE * offset parameter should be 0ULL Refer to mmap(2) man page for additional details/restrictions. In addition to the error conditions listed on the mmap(2) man page, can also fail with one of the following error codes: ====== ============================================= EINVAL fd is not associated with an open window (i.e mmap() does not follow a successful call to the VAS_TX_WIN_OPEN ioctl). EINVAL offset field is not 0ULL. ====== ============================================= ”h]”(j)”}”(hŒ7paste_addr = mmap(addr, size, prot, flags, fd, offset);”h]”hŒ7paste_addr = mmap(addr, size, prot, flags, fd, offset);”…””}”hjÊsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jÿh³hÇh´K¬hjÆubhý)”}”(hŒ6Only restrictions on mmap for a NX-GZIP device fd are:”h]”hŒ6Only restrictions on mmap for a NX-GZIP device fd are:”…””}”(hjØh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K®hjÆubj¯)”}”(hŒ=* size should be PAGE_SIZE * offset parameter should be 0ULL ”h]”jµ)”}”(hhh]”(jº)”}”(hŒsize should be PAGE_SIZE”h]”hý)”}”(hjïh]”hŒsize should be PAGE_SIZE”…””}”(hjñh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K°hjíubah}”(h]”h ]”h"]”h$]”h&]”uh1j¹hjêubjº)”}”(hŒ offset parameter should be 0ULL ”h]”hý)”}”(hŒoffset parameter should be 0ULL”h]”hŒoffset parameter should be 0ULL”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K±hjubah}”(h]”h ]”h"]”h$]”h&]”uh1j¹hjêubeh}”(h]”h ]”h"]”h$]”h&]”jj uh1j´h³hÇh´K°hjæubah}”(h]”h ]”h"]”h$]”h&]”uh1j®h³hÇh´K°hjÆubhý)”}”(hŒ·Refer to mmap(2) man page for additional details/restrictions. In addition to the error conditions listed on the mmap(2) man page, can also fail with one of the following error codes:”h]”hŒ·Refer to mmap(2) man page for additional details/restrictions. In addition to the error conditions listed on the mmap(2) man page, can also fail with one of the following error codes:”…””}”(hj(h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K³hjÆubj¯)”}”(hX====== ============================================= EINVAL fd is not associated with an open window (i.e mmap() does not follow a successful call to the VAS_TX_WIN_OPEN ioctl). EINVAL offset field is not 0ULL. ====== ============================================= ”h]”jÉ)”}”(hhh]”jÎ)”}”(hhh]”(jÓ)”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jÒhj=ubjÓ)”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”K-uh1jÒhj=ubjé)”}”(hhh]”(jî)”}”(hhh]”(jó)”}”(hhh]”hý)”}”(hŒEINVAL”h]”hŒEINVAL”…””}”(hj]h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K¸hjZubah}”(h]”h ]”h"]”h$]”h&]”uh1jòhjWubjó)”}”(hhh]”hý)”}”(hŒufd is not associated with an open window (i.e mmap() does not follow a successful call to the VAS_TX_WIN_OPEN ioctl).”h]”hŒufd is not associated with an open window (i.e mmap() does not follow a successful call to the VAS_TX_WIN_OPEN ioctl).”…””}”(hjth²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K¸hjqubah}”(h]”h ]”h"]”h$]”h&]”uh1jòhjWubeh}”(h]”h ]”h"]”h$]”h&]”uh1jíhjTubjî)”}”(hhh]”(jó)”}”(hhh]”hý)”}”(hŒEINVAL”h]”hŒEINVAL”…””}”(hj”h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K»hj‘ubah}”(h]”h ]”h"]”h$]”h&]”uh1jòhjŽubjó)”}”(hhh]”hý)”}”(hŒoffset field is not 0ULL.”h]”hŒoffset field is not 0ULL.”…””}”(hj«h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K»hj¨ubah}”(h]”h ]”h"]”h$]”h&]”uh1jòhjŽubeh}”(h]”h ]”h"]”h$]”h&]”uh1jíhjTubeh}”(h]”h ]”h"]”h$]”h&]”uh1jèhj=ubeh}”(h]”h ]”h"]”h$]”h&]”Œcols”Kuh1jÍhj:ubah}”(h]”h ]”h"]”h$]”h&]”uh1jÈhj6ubah}”(h]”h ]”h"]”h$]”h&]”uh1j®h³hÇh´K·hjÆubeh}”(h]”h ]”h"]”h$]”h&]”uh1j®h³hÇh´Kªhj§h²hubeh}”(h]”Œmmap-nx-gzip-device”ah ]”h"]”Œmmap() nx-gzip device”ah$]”h&]”uh1hÖhhØh²hh³hÇh´K¥ubh×)”}”(hhh]”(hÜ)”}”(hŒ"Discovery of available VAS engines”h]”hŒ"Discovery of available VAS engines”…””}”(hjïh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjìh²hh³hÇh´K¿ubhý)”}”(hX Each available VAS instance in the system will have a device tree node like /proc/device-tree/vas@* or /proc/device-tree/xscom@*/vas@*. Determine the chip or VAS instance and use the corresponding ibm,vas-id property value in this node to select specific VAS instance.”h]”hX Each available VAS instance in the system will have a device tree node like /proc/device-tree/vas@* or /proc/device-tree/xscom@*/vas@*. Determine the chip or VAS instance and use the corresponding ibm,vas-id property value in this node to select specific VAS instance.”…””}”(hjýh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KÁhjìh²hubeh}”(h]”Œ"discovery-of-available-vas-engines”ah ]”h"]”Œ"discovery of available vas engines”ah$]”h&]”uh1hÖhhØh²hh³hÇh´K¿ubh×)”}”(hhh]”(hÜ)”}”(hŒCopy/Paste operations”h]”hŒCopy/Paste operations”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjh²hh³hÇh´KÇubhý)”}”(hŒÉApplications should use the copy and paste instructions to send CRB to NX. Refer section 4.4 in PowerISA for Copy/Paste instructions: https://openpowerfoundation.org/?resource_lib=power-isa-version-3-0”h]”(hŒ†Applications should use the copy and paste instructions to send CRB to NX. Refer section 4.4 in PowerISA for Copy/Paste instructions: ”…””}”(hj$h²hh³Nh´Nubjv)”}”(hŒChttps://openpowerfoundation.org/?resource_lib=power-isa-version-3-0”h]”hŒChttps://openpowerfoundation.org/?resource_lib=power-isa-version-3-0”…””}”(hj,h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”j.uh1juhj$ubeh}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KÉhjh²hubeh}”(h]”Œcopy-paste-operations”ah ]”h"]”Œcopy/paste operations”ah$]”h&]”uh1hÖhhØh²hh³hÇh´KÇubh×)”}”(hhh]”(hÜ)”}”(hŒCRB Specification and use NX”h]”hŒCRB Specification and use NX”…””}”(hjLh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjIh²hh³hÇh´KÎubhý)”}”(hŒæApplications should format requests to the co-processor using the co-processor Request Block (CRBs). Refer NX-GZIP user's manual for the format of CRB and use NX from userspace such as sending requests and checking request status.”h]”hŒèApplications should format requests to the co-processor using the co-processor Request Block (CRBs). Refer NX-GZIP user’s manual for the format of CRB and use NX from userspace such as sending requests and checking request status.”…””}”(hjZh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KÐhjIh²hubeh}”(h]”Œcrb-specification-and-use-nx”ah ]”h"]”Œcrb specification and use nx”ah$]”h&]”uh1hÖhhØh²hh³hÇh´KÎubh×)”}”(hhh]”(hÜ)”}”(hŒNX Fault handling”h]”hŒNX Fault handling”…””}”(hjsh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjph²hh³hÇh´KÖubhý)”}”(hŒëApplications send requests to NX and wait for the status by polling on co-processor Status Block (CSB) flags. NX updates status in CSB after each request is processed. Refer NX-GZIP user's manual for the format of CSB and status flags.”h]”hŒíApplications send requests to NX and wait for the status by polling on co-processor Status Block (CSB) flags. NX updates status in CSB after each request is processed. Refer NX-GZIP user’s manual for the format of CSB and status flags.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KØhjph²hubhý)”}”(hXSIn case if NX encounters translation error (called NX page fault) on CSB address or any request buffer, raises an interrupt on the CPU to handle the fault. Page fault can happen if an application passes invalid addresses or request buffers are not in memory. The operating system handles the fault by updating CSB with the following data::”h]”hXRIn case if NX encounters translation error (called NX page fault) on CSB address or any request buffer, raises an interrupt on the CPU to handle the fault. Page fault can happen if an application passes invalid addresses or request buffers are not in memory. The operating system handles the fault by updating CSB with the following data:”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KÝhjph²hubj)”}”(hŒkcsb.flags = CSB_V; csb.cc = CSB_CC_FAULT_ADDRESS; csb.ce = CSB_CE_TERMINATION; csb.address = fault_address;”h]”hŒkcsb.flags = CSB_V; csb.cc = CSB_CC_FAULT_ADDRESS; csb.ce = CSB_CE_TERMINATION; csb.address = fault_address;”…””}”hjsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jÿh³hÇh´Kãhjph²hubhý)”}”(hŒÁWhen an application receives translation error, it can touch or access the page that has a fault address so that this page will be in memory. Then the application can resend this request to NX.”h]”hŒÁWhen an application receives translation error, it can touch or access the page that has a fault address so that this page will be in memory. Then the application can resend this request to NX.”…””}”(hj«h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Kèhjph²hubhý)”}”(hŒÖIf the OS can not update CSB due to invalid CSB address, sends SEGV signal to the process who opened the send window on which the original request was issued. This signal returns with the following siginfo struct::”h]”hŒÕIf the OS can not update CSB due to invalid CSB address, sends SEGV signal to the process who opened the send window on which the original request was issued. This signal returns with the following siginfo struct:”…””}”(hj¹h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Kìhjph²hubj)”}”(hŒtsiginfo.si_signo = SIGSEGV; siginfo.si_errno = EFAULT; siginfo.si_code = SEGV_MAPERR; siginfo.si_addr = CSB address;”h]”hŒtsiginfo.si_signo = SIGSEGV; siginfo.si_errno = EFAULT; siginfo.si_code = SEGV_MAPERR; siginfo.si_addr = CSB address;”…””}”hjÇsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jÿh³hÇh´Kðhjph²hubhý)”}”(hX•In the case of multi-thread applications, NX send windows can be shared across all threads. For example, a child thread can open a send window, but other threads can send requests to NX using this window. These requests will be successful even in the case of OS handling faults as long as CSB address is valid. If the NX request contains an invalid CSB address, the signal will be sent to the child thread that opened the window. But if the thread is exited without closing the window and the request is issued using this window. the signal will be issued to the thread group leader (tgid). It is up to the application whether to ignore or handle these signals.”h]”hX•In the case of multi-thread applications, NX send windows can be shared across all threads. For example, a child thread can open a send window, but other threads can send requests to NX using this window. These requests will be successful even in the case of OS handling faults as long as CSB address is valid. If the NX request contains an invalid CSB address, the signal will be sent to the child thread that opened the window. But if the thread is exited without closing the window and the request is issued using this window. the signal will be issued to the thread group leader (tgid). It is up to the application whether to ignore or handle these signals.”…””}”(hjÕh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Kõhjph²hubhý)”}”(hŒ`NX-GZIP User's Manual: https://github.com/libnxz/power-gzip/blob/master/doc/power_nx_gzip_um.pdf”h]”(hŒNX-GZIP User’s Manual: ”…””}”(hjãh²hh³Nh´Nubjv)”}”(hŒIhttps://github.com/libnxz/power-gzip/blob/master/doc/power_nx_gzip_um.pdf”h]”hŒIhttps://github.com/libnxz/power-gzip/blob/master/doc/power_nx_gzip_um.pdf”…””}”(hjëh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”jíuh1juhjãubeh}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Mhjph²hubeh}”(h]”Œnx-fault-handling”ah ]”h"]”Œnx fault handling”ah$]”h&]”uh1hÖhhØh²hh³hÇh´KÖubh×)”}”(hhh]”(hÜ)”}”(hŒSimple example”h]”hŒSimple example”…””}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjh²hh³hÇh´Mubj¯)”}”(hX›:: int use_nx_gzip() { int rc, fd; void *addr; struct vas_setup_attr txattr; fd = open("/dev/crypto/nx-gzip", O_RDWR); if (fd < 0) { fprintf(stderr, "open nx-gzip failed\n"); return -1; } memset(&txattr, 0, sizeof(txattr)); txattr.version = 1; txattr.vas_id = -1 rc = ioctl(fd, VAS_TX_WIN_OPEN, (unsigned long)&txattr); if (rc < 0) { fprintf(stderr, "ioctl() n %d, error %d\n", rc, errno); return rc; } addr = mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0ULL); if (addr == MAP_FAILED) { fprintf(stderr, "mmap() failed, errno %d\n", errno); return -errno; } do { //Format CRB request with compression or //uncompression // Refer tests for vas_copy/vas_paste vas_copy((&crb, 0, 1); vas_paste(addr, 0, 1); // Poll on csb.flags with timeout // csb address is listed in CRB } while (true) close(fd) or window can be closed upon process exit } Refer https://github.com/libnxz/power-gzip for tests or more use cases.”h]”(j)”}”(hXint use_nx_gzip() { int rc, fd; void *addr; struct vas_setup_attr txattr; fd = open("/dev/crypto/nx-gzip", O_RDWR); if (fd < 0) { fprintf(stderr, "open nx-gzip failed\n"); return -1; } memset(&txattr, 0, sizeof(txattr)); txattr.version = 1; txattr.vas_id = -1 rc = ioctl(fd, VAS_TX_WIN_OPEN, (unsigned long)&txattr); if (rc < 0) { fprintf(stderr, "ioctl() n %d, error %d\n", rc, errno); return rc; } addr = mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0ULL); if (addr == MAP_FAILED) { fprintf(stderr, "mmap() failed, errno %d\n", errno); return -errno; } do { //Format CRB request with compression or //uncompression // Refer tests for vas_copy/vas_paste vas_copy((&crb, 0, 1); vas_paste(addr, 0, 1); // Poll on csb.flags with timeout // csb address is listed in CRB } while (true) close(fd) or window can be closed upon process exit }”h]”hXint use_nx_gzip() { int rc, fd; void *addr; struct vas_setup_attr txattr; fd = open("/dev/crypto/nx-gzip", O_RDWR); if (fd < 0) { fprintf(stderr, "open nx-gzip failed\n"); return -1; } memset(&txattr, 0, sizeof(txattr)); txattr.version = 1; txattr.vas_id = -1 rc = ioctl(fd, VAS_TX_WIN_OPEN, (unsigned long)&txattr); if (rc < 0) { fprintf(stderr, "ioctl() n %d, error %d\n", rc, errno); return rc; } addr = mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0ULL); if (addr == MAP_FAILED) { fprintf(stderr, "mmap() failed, errno %d\n", errno); return -errno; } do { //Format CRB request with compression or //uncompression // Refer tests for vas_copy/vas_paste vas_copy((&crb, 0, 1); vas_paste(addr, 0, 1); // Poll on csb.flags with timeout // csb address is listed in CRB } while (true) close(fd) or window can be closed upon process exit }”…””}”hjsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jÿh³hÇh´Mhjubhý)”}”(hŒGRefer https://github.com/libnxz/power-gzip for tests or more use cases.”h]”(hŒRefer ”…””}”(hj+h²hh³Nh´Nubjv)”}”(hŒ$https://github.com/libnxz/power-gzip”h]”hŒ$https://github.com/libnxz/power-gzip”…””}”(hj3h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”j5uh1juhj+ubhŒ for tests or more use cases.”…””}”(hj+h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´M0hjubeh}”(h]”h ]”h"]”h$]”h&]”uh1j®h³hÇh´Mhjh²hubeh}”(h]”Œsimple-example”ah ]”h"]”Œsimple example”ah$]”h&]”uh1hÖhhØh²hh³hÇh´Mubeh}”(h]”(Œ1virtual-accelerator-switchboard-vas-userspace-api”hÕeh ]”h"]”(Œ3virtual accelerator switchboard (vas) userspace api”Œvas-api”eh$]”h&]”uh1hÖhhh²hh³hÇh´KŒexpect_referenced_by_name”}”j`hÊsŒexpect_referenced_by_id”}”hÕhÊsubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”hÇuh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)”}”(hÛNŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”jòŒfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”j‰Œerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”hÇŒ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”hÕ]”hÊasŒnameids”}”(j`hÕj_j\j;j8jŒj‰j¤j¡jÙjÖj¤j¡jéjæjj jFjCjmjjjjjWjTuŒ nametypes”}”(j`ˆj_‰j;‰jŒ‰j¤‰jÙ‰j¤‰jé‰j‰jF‰jm‰j‰jW‰uh}”(hÕhØj\hØj8hëj‰j>j¡jjÖj§j¡jÜjæj§j jìjCjjjjIjjpjTjuŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”…”R”Œparse_messages”]”Œtransform_messages”]”hŒsystem_message”“”)”}”(hhh]”hý)”}”(hhh]”hŒ-Hyperlink target "vas-api" is not referenced.”…””}”hjósbah}”(h]”h ]”h"]”h$]”h&]”uh1hühjðubah}”(h]”h ]”h"]”h$]”h&]”Œlevel”KŒtype”ŒINFO”Œsource”hÇŒline”Kuh1jîubaŒ transformer”NŒ include_log”]”Œ decoration”Nh²hub.