]>
git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - arch/powerpc/include/asm/vas.h
2 * Copyright 2016-17 IBM Corp.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
10 #ifndef _ASM_POWERPC_VAS_H
11 #define _ASM_POWERPC_VAS_H
14 * Min and max FIFO sizes are based on Version 1.05 Section 3.1.4.25
15 * (Local FIFO Size Register) of the VAS workbook.
17 #define VAS_RX_FIFO_SIZE_MIN (1 << 10) /* 1KB */
18 #define VAS_RX_FIFO_SIZE_MAX (8 << 20) /* 8MB */
21 * Threshold Control Mode: Have paste operation fail if the number of
22 * requests in receive FIFO exceeds a threshold.
24 * NOTE: No special error code yet if paste is rejected because of these
25 * limits. So users can't distinguish between this and other errors.
27 #define VAS_THRESH_DISABLED 0
28 #define VAS_THRESH_FIFO_GT_HALF_FULL 1
29 #define VAS_THRESH_FIFO_GT_QTR_FULL 2
30 #define VAS_THRESH_FIFO_GT_EIGHTH_FULL 3
35 #define GET_FIELD(m, v) (((v) & (m)) >> MASK_LSH(m))
36 #define MASK_LSH(m) (__builtin_ffsl(m) - 1)
37 #define SET_FIELD(m, v, val) \
38 (((v) & ~(m)) | ((((typeof(v))(val)) << MASK_LSH(m)) & (m)))
41 * Co-processor Engine type.
46 VAS_COP_TYPE_842_HIPRI
,
48 VAS_COP_TYPE_GZIP_HIPRI
,
54 * Receive window attributes specified by the (in-kernel) owner of window.
56 struct vas_rx_win_attr
{
84 * Window attributes specified by the in-kernel owner of a send window.
86 struct vas_tx_win_attr
{
87 enum vas_cop_type cop
;
90 int pidr
; /* hardware PID (from SPRN_PID) */
91 int pid
; /* linux process id */
99 bool rsvd_txbuf_enable
;
102 bool tx_win_ord_mode
;
103 bool rx_win_ord_mode
;
107 * Helper to initialize receive window attributes to defaults for an
110 void vas_init_rx_win_attr(struct vas_rx_win_attr
*rxattr
, enum vas_cop_type cop
);
113 * Open a VAS receive window for the instance of VAS identified by @vasid
114 * Use @attr to initialize the attributes of the window.
116 * Return a handle to the window or ERR_PTR() on error.
118 struct vas_window
*vas_rx_win_open(int vasid
, enum vas_cop_type cop
,
119 struct vas_rx_win_attr
*attr
);
122 * Helper to initialize send window attributes to defaults for an NX window.
124 extern void vas_init_tx_win_attr(struct vas_tx_win_attr
*txattr
,
125 enum vas_cop_type cop
);
128 * Open a VAS send window for the instance of VAS identified by @vasid
129 * and the co-processor type @cop. Use @attr to initialize attributes
132 * Note: The instance of VAS must already have an open receive window for
133 * the coprocessor type @cop.
135 * Return a handle to the send window or ERR_PTR() on error.
137 struct vas_window
*vas_tx_win_open(int vasid
, enum vas_cop_type cop
,
138 struct vas_tx_win_attr
*attr
);
141 * Close the send or receive window identified by @win. For receive windows
142 * return -EAGAIN if there are active send windows attached to this receive
145 int vas_win_close(struct vas_window
*win
);
148 * Copy the co-processor request block (CRB) @crb into the local L2 cache.
150 int vas_copy_crb(void *crb
, int offset
);
153 * Paste a previously copied CRB (see vas_copy_crb()) from the L2 cache to
154 * the hardware address associated with the window @win. @re is expected/
155 * assumed to be true for NX windows.
157 int vas_paste_crb(struct vas_window
*win
, int offset
, bool re
);
159 #endif /* __ASM_POWERPC_VAS_H */