Lines Matching +full:wed +full:- +full:pcie

1 /* SPDX-License-Identifier: GPL-2.0-or-later */
21 #include <misc/cxl-base.h>
64 /* Configuration and Control area - CAIA 1&2 */
74 /* PSL Lookaside Buffer Management Area - CAIA 1 */
83 /* PSL registers - CAIA 1 */
94 /* PSL registers - CAIA 2 */
116 /* 0x7F00:7FFF Reserved PCIe MSI-X Pending Bit Array area */
117 /* 0x8000:FFFF Reserved PCIe MSI-X Table Area */
120 /* Configuration Area - CAIA 1&2 */
127 /* Memory Management and Lookaside Buffer Management - CAIA 1*/
129 /* Memory Management and Lookaside Buffer Management - CAIA 1&2 */
131 /* Pointer Area - CAIA 1&2 */
135 /* Control Area - CAIA 1&2 */
140 /* 0xC0:FF Implementation Dependent Area - CAIA 1&2 */
143 /* 0xC0:FF Implementation Dependent Area - CAIA 1 */
150 /* Configuration and Control Area - CAIA 1&2 */
153 /* Configuration and Control Area - CAIA 1 */
158 /* Configuration and Control Area - CAIA 1 */
160 /* Segment Lookaside Buffer Management - CAIA 1 */
164 /* Interrupt Registers - CAIA 1&2 */
171 /* AFU Registers - CAIA 1&2 */
174 /* Work Element Descriptor - CAIA 1&2 */
184 #define CXL_PSL_Control_tb (0x1ull << (63-63))
185 #define CXL_PSL_Control_Fr (0x1ull << (63-31))
186 #define CXL_PSL_Control_Fs_MASK (0x3ull << (63-29))
187 #define CXL_PSL_Control_Fs_Complete (0x3ull << (63-29))
190 #define CXL_PSL_DLCNTL_D (0x1ull << (63-28))
191 #define CXL_PSL_DLCNTL_C (0x1ull << (63-29))
192 #define CXL_PSL_DLCNTL_E (0x1ull << (63-30))
193 #define CXL_PSL_DLCNTL_S (0x1ull << (63-31))
199 #define CXL_PSL_SR_An_TA (1ull << (63-1)) /* Tags active, GA1: 0 */
201 #define CXL_PSL_SR_An_XLAT_hpt (0ull << (63-6))/* Hashed page table (HPT) mode */
202 #define CXL_PSL_SR_An_XLAT_roh (2ull << (63-6))/* Radix on HPT mode */
203 #define CXL_PSL_SR_An_XLAT_ror (3ull << (63-6))/* Radix on Radix mode */
204 #define CXL_PSL_SR_An_BOT (1ull << (63-10)) /* Use the in-memory segment table */
206 #define CXL_PSL_SR_An_ISL (1ull << (63-53)) /* Ignore Segment Large Page */
207 #define CXL_PSL_SR_An_TC (1ull << (63-54)) /* Page Table secondary hash */
208 #define CXL_PSL_SR_An_US (1ull << (63-56)) /* User state, GA1: X */
209 #define CXL_PSL_SR_An_SC (1ull << (63-58)) /* Segment Table secondary hash */
211 #define CXL_PSL_SR_An_MP (1ull << (63-62)) /* Master Process */
212 #define CXL_PSL_SR_An_LE (1ull << (63-63)) /* Little Endian */
215 #define CXL_PSL_ID_An_F (1ull << (63-31))
216 #define CXL_PSL_ID_An_L (1ull << (63-30))
219 #define CXL_PSL_SERR_An_afuto (1ull << (63-0))
220 #define CXL_PSL_SERR_An_afudis (1ull << (63-1))
221 #define CXL_PSL_SERR_An_afuov (1ull << (63-2))
222 #define CXL_PSL_SERR_An_badsrc (1ull << (63-3))
223 #define CXL_PSL_SERR_An_badctx (1ull << (63-4))
224 #define CXL_PSL_SERR_An_llcmdis (1ull << (63-5))
225 #define CXL_PSL_SERR_An_llcmdto (1ull << (63-6))
226 #define CXL_PSL_SERR_An_afupar (1ull << (63-7))
227 #define CXL_PSL_SERR_An_afudup (1ull << (63-8))
232 #define CXL_PSL_SERR_An_afuto_mask (1ull << (63-32))
233 #define CXL_PSL_SERR_An_afudis_mask (1ull << (63-33))
234 #define CXL_PSL_SERR_An_afuov_mask (1ull << (63-34))
235 #define CXL_PSL_SERR_An_badsrc_mask (1ull << (63-35))
236 #define CXL_PSL_SERR_An_badctx_mask (1ull << (63-36))
237 #define CXL_PSL_SERR_An_llcmdis_mask (1ull << (63-37))
238 #define CXL_PSL_SERR_An_llcmdto_mask (1ull << (63-38))
239 #define CXL_PSL_SERR_An_afupar_mask (1ull << (63-39))
240 #define CXL_PSL_SERR_An_afudup_mask (1ull << (63-40))
246 #define CXL_PSL_SERR_An_AE (1ull << (63-30))
249 #define CXL_PSL_SCNTL_An_CR (0x1ull << (63-15))
251 #define CXL_PSL_SCNTL_An_PM_MASK (0xffffull << (63-31))
252 #define CXL_PSL_SCNTL_An_PM_Shared (0x0000ull << (63-31))
253 #define CXL_PSL_SCNTL_An_PM_OS (0x0001ull << (63-31))
254 #define CXL_PSL_SCNTL_An_PM_Process (0x0002ull << (63-31))
255 #define CXL_PSL_SCNTL_An_PM_AFU (0x0004ull << (63-31))
256 #define CXL_PSL_SCNTL_An_PM_AFU_PBT (0x0104ull << (63-31))
258 #define CXL_PSL_SCNTL_An_Ps_MASK (0x3ull << (63-39))
259 #define CXL_PSL_SCNTL_An_Ps_Pending (0x1ull << (63-39))
260 #define CXL_PSL_SCNTL_An_Ps_Complete (0x3ull << (63-39))
262 #define CXL_PSL_SCNTL_An_Pc (0x1ull << (63-48))
264 #define CXL_PSL_SCNTL_An_Ss_MASK (0x3ull << (63-55))
265 #define CXL_PSL_SCNTL_An_Ss_Pending (0x1ull << (63-55))
266 #define CXL_PSL_SCNTL_An_Ss_Complete (0x3ull << (63-55))
268 #define CXL_PSL_SCNTL_An_Sc (0x1ull << (63-63))
271 #define CXL_AFU_Cntl_An_ES_MASK (0x7ull << (63-2))
272 #define CXL_AFU_Cntl_An_ES_Disabled (0x0ull << (63-2))
273 #define CXL_AFU_Cntl_An_ES_Enabled (0x4ull << (63-2))
275 #define CXL_AFU_Cntl_An_E (0x1ull << (63-3))
277 #define CXL_AFU_Cntl_An_RS_MASK (0x3ull << (63-5))
278 #define CXL_AFU_Cntl_An_RS_Pending (0x1ull << (63-5))
279 #define CXL_AFU_Cntl_An_RS_Complete (0x2ull << (63-5))
281 #define CXL_AFU_Cntl_An_RA (0x1ull << (63-7))
286 #define CXL_SSTP0_An_KS (1ull << (63-2))
287 #define CXL_SSTP0_An_KP (1ull << (63-3))
288 #define CXL_SSTP0_An_N (1ull << (63-4))
289 #define CXL_SSTP0_An_L (1ull << (63-5))
290 #define CXL_SSTP0_An_C (1ull << (63-6))
291 #define CXL_SSTP0_An_TA (1ull << (63-7))
292 #define CXL_SSTP0_An_LP_SHIFT (63-9) /* 2 Bits */
294 #define CXL_SSTP0_An_SegTableSize_SHIFT (63-31) /* 12 Bits */
296 (((1ull << 12) - 1) << CXL_SSTP0_An_SegTableSize_SHIFT)
297 #define CXL_SSTP0_An_STVA_U_MASK ((1ull << (63-49))-1)
298 #define CXL_SSTP1_An_STVA_L_MASK (~((1ull << (63-55))-1))
299 #define CXL_SSTP1_An_V (1ull << (63-63))
301 /****** CXL_PSL_SLBIE_[An] - CAIA 1 **************************************************/
311 /****** Common to all CXL_TLBIA/SLBIA_[An] - CAIA 1 **********************************/
314 /****** Common to all CXL_TLB/SLB_IA/IE_[An] registers - CAIA 1 **********************/
320 #define CXL_PSL_AFUSEL_A (1ull << (63-55)) /* Adapter wide invalidates affect all AFUs */
322 /****** CXL_PSL_DSISR_An - CAIA 1 ****************************************************/
323 #define CXL_PSL_DSISR_An_DS (1ull << (63-0)) /* Segment not found */
324 #define CXL_PSL_DSISR_An_DM (1ull << (63-1)) /* PTE not found (See also: M) or protection fault */
325 #define CXL_PSL_DSISR_An_ST (1ull << (63-2)) /* Segment Table PTE not found */
326 #define CXL_PSL_DSISR_An_UR (1ull << (63-3)) /* AURP PTE not found */
328 #define CXL_PSL_DSISR_An_PE (1ull << (63-4)) /* PSL Error (implementation specific) */
329 #define CXL_PSL_DSISR_An_AE (1ull << (63-5)) /* AFU Error */
330 #define CXL_PSL_DSISR_An_OC (1ull << (63-6)) /* OS Context Warning */
335 #define CXL_PSL_DSISR_An_A (1ull << (63-37)) /* AFU lock access to write through or cache inhibite…
339 /****** CXL_PSL_DSISR_An - CAIA 2 ****************************************************/
340 #define CXL_PSL9_DSISR_An_TF (1ull << (63-3)) /* Translation fault */
341 #define CXL_PSL9_DSISR_An_PE (1ull << (63-4)) /* PSL Error (implementation specific) */
342 #define CXL_PSL9_DSISR_An_AE (1ull << (63-5)) /* AFU Error */
343 #define CXL_PSL9_DSISR_An_OC (1ull << (63-6)) /* OS Context Warning */
344 #define CXL_PSL9_DSISR_An_S (1ull << (63-38)) /* TF for a write operation */
360 #define CXL_PSL_TFC_An_A (1ull << (63-28)) /* Acknowledge non-translation fault */
361 #define CXL_PSL_TFC_An_C (1ull << (63-29)) /* Continue (abort transaction) */
362 #define CXL_PSL_TFC_An_AE (1ull << (63-30)) /* Restart PSL with address error */
363 #define CXL_PSL_TFC_An_R (1ull << (63-31)) /* Restart PSL transaction */
366 #define CXL_PSL_DEBUG_CDC (1ull << (63-27)) /* Coherent Data cache support */
368 /****** CXL_XSL9_IERAT_ERAT - CAIA 2 **********************************/
369 #define CXL_XSL9_IERAT_MLPID (1ull << (63-0)) /* Match LPID */
370 #define CXL_XSL9_IERAT_MPID (1ull << (63-1)) /* Match PID */
371 #define CXL_XSL9_IERAT_PRS (1ull << (63-4)) /* PRS bit for Radix invalidations */
372 #define CXL_XSL9_IERAT_INVR (1ull << (63-3)) /* Invalidate Radix */
373 #define CXL_XSL9_IERAT_IALL (1ull << (63-8)) /* Invalidate All */
374 #define CXL_XSL9_IERAT_IINPROG (1ull << (63-63)) /* Invalidate in progress */
376 /* cxl_process_element->software_status */
377 #define CXL_PE_SOFTWARE_STATE_V (1ul << (31 - 0)) /* Valid */
378 #define CXL_PE_SOFTWARE_STATE_C (1ul << (31 - 29)) /* Complete */
379 #define CXL_PE_SOFTWARE_STATE_S (1ul << (31 - 30)) /* Suspend */
380 #define CXL_PE_SOFTWARE_STATE_T (1ul << (31 - 31)) /* Terminate */
389 /* SPA->sw_command_status */
414 #define CXL_CARD_MINOR(adapter) (adapter->adapter_num * CXL_DEV_MINORS)
497 /* -1: AFU deconfigured/locked, >= 0: number of readers */
597 * On bare-metal, pe=external_pe, because we decide what the handle is.
637 int (*attach_afu_directed)(struct cxl_context *ctx, u64 wed, u64 amr);
638 int (*attach_dedicated_process)(struct cxl_context *ctx, u64 wed, u64 amr);
709 * -1: No contexts mapped and new ones cannot be mapped.
724 /* common == phyp + powernv - CAIA 1&2 */
745 __be64 wed; member
748 /* just powernv - CAIA 1&2 */
770 pdev = to_pci_dev(cxl->dev.parent); in cxl_adapter_link_ok()
779 return cxl->native->p1_mmio + cxl_reg_off(reg); in _cxl_p1_addr()
799 return afu->native->p1n_mmio + cxl_reg_off(reg); in _cxl_p1n_addr()
804 if (likely(cxl_adapter_link_ok(afu->adapter, afu))) in cxl_p1n_write()
810 if (likely(cxl_adapter_link_ok(afu->adapter, afu))) in cxl_p1n_read()
818 return afu->p2n_mmio + cxl_reg_off(reg); in _cxl_p2n_addr()
823 if (likely(cxl_adapter_link_ok(afu->adapter, afu))) in cxl_p2n_write()
829 if (likely(cxl_adapter_link_ok(afu->adapter, afu))) in cxl_p2n_read()
903 int cxl_attach_afu_directed_psl9(struct cxl_context *ctx, u64 wed, u64 amr);
904 int cxl_attach_afu_directed_psl8(struct cxl_context *ctx, u64 wed, u64 amr);
907 int cxl_attach_dedicated_process_psl9(struct cxl_context *ctx, u64 wed, u64 amr);
908 int cxl_attach_dedicated_process_psl8(struct cxl_context *ctx, u64 wed, u64 amr);
972 void cxl_prefault(struct cxl_context *ctx, u64 wed);
995 * Field pid_tid is now 'reserved' because it's no more used on bare-metal.
1083 u64 wed, u64 amr);
1116 * In case an adapter_context_lock is taken the return -EBUSY.
1126 /* Unlock the contexts-lock if taken. Warn and force unlock otherwise */