vt: vt_ioctl: fix VT_DISALLOCATE freeing in-use virtual console
[linux/fpc-iii.git] / drivers / gpu / drm / xen / xen_drm_front_shbuf.h
blob7545c692539e97bc740c7e9db508f9cee2b9893d
1 /* SPDX-License-Identifier: GPL-2.0 OR MIT */
3 /*
4 * Xen para-virtual DRM device
6 * Copyright (C) 2016-2018 EPAM Systems Inc.
8 * Author: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
9 */
11 #ifndef __XEN_DRM_FRONT_SHBUF_H_
12 #define __XEN_DRM_FRONT_SHBUF_H_
14 #include <linux/kernel.h>
15 #include <linux/scatterlist.h>
17 #include <xen/grant_table.h>
19 struct xen_drm_front_shbuf {
21 * number of references granted for the backend use:
22 * - for allocated/imported dma-buf's this holds number of grant
23 * references for the page directory and pages of the buffer
24 * - for the buffer provided by the backend this holds number of
25 * grant references for the page directory as grant references for
26 * the buffer will be provided by the backend
28 int num_grefs;
29 grant_ref_t *grefs;
30 unsigned char *directory;
32 int num_pages;
33 struct page **pages;
35 struct xenbus_device *xb_dev;
37 /* these are the ops used internally depending on be_alloc mode */
38 const struct xen_drm_front_shbuf_ops *ops;
40 /* Xen map handles for the buffer allocated by the backend */
41 grant_handle_t *backend_map_handles;
44 struct xen_drm_front_shbuf_cfg {
45 struct xenbus_device *xb_dev;
46 size_t size;
47 struct page **pages;
48 bool be_alloc;
51 struct xen_drm_front_shbuf *
52 xen_drm_front_shbuf_alloc(struct xen_drm_front_shbuf_cfg *cfg);
54 grant_ref_t xen_drm_front_shbuf_get_dir_start(struct xen_drm_front_shbuf *buf);
56 int xen_drm_front_shbuf_map(struct xen_drm_front_shbuf *buf);
58 int xen_drm_front_shbuf_unmap(struct xen_drm_front_shbuf *buf);
60 void xen_drm_front_shbuf_flush(struct xen_drm_front_shbuf *buf);
62 void xen_drm_front_shbuf_free(struct xen_drm_front_shbuf *buf);
64 #endif /* __XEN_DRM_FRONT_SHBUF_H_ */