1 /* SPDX-License-Identifier: GPL-2.0 OR MIT */
4 * Xen para-virtual DRM device
6 * Copyright (C) 2016-2018 EPAM Systems Inc.
8 * Author: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
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
{
36 struct xen_drm_front_drm_info
;
38 struct xen_drm_front_evtchnl
{
39 struct xen_drm_front_info
*front_info
;
44 enum xen_drm_front_evtchnl_state state
;
45 enum xen_drm_front_evtchnl_type type
;
46 /* either response id or incoming event id */
48 /* next request id or next expected event id */
52 struct xen_displif_front_ring ring
;
53 struct completion completion
;
54 /* latest response status */
56 /* serializer for backend IO: request/response */
57 struct mutex req_io_lock
;
60 struct xendispl_event_page
*page
;
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_ */