diff options
author | Nicholas Piggin <npiggin@gmail.com> | 2018-07-03 19:25:36 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.ibm.com> | 2018-07-15 22:19:38 -0500 |
commit | 5bf03755a972f2a120731051a6fe52a597672e39 (patch) | |
tree | f3b250fa94c1aabae19187bb9a9b0a8356e73529 /core/test | |
parent | 452998f4be5973d8884e3db5aa362bf40e11467a (diff) | |
download | skiboot-5bf03755a972f2a120731051a6fe52a597672e39.zip skiboot-5bf03755a972f2a120731051a6fe52a597672e39.tar.gz skiboot-5bf03755a972f2a120731051a6fe52a597672e39.tar.bz2 |
cpu: add cpu_queue_job_on_node()
Add a job scheduling API which will run the job on the requested
chip_id (or return failure).
Includes test harness fixes from Stewart.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'core/test')
-rw-r--r-- | core/test/dummy-cpu.h | 40 | ||||
-rw-r--r-- | core/test/run-malloc-speed.c | 7 | ||||
-rw-r--r-- | core/test/run-malloc.c | 7 | ||||
-rw-r--r-- | core/test/run-mem_range_is_reserved.c | 8 | ||||
-rw-r--r-- | core/test/run-mem_region.c | 10 | ||||
-rw-r--r-- | core/test/run-mem_region_init.c | 8 | ||||
-rw-r--r-- | core/test/run-mem_region_next.c | 8 | ||||
-rw-r--r-- | core/test/run-mem_region_release_unused.c | 8 | ||||
-rw-r--r-- | core/test/run-mem_region_release_unused_noalloc.c | 8 | ||||
-rw-r--r-- | core/test/run-mem_region_reservations.c | 8 | ||||
-rw-r--r-- | core/test/stubs.c | 44 |
11 files changed, 102 insertions, 54 deletions
diff --git a/core/test/dummy-cpu.h b/core/test/dummy-cpu.h new file mode 100644 index 0000000..46f180c --- /dev/null +++ b/core/test/dummy-cpu.h @@ -0,0 +1,40 @@ +/* Copyright 2013-2018 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* A dummy cpu.h for tests. + * We don't want to include the real skiboot cpu.h, it's PPC-specific + */ + +#ifndef __CPU_H +#define __CPU_H + +#include <stdint.h> +#include <stdbool.h> + +static unsigned int cpu_max_pir = 1; +struct cpu_thread { + unsigned int chip_id; +}; +struct cpu_job *__cpu_queue_job(struct cpu_thread *cpu, + const char *name, + void (*func)(void *data), void *data, + bool no_return); +void cpu_wait_job(struct cpu_job *job, bool free_it); +void cpu_process_local_jobs(void); +struct cpu_job *cpu_queue_job_on_node(uint32_t chip_id, + const char *name, + void (*func)(void *data), void *data); +#endif /* __CPU_H */ diff --git a/core/test/run-malloc-speed.c b/core/test/run-malloc-speed.c index d842bd6..8ecef3a 100644 --- a/core/test/run-malloc-speed.c +++ b/core/test/run-malloc-speed.c @@ -17,12 +17,7 @@ #include <config.h> #define BITS_PER_LONG (sizeof(long) * 8) -/* Don't include this, it's PPC-specific */ -#define __CPU_H -static unsigned int cpu_max_pir = 1; -struct cpu_thread { - unsigned int chip_id; -}; +#include "dummy-cpu.h" #include <stdlib.h> diff --git a/core/test/run-malloc.c b/core/test/run-malloc.c index 2feaacb..0204e77 100644 --- a/core/test/run-malloc.c +++ b/core/test/run-malloc.c @@ -18,12 +18,7 @@ #define BITS_PER_LONG (sizeof(long) * 8) -/* Don't include this, it's PPC-specific */ -#define __CPU_H -static unsigned int cpu_max_pir = 1; -struct cpu_thread { - unsigned int chip_id; -}; +#include "dummy-cpu.h" #include <stdlib.h> diff --git a/core/test/run-mem_range_is_reserved.c b/core/test/run-mem_range_is_reserved.c index 37f7db3..f44f1c2 100644 --- a/core/test/run-mem_range_is_reserved.c +++ b/core/test/run-mem_range_is_reserved.c @@ -17,12 +17,8 @@ #include <config.h> #define BITS_PER_LONG (sizeof(long) * 8) -/* Don't include this, it's PPC-specific */ -#define __CPU_H -static unsigned int cpu_max_pir = 1; -struct cpu_thread { - unsigned int chip_id; -}; + +#include "dummy-cpu.h" #include <stdlib.h> diff --git a/core/test/run-mem_region.c b/core/test/run-mem_region.c index f2506d6..1fd2093 100644 --- a/core/test/run-mem_region.c +++ b/core/test/run-mem_region.c @@ -15,14 +15,12 @@ */ #include <config.h> +#include <stdbool.h> +#include <stdint.h> #define BITS_PER_LONG (sizeof(long) * 8) -/* Don't include this, it's PPC-specific */ -#define __CPU_H -static unsigned int cpu_max_pir = 1; -struct cpu_thread { - unsigned int chip_id; -}; + +#include "dummy-cpu.h" #include <stdlib.h> #include <string.h> diff --git a/core/test/run-mem_region_init.c b/core/test/run-mem_region_init.c index f1028da..f70d70f 100644 --- a/core/test/run-mem_region_init.c +++ b/core/test/run-mem_region_init.c @@ -17,12 +17,8 @@ #include <config.h> #define BITS_PER_LONG (sizeof(long) * 8) -/* Don't include this, it's PPC-specific */ -#define __CPU_H -static unsigned int cpu_max_pir = 1; -struct cpu_thread { - unsigned int chip_id; -}; + +#include "dummy-cpu.h" #include <stdlib.h> diff --git a/core/test/run-mem_region_next.c b/core/test/run-mem_region_next.c index 72d02a9..fec5df8 100644 --- a/core/test/run-mem_region_next.c +++ b/core/test/run-mem_region_next.c @@ -17,12 +17,8 @@ #include <config.h> #define BITS_PER_LONG (sizeof(long) * 8) -/* Don't include this, it's PPC-specific */ -#define __CPU_H -static unsigned int cpu_max_pir = 1; -struct cpu_thread { - unsigned int chip_id; -}; + +#include "dummy-cpu.h" #include <stdlib.h> #include <string.h> diff --git a/core/test/run-mem_region_release_unused.c b/core/test/run-mem_region_release_unused.c index fdd273a..4fe62ca 100644 --- a/core/test/run-mem_region_release_unused.c +++ b/core/test/run-mem_region_release_unused.c @@ -17,12 +17,8 @@ #include <config.h> #define BITS_PER_LONG (sizeof(long) * 8) -/* Don't include this, it's PPC-specific */ -#define __CPU_H -static unsigned int cpu_max_pir = 1; -struct cpu_thread { - unsigned int chip_id; -}; + +#include "dummy-cpu.h" #include <stdlib.h> diff --git a/core/test/run-mem_region_release_unused_noalloc.c b/core/test/run-mem_region_release_unused_noalloc.c index 6ae7959..fe57135 100644 --- a/core/test/run-mem_region_release_unused_noalloc.c +++ b/core/test/run-mem_region_release_unused_noalloc.c @@ -17,12 +17,8 @@ #include <config.h> #define BITS_PER_LONG (sizeof(long) * 8) -/* Don't include this, it's PPC-specific */ -#define __CPU_H -static unsigned int cpu_max_pir = 1; -struct cpu_thread { - unsigned int chip_id; -}; + +#include "dummy-cpu.h" #include <stdlib.h> diff --git a/core/test/run-mem_region_reservations.c b/core/test/run-mem_region_reservations.c index ae88582..b0e4847 100644 --- a/core/test/run-mem_region_reservations.c +++ b/core/test/run-mem_region_reservations.c @@ -17,12 +17,8 @@ #include <config.h> #define BITS_PER_LONG (sizeof(long) * 8) -/* Don't include this, it's PPC-specific */ -#define __CPU_H -static unsigned int cpu_max_pir = 1; -struct cpu_thread { - unsigned int chip_id; -}; + +#include "dummy-cpu.h" #include <stdlib.h> diff --git a/core/test/stubs.c b/core/test/stubs.c index 39ff18d..939e3dc 100644 --- a/core/test/stubs.c +++ b/core/test/stubs.c @@ -16,6 +16,7 @@ #include <stdlib.h> #include <stdio.h> #include <stdarg.h> +#include <stdint.h> #include "../../ccan/list/list.c" @@ -41,6 +42,49 @@ static void stub_function(void) abort(); } +struct cpu_thread; + +struct cpu_job *__cpu_queue_job(struct cpu_thread *cpu, + const char *name, + void (*func)(void *data), void *data, + bool no_return); +void cpu_wait_job(struct cpu_job *job, bool free_it); +void cpu_process_local_jobs(void); +struct cpu_job *cpu_queue_job_on_node(uint32_t chip_id, + const char *name, + void (*func)(void *data), void *data); + +struct cpu_job *cpu_queue_job_on_node(uint32_t chip_id, + const char *name, + void (*func)(void *data), void *data) +{ + (void)chip_id; + return __cpu_queue_job(NULL, name, func, data, false); +} + +struct cpu_job *__cpu_queue_job(struct cpu_thread *cpu, + const char *name, + void (*func)(void *data), void *data, + bool no_return) +{ + (void)cpu; + (void)name; + (func)(data); + (void)no_return; + return NULL; +} + +void cpu_wait_job(struct cpu_job *job, bool free_it) +{ + (void)job; + (void)free_it; + return; +} + +void cpu_process_local_jobs(void) +{ +} + #define STUB(fnname) \ void fnname(void) __attribute__((weak, alias ("stub_function"))) |