treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / arch / powerpc / include / asm / spu_priv1.h
blob2167d756e6d59a5f1b426bd23ff8221ae4805cf9
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Defines an spu hypervisor abstraction layer.
5 * Copyright 2006 Sony Corp.
6 */
8 #if !defined(_SPU_PRIV1_H)
9 #define _SPU_PRIV1_H
10 #if defined(__KERNEL__)
12 #include <linux/types.h>
14 struct spu;
15 struct spu_context;
17 /* access to priv1 registers */
19 struct spu_priv1_ops {
20 void (*int_mask_and) (struct spu *spu, int class, u64 mask);
21 void (*int_mask_or) (struct spu *spu, int class, u64 mask);
22 void (*int_mask_set) (struct spu *spu, int class, u64 mask);
23 u64 (*int_mask_get) (struct spu *spu, int class);
24 void (*int_stat_clear) (struct spu *spu, int class, u64 stat);
25 u64 (*int_stat_get) (struct spu *spu, int class);
26 void (*cpu_affinity_set) (struct spu *spu, int cpu);
27 u64 (*mfc_dar_get) (struct spu *spu);
28 u64 (*mfc_dsisr_get) (struct spu *spu);
29 void (*mfc_dsisr_set) (struct spu *spu, u64 dsisr);
30 void (*mfc_sdr_setup) (struct spu *spu);
31 void (*mfc_sr1_set) (struct spu *spu, u64 sr1);
32 u64 (*mfc_sr1_get) (struct spu *spu);
33 void (*mfc_tclass_id_set) (struct spu *spu, u64 tclass_id);
34 u64 (*mfc_tclass_id_get) (struct spu *spu);
35 void (*tlb_invalidate) (struct spu *spu);
36 void (*resource_allocation_groupID_set) (struct spu *spu, u64 id);
37 u64 (*resource_allocation_groupID_get) (struct spu *spu);
38 void (*resource_allocation_enable_set) (struct spu *spu, u64 enable);
39 u64 (*resource_allocation_enable_get) (struct spu *spu);
42 extern const struct spu_priv1_ops* spu_priv1_ops;
44 static inline void
45 spu_int_mask_and (struct spu *spu, int class, u64 mask)
47 spu_priv1_ops->int_mask_and(spu, class, mask);
50 static inline void
51 spu_int_mask_or (struct spu *spu, int class, u64 mask)
53 spu_priv1_ops->int_mask_or(spu, class, mask);
56 static inline void
57 spu_int_mask_set (struct spu *spu, int class, u64 mask)
59 spu_priv1_ops->int_mask_set(spu, class, mask);
62 static inline u64
63 spu_int_mask_get (struct spu *spu, int class)
65 return spu_priv1_ops->int_mask_get(spu, class);
68 static inline void
69 spu_int_stat_clear (struct spu *spu, int class, u64 stat)
71 spu_priv1_ops->int_stat_clear(spu, class, stat);
74 static inline u64
75 spu_int_stat_get (struct spu *spu, int class)
77 return spu_priv1_ops->int_stat_get (spu, class);
80 static inline void
81 spu_cpu_affinity_set (struct spu *spu, int cpu)
83 spu_priv1_ops->cpu_affinity_set(spu, cpu);
86 static inline u64
87 spu_mfc_dar_get (struct spu *spu)
89 return spu_priv1_ops->mfc_dar_get(spu);
92 static inline u64
93 spu_mfc_dsisr_get (struct spu *spu)
95 return spu_priv1_ops->mfc_dsisr_get(spu);
98 static inline void
99 spu_mfc_dsisr_set (struct spu *spu, u64 dsisr)
101 spu_priv1_ops->mfc_dsisr_set(spu, dsisr);
104 static inline void
105 spu_mfc_sdr_setup (struct spu *spu)
107 spu_priv1_ops->mfc_sdr_setup(spu);
110 static inline void
111 spu_mfc_sr1_set (struct spu *spu, u64 sr1)
113 spu_priv1_ops->mfc_sr1_set(spu, sr1);
116 static inline u64
117 spu_mfc_sr1_get (struct spu *spu)
119 return spu_priv1_ops->mfc_sr1_get(spu);
122 static inline void
123 spu_mfc_tclass_id_set (struct spu *spu, u64 tclass_id)
125 spu_priv1_ops->mfc_tclass_id_set(spu, tclass_id);
128 static inline u64
129 spu_mfc_tclass_id_get (struct spu *spu)
131 return spu_priv1_ops->mfc_tclass_id_get(spu);
134 static inline void
135 spu_tlb_invalidate (struct spu *spu)
137 spu_priv1_ops->tlb_invalidate(spu);
140 static inline void
141 spu_resource_allocation_groupID_set (struct spu *spu, u64 id)
143 spu_priv1_ops->resource_allocation_groupID_set(spu, id);
146 static inline u64
147 spu_resource_allocation_groupID_get (struct spu *spu)
149 return spu_priv1_ops->resource_allocation_groupID_get(spu);
152 static inline void
153 spu_resource_allocation_enable_set (struct spu *spu, u64 enable)
155 spu_priv1_ops->resource_allocation_enable_set(spu, enable);
158 static inline u64
159 spu_resource_allocation_enable_get (struct spu *spu)
161 return spu_priv1_ops->resource_allocation_enable_get(spu);
164 /* spu management abstraction */
166 struct spu_management_ops {
167 int (*enumerate_spus)(int (*fn)(void *data));
168 int (*create_spu)(struct spu *spu, void *data);
169 int (*destroy_spu)(struct spu *spu);
170 void (*enable_spu)(struct spu_context *ctx);
171 void (*disable_spu)(struct spu_context *ctx);
172 int (*init_affinity)(void);
175 extern const struct spu_management_ops* spu_management_ops;
177 static inline int
178 spu_enumerate_spus (int (*fn)(void *data))
180 return spu_management_ops->enumerate_spus(fn);
183 static inline int
184 spu_create_spu (struct spu *spu, void *data)
186 return spu_management_ops->create_spu(spu, data);
189 static inline int
190 spu_destroy_spu (struct spu *spu)
192 return spu_management_ops->destroy_spu(spu);
195 static inline int
196 spu_init_affinity (void)
198 return spu_management_ops->init_affinity();
201 static inline void
202 spu_enable_spu (struct spu_context *ctx)
204 spu_management_ops->enable_spu(ctx);
207 static inline void
208 spu_disable_spu (struct spu_context *ctx)
210 spu_management_ops->disable_spu(ctx);
214 * The declarations following are put here for convenience
215 * and only intended to be used by the platform setup code.
218 extern const struct spu_priv1_ops spu_priv1_mmio_ops;
219 extern const struct spu_priv1_ops spu_priv1_beat_ops;
221 extern const struct spu_management_ops spu_management_of_ops;
223 #endif /* __KERNEL__ */
224 #endif