Skip to content

Commit 848fb08

Browse files
committed
linux: add affinity+NUMA syscalls for 3 MIPS common ABIs
Signed-off-by: Brice Goglin <[email protected]>
1 parent 01f5578 commit 848fb08

File tree

1 file changed

+42
-4
lines changed

1 file changed

+42
-4
lines changed

hwloc/topology-linux.c

+42-4
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,12 @@ struct hwloc_linux_backend_data_s {
107107
# define __NR_sched_setaffinity 241
108108
# elif defined(__loongarch__)
109109
# define __NR_sched_setaffinity 122
110-
/*# elif defined(__mips__)
111-
# define __NR_sched_setaffinity TODO (32/64/nabi) */
110+
# elif defined(__mips__) && _MIPS_SIM == _ABI64
111+
# define __NR_sched_setaffinity 5195
112+
# elif defined(__mips__) && _MIPS_SIM == _ABIN32
113+
# define __NR_sched_setaffinity 6195
114+
# elif defined(__mips__) && _MIPS_SIM == _ABIO32
115+
# define __NR_sched_setaffinity 4239
112116
# else
113117
# warning "don't know the syscall number for sched_setaffinity on this architecture, will not support binding"
114118
# define sched_setaffinity(pid, lg, mask) (errno = ENOSYS, -1)
@@ -146,8 +150,12 @@ struct hwloc_linux_backend_data_s {
146150
# define __NR_sched_getaffinity 242
147151
# elif defined(__loongarch__)
148152
# define __NR_sched_getaffinity 123
149-
/*# elif defined(__mips__)
150-
# define __NR_sched_getaffinity TODO (32/64/nabi) */
153+
# elif defined(__mips__) && _MIPS_SIM == _ABI64
154+
# define __NR_sched_getaffinity 5196
155+
# elif defined(__mips__) && _MIPS_SIM == _ABIN32
156+
# define __NR_sched_getaffinity 6196
157+
# elif defined(__mips__) && _MIPS_SIM == _ABIO32
158+
# define __NR_sched_getaffinity 4240
151159
# else
152160
# warning "don't know the syscall number for sched_getaffinity on this architecture, will not support getting binding"
153161
# define sched_getaffinity(pid, lg, mask) (errno = ENOSYS, -1)
@@ -224,6 +232,12 @@ struct hwloc_linux_backend_data_s {
224232
/* sys_ni_syscall when CRIS removed in 4.17 */
225233
# elif defined(__loongarch__)
226234
# define __NR_mbind 235
235+
# elif defined(__mips__) && _MIPS_SIM == _ABI64
236+
# define __NR_mbind 5227
237+
# elif defined(__mips__) && _MIPS_SIM == _ABIN32
238+
# define __NR_mbind 6231
239+
# elif defined(__mips__) && _MIPS_SIM == _ABIO32
240+
# define __NR_mbind 4268
227241
# endif
228242
#endif
229243
static __hwloc_inline long hwloc_mbind(void *addr __hwloc_attribute_unused,
@@ -271,6 +285,12 @@ static __hwloc_inline long hwloc_mbind(void *addr __hwloc_attribute_unused,
271285
/* sys_ni_syscall when CRIS removed in 4.17 */
272286
# elif defined(__loongarch__)
273287
# define __NR_set_mempolicy 237
288+
# elif defined(__mips__) && _MIPS_SIM == _ABI64
289+
# define __NR_set_mempolicy 5229
290+
# elif defined(__mips__) && _MIPS_SIM == _ABIN32
291+
# define __NR_set_mempolicy 6233
292+
# elif defined(__mips__) && _MIPS_SIM == _ABIO32
293+
# define __NR_set_mempolicy 4270
274294
# endif
275295
#endif
276296
static __hwloc_inline long hwloc_set_mempolicy(int mode __hwloc_attribute_unused,
@@ -315,6 +335,12 @@ static __hwloc_inline long hwloc_set_mempolicy(int mode __hwloc_attribute_unused
315335
/* sys_ni_syscall when CRIS removed in 4.17 */
316336
# elif defined(__loongarch__)
317337
# define __NR_get_mempolicy 236
338+
# elif defined(__mips__) && _MIPS_SIM == _ABI64
339+
# define __NR_get_mempolicy 5228
340+
# elif defined(__mips__) && _MIPS_SIM == _ABIN32
341+
# define __NR_get_mempolicy 6232
342+
# elif defined(__mips__) && _MIPS_SIM == _ABIO32
343+
# define __NR_get_mempolicy 4269
318344
# endif
319345
#endif
320346
static __hwloc_inline long hwloc_get_mempolicy(int *mode __hwloc_attribute_unused,
@@ -361,6 +387,12 @@ static __hwloc_inline long hwloc_get_mempolicy(int *mode __hwloc_attribute_unuse
361387
# define __NR_migrate_pages 294
362388
# elif defined(__loongarch__)
363389
# define __NR_migrate_pages 238
390+
# elif defined(__mips__) && _MIPS_SIM == _ABI64
391+
# define __NR_migrate_pages 5246
392+
# elif defined(__mips__) && _MIPS_SIM == _ABIN32
393+
# define __NR_migrate_pages 6250
394+
# elif defined(__mips__) && _MIPS_SIM == _ABIO32
395+
# define __NR_migrate_pages 4287
364396
# endif
365397
#endif
366398
static __hwloc_inline long hwloc_migrate_pages(int pid __hwloc_attribute_unused,
@@ -406,6 +438,12 @@ static __hwloc_inline long hwloc_migrate_pages(int pid __hwloc_attribute_unused,
406438
# define __NR_migrate_pages 317
407439
# elif defined(__loongarch__)
408440
# define __NR_move_pages 239
441+
# elif defined(__mips__) && _MIPS_SIM == _ABI64
442+
# define __NR_move_pages 5267
443+
# elif defined(__mips__) && _MIPS_SIM == _ABIN32
444+
# define __NR_move_pages 6271
445+
# elif defined(__mips__) && _MIPS_SIM == _ABIO32
446+
# define __NR_move_pages 4308
409447
# endif
410448
#endif
411449
static __hwloc_inline long hwloc_move_pages(int pid __hwloc_attribute_unused,

0 commit comments

Comments
 (0)