aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2018-10-12 11:08:34 +0300
committerMaxim Uvarov <maxim.uvarov@linaro.org>2018-11-21 18:02:14 +0300
commitf36139ea56706df2534a269039b3effca7169234 (patch)
treefe6325437c7e6f5de9ccded39d64f51a68f1af86
parent27b0ca668ec90730f6329185e23a026caf0b9064 (diff)
api: init: add new mem_model member to odp_init_t
Add new odp_mem_model_t enum for configuring application memory model. This enables an application to operate in process mode without the need to modify ODP configuration file. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> Reviewed-by: Petri Savolainen <petri.savolainen@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
-rw-r--r--include/odp/api/spec/init.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/include/odp/api/spec/init.h b/include/odp/api/spec/init.h
index ee33e7cd4..c37af464d 100644
--- a/include/odp/api/spec/init.h
+++ b/include/odp/api/spec/init.h
@@ -107,6 +107,32 @@ typedef int (*odp_log_func_t)(odp_log_level_t level, const char *fmt, ...);
typedef void (*odp_abort_func_t)(void) ODP_NORETURN;
/**
+ * Application memory model
+ */
+typedef enum {
+ /** Thread memory model: by default all memory is shareable between
+ * threads.
+ *
+ * Within a single ODP instance all ODP handles and pointers to ODP
+ * allocated data may be shared amongst threads independent of data
+ * allocation time (e.g. before or after thread creation). */
+ ODP_MEM_MODEL_THREAD = 0,
+
+ /** Process memory model: by default all memory is not shareable between
+ * processes.
+ *
+ * Within a single ODP instance all ODP handles and pointers to ODP
+ * allocated data (excluding non-single VA SHM blocks) may be shared
+ * amongst processes independent of data allocation time (e.g. before
+ * or after fork).
+ *
+ * @see ODP_SHM_SINGLE_VA
+ */
+ ODP_MEM_MODEL_PROCESS
+
+} odp_mem_model_t;
+
+/**
* Global initialization parameters
*
* These parameters may be used at global initialization time to configure and
@@ -172,6 +198,12 @@ typedef struct odp_init_t {
*/
odp_feature_t not_used;
+ /** Application memory model. The main application thread has to call
+ * odp_init_global() and odp_init_local() before creating threads that
+ * share ODP data. The default value is ODP_MEM_MODEL_THREAD.
+ */
+ odp_mem_model_t mem_model;
+
/** Shared memory parameters */
struct {
/** Maximum memory usage in bytes. This is the maximum