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