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