drm/panfrost: Remove set but not used variable 'bo'
[linux/fpc-iii.git] / include / xen / xen-front-pgdir-shbuf.h
blob150ef7ec51ec25a9b3e3c35d9c325938ea8116cf
1 /* SPDX-License-Identifier: GPL-2.0 OR MIT */
3 /*
4 * Xen frontend/backend page directory based shared buffer
5 * helper module.
7 * Copyright (C) 2018 EPAM Systems Inc.
9 * Author: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
12 #ifndef __XEN_FRONT_PGDIR_SHBUF_H_
13 #define __XEN_FRONT_PGDIR_SHBUF_H_
15 #include <linux/kernel.h>
17 #include <xen/grant_table.h>
19 struct xen_front_pgdir_shbuf_ops;
21 struct xen_front_pgdir_shbuf {
23 * Number of references granted for the backend use:
25 * - for frontend allocated/imported buffers this holds the number
26 * of grant references for the page directory and the pages
27 * of the buffer
29 * - for the buffer provided by the backend this only holds the number
30 * of grant references for the page directory itself as grant
31 * references for the buffer will be provided by the backend.
33 int num_grefs;
34 grant_ref_t *grefs;
35 /* Page directory backing storage. */
36 u8 *directory;
39 * Number of pages for the shared buffer itself (excluding the page
40 * directory).
42 int num_pages;
44 * Backing storage of the shared buffer: these are the pages being
45 * shared.
47 struct page **pages;
49 struct xenbus_device *xb_dev;
51 /* These are the ops used internally depending on be_alloc mode. */
52 const struct xen_front_pgdir_shbuf_ops *ops;
54 /* Xen map handles for the buffer allocated by the backend. */
55 grant_handle_t *backend_map_handles;
58 struct xen_front_pgdir_shbuf_cfg {
59 struct xenbus_device *xb_dev;
61 /* Number of pages of the buffer backing storage. */
62 int num_pages;
63 /* Pages of the buffer to be shared. */
64 struct page **pages;
67 * This is allocated outside because there are use-cases when
68 * the buffer structure is allocated as a part of a bigger one.
70 struct xen_front_pgdir_shbuf *pgdir;
72 * Mode of grant reference sharing: if set then backend will share
73 * grant references to the buffer with the frontend.
75 int be_alloc;
78 int xen_front_pgdir_shbuf_alloc(struct xen_front_pgdir_shbuf_cfg *cfg);
80 grant_ref_t
81 xen_front_pgdir_shbuf_get_dir_start(struct xen_front_pgdir_shbuf *buf);
83 int xen_front_pgdir_shbuf_map(struct xen_front_pgdir_shbuf *buf);
85 int xen_front_pgdir_shbuf_unmap(struct xen_front_pgdir_shbuf *buf);
87 void xen_front_pgdir_shbuf_free(struct xen_front_pgdir_shbuf *buf);
89 #endif /* __XEN_FRONT_PGDIR_SHBUF_H_ */