1/* 2 * Copyright (c) 2014 ETH Zurich. 3 * All rights reserved. 4 * 5 * This file is distributed under the terms in the attached LICENSE file. 6 * If you do not find this file, copies can be found by writing to: 7 * ETH Zurich D-INFK, Universitaetsstrasse 6, CH-8092 Zurich. Attn: Systems Group. 8 */ 9 10#ifndef XEON_PHI_SERVICE_CLIENT_H_ 11#define XEON_PHI_SERVICE_CLIENT_H_ 12 13#define XEON_PHI_SERVICE_NAME "xeon_phi_svc" 14 15typedef errval_t (*xphi_chan_open_t)(xphi_dom_id_t domain, 16 uint64_t usrdata, 17 struct capref msgframe, 18 uint8_t type); 19 20struct xeon_phi_callbacks 21{ 22 xphi_chan_open_t open; 23}; 24 25/** 26 * \brief sets the callbacks for incoming messages 27 * 28 * \param cb Xeon Phi callbacks 29 */ 30void xeon_phi_client_set_callbacks(struct xeon_phi_callbacks *cb); 31 32/** 33 * \brief initializes the Xeon Phi client 34 * 35 * \param xid Xeon Phi ID of the card to initialize 36 */ 37errval_t xeon_phi_client_init(xphi_id_t xid); 38 39/** 40 * \brief spawns a new domain on the Xeon Phi or on the host 41 * 42 * \param xid Xeon Phi ID to start the domain 43 * \param core Core to start 44 * \param path Program to spawn 45 * \param argv Program arguments 46 * \param cap Capability to pass 47 * \param flags spawn flags 48 * \param domid returns the domain id of the spawned domain 49 * 50 * \return SYS_ERR_OK on success 51 * errval on failure 52 */ 53errval_t xeon_phi_client_spawn(xphi_id_t xid, 54 coreid_t core, 55 char *path, 56 char *argv[], 57 struct capref cap, 58 uint8_t flags, 59 xphi_dom_id_t *domid); 60 61/** 62 * \brief sends an channel open request to the domain 63 * 64 * \param xid Xeon Phi ID 65 * \param domid Domain ID 66 * \param usrdata Supplied data for the other side 67 * \param iface Interface name of the domain 68 * \param msgframe Message frame 69 * \param chantype Type of the channel 70 * 71 * \returns SYS_ERR_OK on success 72 * XEON_PHI_ERR_CLIENT_OPEN_REJCT if the client rejected 73 * errval on error 74 * 75 * The function expectes to be either the domain or the interface specified. 76 * If both are non-null then the domain ID is taken 77 */ 78errval_t xeon_phi_client_chan_open(xphi_id_t xid, 79 xphi_dom_id_t domid, 80 uint64_t usrdata, 81 struct capref msgframe, 82 xphi_chan_type_t chantype); 83 84/** 85 * \brief sends a kill request to the Xeon Phi 86 * 87 * \param xid Xeon Phi ID 88 * \param domid ID of the domain to kill 89 * 90 * \returns SYS_ERR_OK on success, 91 * XEON_PHI_ERR_CLIENT_DOMAIN_VOID, 92 * errval on error 93 */ 94errval_t xeon_phi_client_kill(xphi_id_t xid, 95 xphi_dom_id_t domid); 96 97#endif // XEON_PHI_SERVICE_CLIENT_H_ 98