Commit c97b2fc6 authored by Benjamin Gray's avatar Benjamin Gray Committed by Michael Ellerman

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: default avatarBenjamin Gray <bgray@linux.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230406043320.125138-3-bgray@linux.ibm.com
parent 15f0c260
......@@ -32,6 +32,7 @@ void *find_auxv_entry(int type, char *auxv);
void *get_auxv_entry(int type);
int pick_online_cpu(void);
int bind_to_cpu(int cpu);
int parse_intmax(const char *buffer, size_t count, intmax_t *result, int base);
int parse_uintmax(const char *buffer, size_t count, uintmax_t *result, int base);
......
......@@ -14,19 +14,6 @@
#include "utils.h"
#include "lib.h"
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);
}
#define PARENT_TOKEN 0xAA
#define CHILD_TOKEN 0x55
......
......@@ -20,7 +20,6 @@ union pipe {
int fds[2];
};
extern int bind_to_cpu(int cpu);
extern int kill_child_and_wait(pid_t child_pid);
extern int wait_for_child(pid_t child_pid);
extern int sync_with_child(union pipe read_pipe, union pipe write_pipe);
......
......@@ -452,6 +452,18 @@ int pick_online_cpu(void)
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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment