evtchn.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR MIT) */
  2. /******************************************************************************
  3. * evtchn.h
  4. *
  5. * Interface to /dev/xen/evtchn.
  6. *
  7. * Copyright (c) 2003-2005, K A Fraser
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License version 2
  11. * as published by the Free Software Foundation; or, when distributed
  12. * separately from the Linux kernel or incorporated into other
  13. * software packages, subject to the following license:
  14. *
  15. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16. * of this source file (the "Software"), to deal in the Software without
  17. * restriction, including without limitation the rights to use, copy, modify,
  18. * merge, publish, distribute, sublicense, and/or sell copies of the Software,
  19. * and to permit persons to whom the Software is furnished to do so, subject to
  20. * the following conditions:
  21. *
  22. * The above copyright notice and this permission notice shall be included in
  23. * all copies or substantial portions of the Software.
  24. *
  25. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  26. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  27. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  28. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  29. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  30. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  31. * IN THE SOFTWARE.
  32. */
  33. #ifndef __LINUX_PUBLIC_EVTCHN_H__
  34. #define __LINUX_PUBLIC_EVTCHN_H__
  35. /*
  36. * Bind a fresh port to VIRQ @virq.
  37. * Return allocated port.
  38. */
  39. #define IOCTL_EVTCHN_BIND_VIRQ \
  40. _IOC(_IOC_NONE, 'E', 0, sizeof(struct ioctl_evtchn_bind_virq))
  41. struct ioctl_evtchn_bind_virq {
  42. unsigned int virq;
  43. };
  44. /*
  45. * Bind a fresh port to remote <@remote_domain, @remote_port>.
  46. * Return allocated port.
  47. */
  48. #define IOCTL_EVTCHN_BIND_INTERDOMAIN \
  49. _IOC(_IOC_NONE, 'E', 1, sizeof(struct ioctl_evtchn_bind_interdomain))
  50. struct ioctl_evtchn_bind_interdomain {
  51. unsigned int remote_domain, remote_port;
  52. };
  53. /*
  54. * Allocate a fresh port for binding to @remote_domain.
  55. * Return allocated port.
  56. */
  57. #define IOCTL_EVTCHN_BIND_UNBOUND_PORT \
  58. _IOC(_IOC_NONE, 'E', 2, sizeof(struct ioctl_evtchn_bind_unbound_port))
  59. struct ioctl_evtchn_bind_unbound_port {
  60. unsigned int remote_domain;
  61. };
  62. /*
  63. * Unbind previously allocated @port.
  64. */
  65. #define IOCTL_EVTCHN_UNBIND \
  66. _IOC(_IOC_NONE, 'E', 3, sizeof(struct ioctl_evtchn_unbind))
  67. struct ioctl_evtchn_unbind {
  68. unsigned int port;
  69. };
  70. /*
  71. * Unbind previously allocated @port.
  72. */
  73. #define IOCTL_EVTCHN_NOTIFY \
  74. _IOC(_IOC_NONE, 'E', 4, sizeof(struct ioctl_evtchn_notify))
  75. struct ioctl_evtchn_notify {
  76. unsigned int port;
  77. };
  78. /* Clear and reinitialise the event buffer. Clear error condition. */
  79. #define IOCTL_EVTCHN_RESET \
  80. _IOC(_IOC_NONE, 'E', 5, 0)
  81. /*
  82. * Restrict this file descriptor so that it can only be used to bind
  83. * new interdomain events from one domain.
  84. *
  85. * Once a file descriptor has been restricted it cannot be
  86. * de-restricted, and must be closed and re-opened. Event channels
  87. * which were bound before restricting remain bound afterwards, and
  88. * can be notified as usual.
  89. */
  90. #define IOCTL_EVTCHN_RESTRICT_DOMID \
  91. _IOC(_IOC_NONE, 'E', 6, sizeof(struct ioctl_evtchn_restrict_domid))
  92. struct ioctl_evtchn_restrict_domid {
  93. domid_t domid;
  94. };
  95. #endif /* __LINUX_PUBLIC_EVTCHN_H__ */