![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0 OR MIT */ 0002 0003 /* 0004 * Xen frontend/backend page directory based shared buffer 0005 * helper module. 0006 * 0007 * Copyright (C) 2018 EPAM Systems Inc. 0008 * 0009 * Author: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com> 0010 */ 0011 0012 #ifndef __XEN_FRONT_PGDIR_SHBUF_H_ 0013 #define __XEN_FRONT_PGDIR_SHBUF_H_ 0014 0015 #include <linux/kernel.h> 0016 0017 #include <xen/grant_table.h> 0018 0019 struct xen_front_pgdir_shbuf_ops; 0020 0021 struct xen_front_pgdir_shbuf { 0022 /* 0023 * Number of references granted for the backend use: 0024 * 0025 * - for frontend allocated/imported buffers this holds the number 0026 * of grant references for the page directory and the pages 0027 * of the buffer 0028 * 0029 * - for the buffer provided by the backend this only holds the number 0030 * of grant references for the page directory itself as grant 0031 * references for the buffer will be provided by the backend. 0032 */ 0033 int num_grefs; 0034 grant_ref_t *grefs; 0035 /* Page directory backing storage. */ 0036 u8 *directory; 0037 0038 /* 0039 * Number of pages for the shared buffer itself (excluding the page 0040 * directory). 0041 */ 0042 int num_pages; 0043 /* 0044 * Backing storage of the shared buffer: these are the pages being 0045 * shared. 0046 */ 0047 struct page **pages; 0048 0049 struct xenbus_device *xb_dev; 0050 0051 /* These are the ops used internally depending on be_alloc mode. */ 0052 const struct xen_front_pgdir_shbuf_ops *ops; 0053 0054 /* Xen map handles for the buffer allocated by the backend. */ 0055 grant_handle_t *backend_map_handles; 0056 }; 0057 0058 struct xen_front_pgdir_shbuf_cfg { 0059 struct xenbus_device *xb_dev; 0060 0061 /* Number of pages of the buffer backing storage. */ 0062 int num_pages; 0063 /* Pages of the buffer to be shared. */ 0064 struct page **pages; 0065 0066 /* 0067 * This is allocated outside because there are use-cases when 0068 * the buffer structure is allocated as a part of a bigger one. 0069 */ 0070 struct xen_front_pgdir_shbuf *pgdir; 0071 /* 0072 * Mode of grant reference sharing: if set then backend will share 0073 * grant references to the buffer with the frontend. 0074 */ 0075 int be_alloc; 0076 }; 0077 0078 int xen_front_pgdir_shbuf_alloc(struct xen_front_pgdir_shbuf_cfg *cfg); 0079 0080 grant_ref_t 0081 xen_front_pgdir_shbuf_get_dir_start(struct xen_front_pgdir_shbuf *buf); 0082 0083 int xen_front_pgdir_shbuf_map(struct xen_front_pgdir_shbuf *buf); 0084 0085 int xen_front_pgdir_shbuf_unmap(struct xen_front_pgdir_shbuf *buf); 0086 0087 void xen_front_pgdir_shbuf_free(struct xen_front_pgdir_shbuf *buf); 0088 0089 #endif /* __XEN_FRONT_PGDIR_SHBUF_H_ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |