xen_drm_front_evtchnl.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* SPDX-License-Identifier: GPL-2.0 OR MIT */
  2. /*
  3. * Xen para-virtual DRM device
  4. *
  5. * Copyright (C) 2016-2018 EPAM Systems Inc.
  6. *
  7. * Author: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
  8. */
  9. #ifndef __XEN_DRM_FRONT_EVTCHNL_H_
  10. #define __XEN_DRM_FRONT_EVTCHNL_H_
  11. #include <linux/completion.h>
  12. #include <linux/types.h>
  13. #include <xen/interface/io/ring.h>
  14. #include <xen/interface/io/displif.h>
  15. /*
  16. * All operations which are not connector oriented use this ctrl event channel,
  17. * e.g. fb_attach/destroy which belong to a DRM device, not to a CRTC.
  18. */
  19. #define GENERIC_OP_EVT_CHNL 0
  20. enum xen_drm_front_evtchnl_state {
  21. EVTCHNL_STATE_DISCONNECTED,
  22. EVTCHNL_STATE_CONNECTED,
  23. };
  24. enum xen_drm_front_evtchnl_type {
  25. EVTCHNL_TYPE_REQ,
  26. EVTCHNL_TYPE_EVT,
  27. };
  28. struct xen_drm_front_drm_info;
  29. struct xen_drm_front_evtchnl {
  30. struct xen_drm_front_info *front_info;
  31. int gref;
  32. int port;
  33. int irq;
  34. int index;
  35. enum xen_drm_front_evtchnl_state state;
  36. enum xen_drm_front_evtchnl_type type;
  37. /* either response id or incoming event id */
  38. u16 evt_id;
  39. /* next request id or next expected event id */
  40. u16 evt_next_id;
  41. union {
  42. struct {
  43. struct xen_displif_front_ring ring;
  44. struct completion completion;
  45. /* latest response status */
  46. int resp_status;
  47. /* serializer for backend IO: request/response */
  48. struct mutex req_io_lock;
  49. } req;
  50. struct {
  51. struct xendispl_event_page *page;
  52. } evt;
  53. } u;
  54. };
  55. struct xen_drm_front_evtchnl_pair {
  56. struct xen_drm_front_evtchnl req;
  57. struct xen_drm_front_evtchnl evt;
  58. };
  59. int xen_drm_front_evtchnl_create_all(struct xen_drm_front_info *front_info);
  60. int xen_drm_front_evtchnl_publish_all(struct xen_drm_front_info *front_info);
  61. void xen_drm_front_evtchnl_flush(struct xen_drm_front_evtchnl *evtchnl);
  62. void xen_drm_front_evtchnl_set_state(struct xen_drm_front_info *front_info,
  63. enum xen_drm_front_evtchnl_state state);
  64. void xen_drm_front_evtchnl_free_all(struct xen_drm_front_info *front_info);
  65. #endif /* __XEN_DRM_FRONT_EVTCHNL_H_ */