Lines Matching +full:can +full:- +full:fd
1 .. SPDX-License-Identifier: GPL-2.0
2 .. _VAS-API:
12 allows both userspace and kernel communicate to co-processor
14 unit comprises of one or more hardware engines or co-processor types
20 then requests can be submitted directly without kernel involvement.
21 Requests to the GZIP engine must be formatted as a co-processor Request
30 kernel to setup channel / window which can be used to send compression
38 /dev/crypto/nx-gzip device node implemented by the VAS/NX device driver.
39 An application must open the /dev/crypto/nx-gzip device to obtain a file
40 descriptor (fd). Then should issue VAS_TX_WIN_OPEN ioctl with this fd to
46 The application can then submit one or more requests to the engine by
48 (aka paste_address) returned by mmap(). User space can close the
50 (close(fd)) or upon the process exit.
52 Note that applications can send several requests with the same window or
53 can establish multiple windows, but one window for each file descriptor.
58 NX-GZIP Device Node
61 There is one /dev/crypto/nx-gzip node in the system and it provides
63 /dev/crypto/nx-gzip are:
68 address space (i.e. get a paste_address for the co-processor
78 Although a system may have several instances of the NX co-processor
80 /dev/crypto/nx-gzip device node in the system. When the nx-gzip device
86 Applications may chose a specific instance of the NX co-processor using
91 https://github.com/abalib/power-gzip
93 Applications that use inflate / deflate calls can link with libnxz
96 Open /dev/crypto/nx-gzip
99 The nx-gzip device should be opened for read and write. No special
111 a connection with NX co-processor engine:
117 __s16 vas_id; /* specific instance of vas or -1
127 If '-1' is passed, kernel will make a best-effort attempt
143 rc = ioctl(fd, VAS_TX_WIN_OPEN, &attr);
146 returns -1 and sets the errno variable to indicate the error.
151 EINVAL fd does not refer to a valid VAS device.
154 EEXIST Window is already opened for the given fd
164 mmap() NX-GZIP device
167 The mmap() system call for a NX-GZIP device fd returns a paste_address
168 that the application can use to copy/paste its CRB to the hardware engines.
172 paste_addr = mmap(addr, size, prot, flags, fd, offset);
174 Only restrictions on mmap for a NX-GZIP device fd are:
181 page, can also fail with one of the following error codes:
184 EINVAL fd is not associated with an open window
194 like /proc/device-tree/vas@* or /proc/device-tree/xscom@*/vas@*.
195 Determine the chip or VAS instance and use the corresponding ibm,vas-id
203 https://openpowerfoundation.org/?resource_lib=power-isa-version-3-0
208 Applications should format requests to the co-processor using the
209 co-processor Request Block (CRBs). Refer NX-GZIP user's manual for the format
217 co-processor Status Block (CSB) flags. NX updates status in CSB after each
218 request is processed. Refer NX-GZIP user's manual for the format of CSB and
223 fault. Page fault can happen if an application passes invalid addresses or
232 When an application receives translation error, it can touch or access
234 the application can resend this request to NX.
236 If the OS can not update CSB due to invalid CSB address, sends SEGV signal
245 In the case of multi-thread applications, NX send windows can be shared
246 across all threads. For example, a child thread can open a send window,
247 but other threads can send requests to NX using this window. These
256 NX-GZIP User's Manual:
257 https://github.com/libnxz/power-gzip/blob/master/doc/power_nx_gzip_um.pdf
266 int rc, fd;
270 fd = open("/dev/crypto/nx-gzip", O_RDWR);
271 if (fd < 0) {
272 fprintf(stderr, "open nx-gzip failed\n");
273 return -1;
277 txattr.vas_id = -1
278 rc = ioctl(fd, VAS_TX_WIN_OPEN,
286 MAP_SHARED, fd, 0ULL);
290 return -errno;
301 close(fd) or window can be closed upon process exit
304 Refer https://github.com/libnxz/power-gzip for tests or more