1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ 2 /* 3 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana 4 * University Research and Technology 5 * Corporation. All rights reserved. 6 * Copyright (c) 2004-2006 The University of Tennessee and The University 7 * of Tennessee Research Foundation. All rights 8 * reserved. 9 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, 10 * University of Stuttgart. All rights reserved. 11 * Copyright (c) 2004-2005 The Regents of the University of California. 12 * All rights reserved. 13 * Copyright (c) 2006 Voltaire. All rights reserved. 14 * Copyright (c) 2012-2015 NVIDIA Corporation. All rights reserved. 15 * Copyright (c) 2015 Los Alamos National Security, LLC. All rights 16 * reserved. 17 * 18 * $COPYRIGHT$ 19 * 20 * Additional copyrights may follow 21 * 22 * $HEADER$ 23 */ 24 /** 25 * @file 26 */ 27 #ifndef MCA_RCACHE_GPUSM_H 28 #define MCA_RCACHE_GPUSM_H 29 30 #include "opal_config.h" 31 #include "opal/class/opal_list.h" 32 #include "opal/mca/rcache/rcache.h" 33 34 BEGIN_C_DECLS 35 36 #define MEMHANDLE_SIZE 8 37 #define EVTHANDLE_SIZE 8 38 struct mca_rcache_gpusm_registration_t { 39 mca_rcache_base_registration_t base; 40 uint64_t memHandle[MEMHANDLE_SIZE]; /* CUipcMemHandle */ 41 uint64_t evtHandle[EVTHANDLE_SIZE]; /* CUipcEventHandle */ 42 uintptr_t event; /* CUevent */ 43 }; 44 typedef struct mca_rcache_gpusm_registration_t mca_rcache_gpusm_registration_t; 45 OPAL_DECLSPEC OBJ_CLASS_DECLARATION(mca_rcache_gpusm_registration_t); 46 47 struct mca_rcache_gpusm_component_t { 48 mca_rcache_base_component_t super; 49 }; 50 typedef struct mca_rcache_gpusm_component_t mca_rcache_gpusm_component_t; 51 52 OPAL_DECLSPEC extern mca_rcache_gpusm_component_t mca_rcache_gpusm_component; 53 54 struct mca_rcache_gpusm_module_t { 55 mca_rcache_base_module_t super; 56 opal_free_list_t reg_list; 57 }; typedef struct mca_rcache_gpusm_module_t mca_rcache_gpusm_module_t; 58 59 /* 60 * Initializes the rcache module. 61 */ 62 void mca_rcache_gpusm_module_init(mca_rcache_gpusm_module_t *rcache); 63 64 /** 65 * register block of memory 66 */ 67 int mca_rcache_gpusm_register(mca_rcache_base_module_t* rcache, void *addr, 68 size_t size, uint32_t flags, int32_t access_flags, mca_rcache_base_registration_t **reg); 69 70 /** 71 * deregister memory 72 */ 73 int mca_rcache_gpusm_deregister(mca_rcache_base_module_t *rcache, 74 mca_rcache_base_registration_t *reg); 75 76 /** 77 * find registration for a given block of memory 78 */ 79 int mca_rcache_gpusm_find(struct mca_rcache_base_module_t* rcache, void* addr, 80 size_t size, mca_rcache_base_registration_t **reg); 81 82 /** 83 * finalize rcache 84 */ 85 void mca_rcache_gpusm_finalize(struct mca_rcache_base_module_t *rcache); 86 87 END_C_DECLS 88 #endif 89