Lines Matching +full:ctx +full:- +full:asid

1 /* SPDX-License-Identifier: GPL-2.0-or-later */
28 * +-----------------+
37 * +-----------------+
39 * +-----------------+ _______ +-------------+
45 * |/////////////////| / |-------------|
47 * +-----------------+ | |
49 * +-----------------+ | |
51 * +-----------------+ \____________ +-------------+
53 * +-----------------+
55 * +-----------------+
60 * - an instruction space that can be directly accessed by the user
63 * - a data area that acts as normal RAM.
73 * One context may be reserved for the kernel and used for cross-partition
80 * VDATA-VMA Data - Holds a few parameters. Head of linked list of
82 * GTS - Gru Thread State - contains info for managing a GSEG context. A
85 * GTD - GRU Thread Data - contains shadow copy of GRU data when GSEG is
87 * GMS - GRU Memory Struct - Used to manage TLB shootdowns. Tracks GRUs
91 * GS - GRU State - Used to manage the state of a GRU chiplet
92 * BS - Blade State - Used to manage state of all GRU chiplets
97 * - 2 threads in process
98 * - 2 GSEGs open in process
99 * - GSEG1 is being used by both threads
100 * - GSEG2 is used only by thread 2
102 * task -->|
103 * task ---+---> mm ->------ (notifier) -------+-> gms
105 * |--> vma -> vdata ---> gts--->| GSEG1 (thread1)
107 * | +-> gts--->| GSEG1 (thread2)
109 * |--> vma -> vdata ---> gts--->| GSEG2 (thread2)
116 * file.private_data -> NULL
119 * vma -> vdata
122 * vma -> vdata ->gts
126 * vma -> vdata -> gts
280 /*-----------------------------------------------------------------------------
281 * ASID management
287 /* Generate a GRU asid value from a GRU base asid & a virtual address. */
289 #define GRUREGION(addr) ((addr) >> (VADDR_HI_BIT - 3) & 3)
290 #define GRUASID(asid, addr) ((asid) + GRUREGION(addr)) argument
292 /*------------------------------------------------------------------------------
303 unsigned int mt_asid_gen:24; /* ASID wrap count */
304 unsigned int mt_asid:24; /* current base ASID for gru */
306 asid */
311 spinlock_t ms_asid_lock; /* protects ASID assignment */
320 * structure is pointed to by the vma->vm_private_data field in the vma struct.
336 struct list_head ts_next; /* list - head at vma-private */
337 struct mutex ts_ctxlock; /* load/unload CTX lock */
343 struct gru_mm_struct *ts_gms; /* asid & ioproc struct */
352 context - for migration */
385 #define TSID(a, v) (((a) - (v)->vm_start) / GRU_GSEG_PAGESIZE)
386 #define UGRUADDR(gts) ((gts)->ts_vma->vm_start + \
387 (gts)->ts_tsid * GRU_GSEG_PAGESIZE)
389 #define NULLCTX (-1) /* if context not loaded into GRU */
391 /*-----------------------------------------------------------------------------
417 /* -- the following are protected by the gs_asid_lock spinlock ---- */
418 unsigned int gs_asid; /* Next availe ASID */
421 unsigned int gs_asid_gen; /* asid generation.
424 /* --- the following fields are protected by the gs_lock spinlock --- */
431 unsigned int gs_reserved_cbrs; /* Number of kernel-
433 unsigned int gs_reserved_dsr_bytes; /* Bytes of kernel-
453 /* ---- the following are used for managing kernel async GRU CBRs --- */
458 /* ---- the following are protected by the bs_lock spinlock ---- */
461 int bs_lru_ctxnum; /* STEAL - last context
463 struct gru_state *bs_lru_gru; /* STEAL - last gru
469 /*-----------------------------------------------------------------------------
473 ((struct gru_tlb_fault_map *)get_tfm((g)->gs_gru_base_vaddr, (c)))
475 ((struct gru_tlb_fault_handle *)get_tfh((g)->gs_gru_base_vaddr, (i)))
477 ((struct gru_tlb_global_handle *)get_tgh((g)->gs_gru_base_vaddr, (i)))
479 ((struct gru_control_block_extended *)get_cbe((g)->gs_gru_base_vaddr,\
482 /*-----------------------------------------------------------------------------
487 #define get_gru(b, c) (&gru_base[b]->bs_grus[c])
494 #define thread_cbr_number(gts, n) ((gts)->ts_cbr_idx[(n) / GRU_CBR_AU_SIZE] \
500 (&gru_base[(gid) / GRU_CHIPLETS_PER_BLADE]-> \
510 for ((gru) = gru_base[nid]->bs_grus, (i) = 0; \
521 if (((gts) = (gru)->gs_gts[ctxnum]))
534 ((gru)->gs_gru_base_paddr + ctxnum * GRU_GSEG_STRIDE)
536 ((gru)->gs_gru_base_vaddr + ctxnum * GRU_GSEG_STRIDE)
538 /*-----------------------------------------------------------------------------
590 return !gts->ts_mm; in is_kernel_context()
594 * The following are for Nehelem-EX. A more general scheme is needed for
602 /*-----------------------------------------------------------------------------