Merge tag 'block-5.11-2021-01-10' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / drivers / gpu / drm / xen / xen_drm_front_evtchnl.h
blobb0af6994332bf895e04b6d7eaa8fcc65a2491e20
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_EVTCHNL_H_
12 #define __XEN_DRM_FRONT_EVTCHNL_H_
14 #include <linux/completion.h>
15 #include <linux/types.h>
17 #include <xen/interface/io/ring.h>
18 #include <xen/interface/io/displif.h>
21 * All operations which are not connector oriented use this ctrl event channel,
22 * e.g. fb_attach/destroy which belong to a DRM device, not to a CRTC.
24 #define GENERIC_OP_EVT_CHNL 0
26 enum xen_drm_front_evtchnl_state {
27 EVTCHNL_STATE_DISCONNECTED,
28 EVTCHNL_STATE_CONNECTED,
31 enum xen_drm_front_evtchnl_type {
32 EVTCHNL_TYPE_REQ,
33 EVTCHNL_TYPE_EVT,
36 struct xen_drm_front_drm_info;
38 struct xen_drm_front_evtchnl {
39 struct xen_drm_front_info *front_info;
40 int gref;
41 int port;
42 int irq;
43 int index;
44 enum xen_drm_front_evtchnl_state state;
45 enum xen_drm_front_evtchnl_type type;
46 /* either response id or incoming event id */
47 u16 evt_id;
48 /* next request id or next expected event id */
49 u16 evt_next_id;
50 union {
51 struct {
52 struct xen_displif_front_ring ring;
53 struct completion completion;
54 /* latest response status */
55 int resp_status;
56 /* serializer for backend IO: request/response */
57 struct mutex req_io_lock;
58 } req;
59 struct {
60 struct xendispl_event_page *page;
61 } evt;
62 } u;
65 struct xen_drm_front_evtchnl_pair {
66 struct xen_drm_front_evtchnl req;
67 struct xen_drm_front_evtchnl evt;
70 int xen_drm_front_evtchnl_create_all(struct xen_drm_front_info *front_info);
72 int xen_drm_front_evtchnl_publish_all(struct xen_drm_front_info *front_info);
74 void xen_drm_front_evtchnl_flush(struct xen_drm_front_evtchnl *evtchnl);
76 void xen_drm_front_evtchnl_set_state(struct xen_drm_front_info *front_info,
77 enum xen_drm_front_evtchnl_state state);
79 void xen_drm_front_evtchnl_free_all(struct xen_drm_front_info *front_info);
81 #endif /* __XEN_DRM_FRONT_EVTCHNL_H_ */