diff options
author | Benjamin Gray <bgray@linux.ibm.com> | 2023-04-06 07:33:15 +0300 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2023-04-20 06:21:45 +0300 |
commit | c97b2fc6627e1c26a3a84633e135322918a1e592 (patch) | |
tree | f856dff3d02187b4673530065eaa81392955fb95 /tools/testing/selftests/powerpc/utils.c | |
parent | 15f0c2601e141e3c01c8dc3368b81181bc1c9228 (diff) | |
download | linux-c97b2fc6627e1c26a3a84633e135322918a1e592.tar.xz |
selftests/powerpc: Move bind_to_cpu() to utils.h
This function will be useful in the DSCR test patches later in this
series, so promote it to be shared by all powerpc selftests.
Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230406043320.125138-3-bgray@linux.ibm.com
Diffstat (limited to 'tools/testing/selftests/powerpc/utils.c')
-rw-r--r-- | tools/testing/selftests/powerpc/utils.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/testing/selftests/powerpc/utils.c b/tools/testing/selftests/powerpc/utils.c index 7c8cfedb012a..cdb996dba703 100644 --- a/tools/testing/selftests/powerpc/utils.c +++ b/tools/testing/selftests/powerpc/utils.c @@ -452,6 +452,18 @@ done: return cpu; } +int bind_to_cpu(int cpu) +{ + cpu_set_t mask; + + printf("Binding to cpu %d\n", cpu); + + CPU_ZERO(&mask); + CPU_SET(cpu, &mask); + + return sched_setaffinity(0, sizeof(mask), &mask); +} + bool is_ppc64le(void) { struct utsname uts; |