1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * spu_csa.h: Definitions for SPU context save area (CSA).
5 * (C) Copyright IBM 2005
7 * Author: Mark Nutter <mnutter@us.ibm.com>
15 * Total number of 128-bit registers.
17 #define NR_SPU_GPRS 128
19 #define NR_SPU_REGS_PAD 7
20 #define NR_SPU_SPILL_REGS 144 /* GPRS + SPRS + PAD */
21 #define SIZEOF_SPU_SPILL_REGS NR_SPU_SPILL_REGS * 16
23 #define SPU_SAVE_COMPLETE 0x3FFB
24 #define SPU_RESTORE_COMPLETE 0x3FFC
27 * Definitions for various 'stopped' status conditions,
28 * to be recreated during context restore.
30 #define SPU_STOPPED_STATUS_P 1
31 #define SPU_STOPPED_STATUS_I 2
32 #define SPU_STOPPED_STATUS_H 3
33 #define SPU_STOPPED_STATUS_S 4
34 #define SPU_STOPPED_STATUS_S_I 5
35 #define SPU_STOPPED_STATUS_S_P 6
36 #define SPU_STOPPED_STATUS_P_H 7
37 #define SPU_STOPPED_STATUS_P_I 8
38 #define SPU_STOPPED_STATUS_R 9
41 * Definitions for software decrementer status flag.
43 #define SPU_DECR_STATUS_RUNNING 0x1
44 #define SPU_DECR_STATUS_WRAPPED 0x2
48 * spu_reg128 - generic 128-bit register definition.
55 * struct spu_lscsa - Local Store Context Save Area.
56 * @gprs: Array of saved registers.
57 * @fpcr: Saved floating point status control register.
58 * @decr: Saved decrementer value.
59 * @decr_status: Indicates software decrementer status flags.
60 * @ppu_mb: Saved PPU mailbox data.
61 * @ppuint_mb: Saved PPU interrupting mailbox data.
62 * @tag_mask: Saved tag group mask.
63 * @event_mask: Saved event mask.
65 * @stopped_status: Conditions to be recreated by restore.
66 * @ls: Saved contents of Local Storage Area.
68 * The LSCSA represents state that is primarily saved and
69 * restored by SPU-side code.
72 struct spu_reg128 gprs
[128];
73 struct spu_reg128 fpcr
;
74 struct spu_reg128 decr
;
75 struct spu_reg128 decr_status
;
76 struct spu_reg128 ppu_mb
;
77 struct spu_reg128 ppuint_mb
;
78 struct spu_reg128 tag_mask
;
79 struct spu_reg128 event_mask
;
80 struct spu_reg128 srr0
;
81 struct spu_reg128 stopped_status
;
84 * 'ls' must be page-aligned on all configurations.
85 * Since we don't want to rely on having the spu-gcc
86 * installed to build the kernel and this structure
87 * is used in the SPU-side code, make it 64k-page
90 unsigned char ls
[LS_SIZE
] __attribute__((aligned(65536)));
95 * struct spu_problem_collapsed - condensed problem state area, w/o pads.
97 struct spu_problem_collapsed
{
102 union mfc_tag_size_class_cmd mfc_union_W
;
104 u32 dma_querytype_RW
;
105 u32 dma_querymask_RW
;
120 * struct spu_priv1_collapsed - condensed privileged 1 area, w/o pads.
122 struct spu_priv1_collapsed
{
128 u64 int_mask_class0_RW
;
129 u64 int_mask_class1_RW
;
130 u64 int_mask_class2_RW
;
131 u64 int_stat_class0_RW
;
132 u64 int_stat_class1_RW
;
133 u64 int_stat_class2_RW
;
135 u64 mfc_atomic_flush_RW
;
136 u64 resource_allocation_groupID_RW
;
137 u64 resource_allocation_enable_RW
;
139 u64 mfc_fir_status_or_W
;
140 u64 mfc_fir_status_and_W
;
142 u64 mfc_fir_mask_or_W
;
143 u64 mfc_fir_mask_and_W
;
144 u64 mfc_fir_chkstp_enable_RW
;
145 u64 smf_sbi_signal_sel
;
146 u64 smf_ato_signal_sel
;
147 u64 tlb_index_hint_RO
;
151 u64 tlb_invalidate_entry_W
;
152 u64 tlb_invalidate_all_W
;
162 u64 mfc_tclass_id_RW
;
164 u64 smf_dma_signal_sel
;
184 * struct spu_priv2_collapsed - condensed privileged 2 area, w/o pads.
186 struct spu_priv2_collapsed
{
190 u64 slb_invalidate_entry_W
;
191 u64 slb_invalidate_all_W
;
192 struct mfc_cq_sr spuq
[16];
193 struct mfc_cq_sr puq
[8];
198 u64 spu_chnlcntptr_RW
;
202 u64 spu_tag_status_query_RW
;
205 u64 spu_atomic_status_RW
;
210 * @lscsa: Local Store Context Save Area.
211 * @prob: Collapsed Problem State Area, w/o pads.
212 * @priv1: Collapsed Privileged 1 Area, w/o pads.
213 * @priv2: Collapsed Privileged 2 Area, w/o pads.
214 * @spu_chnlcnt_RW: Array of saved channel counts.
215 * @spu_chnldata_RW: Array of saved channel data.
216 * @suspend_time: Time stamp when decrementer disabled.
218 * Structure representing the whole of the SPU
219 * context save area (CSA). This struct contains
220 * all of the state necessary to suspend and then
221 * later optionally resume execution of an SPU
224 * The @lscsa region is by far the largest, and is
225 * allocated separately so that it may either be
226 * pinned or mapped to/from application memory, as
227 * appropriate for the OS environment.
230 struct spu_lscsa
*lscsa
;
231 struct spu_problem_collapsed prob
;
232 struct spu_priv1_collapsed priv1
;
233 struct spu_priv2_collapsed priv2
;
234 u64 spu_chnlcnt_RW
[32];
235 u64 spu_chnldata_RW
[32];
236 u32 spu_mailbox_data
[4];
237 u32 pu_mailbox_data
[1];
238 u64 class_0_dar
, class_0_pending
;
239 u64 class_1_dar
, class_1_dsisr
;
240 unsigned long suspend_time
;
241 spinlock_t register_lock
;
244 #endif /* !__SPU__ */
245 #endif /* __KERNEL__ */
246 #endif /* !__ASSEMBLY__ */
247 #endif /* _SPU_CSA_H_ */