1e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR MIT) */ 272503791SDavid Howells /****************************************************************************** 372503791SDavid Howells * evtchn.h 472503791SDavid Howells * 572503791SDavid Howells * Interface to /dev/xen/evtchn. 672503791SDavid Howells * 772503791SDavid Howells * Copyright (c) 2003-2005, K A Fraser 872503791SDavid Howells * 972503791SDavid Howells * This program is free software; you can redistribute it and/or 1072503791SDavid Howells * modify it under the terms of the GNU General Public License version 2 1172503791SDavid Howells * as published by the Free Software Foundation; or, when distributed 1272503791SDavid Howells * separately from the Linux kernel or incorporated into other 1372503791SDavid Howells * software packages, subject to the following license: 1472503791SDavid Howells * 1572503791SDavid Howells * Permission is hereby granted, free of charge, to any person obtaining a copy 1672503791SDavid Howells * of this source file (the "Software"), to deal in the Software without 1772503791SDavid Howells * restriction, including without limitation the rights to use, copy, modify, 1872503791SDavid Howells * merge, publish, distribute, sublicense, and/or sell copies of the Software, 1972503791SDavid Howells * and to permit persons to whom the Software is furnished to do so, subject to 2072503791SDavid Howells * the following conditions: 2172503791SDavid Howells * 2272503791SDavid Howells * The above copyright notice and this permission notice shall be included in 2372503791SDavid Howells * all copies or substantial portions of the Software. 2472503791SDavid Howells * 2572503791SDavid Howells * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 2672503791SDavid Howells * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 2772503791SDavid Howells * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 2872503791SDavid Howells * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 2972503791SDavid Howells * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 3072503791SDavid Howells * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 3172503791SDavid Howells * IN THE SOFTWARE. 3272503791SDavid Howells */ 3372503791SDavid Howells 3472503791SDavid Howells #ifndef __LINUX_PUBLIC_EVTCHN_H__ 3572503791SDavid Howells #define __LINUX_PUBLIC_EVTCHN_H__ 3672503791SDavid Howells 3772503791SDavid Howells /* 3872503791SDavid Howells * Bind a fresh port to VIRQ @virq. 3972503791SDavid Howells * Return allocated port. 4072503791SDavid Howells */ 4172503791SDavid Howells #define IOCTL_EVTCHN_BIND_VIRQ \ 4272503791SDavid Howells _IOC(_IOC_NONE, 'E', 0, sizeof(struct ioctl_evtchn_bind_virq)) 4372503791SDavid Howells struct ioctl_evtchn_bind_virq { 4472503791SDavid Howells unsigned int virq; 4572503791SDavid Howells }; 4672503791SDavid Howells 4772503791SDavid Howells /* 4872503791SDavid Howells * Bind a fresh port to remote <@remote_domain, @remote_port>. 4972503791SDavid Howells * Return allocated port. 5072503791SDavid Howells */ 5172503791SDavid Howells #define IOCTL_EVTCHN_BIND_INTERDOMAIN \ 5272503791SDavid Howells _IOC(_IOC_NONE, 'E', 1, sizeof(struct ioctl_evtchn_bind_interdomain)) 5372503791SDavid Howells struct ioctl_evtchn_bind_interdomain { 5472503791SDavid Howells unsigned int remote_domain, remote_port; 5572503791SDavid Howells }; 5672503791SDavid Howells 5772503791SDavid Howells /* 5872503791SDavid Howells * Allocate a fresh port for binding to @remote_domain. 5972503791SDavid Howells * Return allocated port. 6072503791SDavid Howells */ 6172503791SDavid Howells #define IOCTL_EVTCHN_BIND_UNBOUND_PORT \ 6272503791SDavid Howells _IOC(_IOC_NONE, 'E', 2, sizeof(struct ioctl_evtchn_bind_unbound_port)) 6372503791SDavid Howells struct ioctl_evtchn_bind_unbound_port { 6472503791SDavid Howells unsigned int remote_domain; 6572503791SDavid Howells }; 6672503791SDavid Howells 6772503791SDavid Howells /* 6872503791SDavid Howells * Unbind previously allocated @port. 6972503791SDavid Howells */ 7072503791SDavid Howells #define IOCTL_EVTCHN_UNBIND \ 7172503791SDavid Howells _IOC(_IOC_NONE, 'E', 3, sizeof(struct ioctl_evtchn_unbind)) 7272503791SDavid Howells struct ioctl_evtchn_unbind { 7372503791SDavid Howells unsigned int port; 7472503791SDavid Howells }; 7572503791SDavid Howells 7672503791SDavid Howells /* 7772503791SDavid Howells * Unbind previously allocated @port. 7872503791SDavid Howells */ 7972503791SDavid Howells #define IOCTL_EVTCHN_NOTIFY \ 8072503791SDavid Howells _IOC(_IOC_NONE, 'E', 4, sizeof(struct ioctl_evtchn_notify)) 8172503791SDavid Howells struct ioctl_evtchn_notify { 8272503791SDavid Howells unsigned int port; 8372503791SDavid Howells }; 8472503791SDavid Howells 8572503791SDavid Howells /* Clear and reinitialise the event buffer. Clear error condition. */ 8672503791SDavid Howells #define IOCTL_EVTCHN_RESET \ 8772503791SDavid Howells _IOC(_IOC_NONE, 'E', 5, 0) 8872503791SDavid Howells 89fbc872c3SDavid Vrabel /* 90fbc872c3SDavid Vrabel * Restrict this file descriptor so that it can only be used to bind 91fbc872c3SDavid Vrabel * new interdomain events from one domain. 92fbc872c3SDavid Vrabel * 93fbc872c3SDavid Vrabel * Once a file descriptor has been restricted it cannot be 94fbc872c3SDavid Vrabel * de-restricted, and must be closed and re-opened. Event channels 95fbc872c3SDavid Vrabel * which were bound before restricting remain bound afterwards, and 96fbc872c3SDavid Vrabel * can be notified as usual. 97fbc872c3SDavid Vrabel */ 98fbc872c3SDavid Vrabel #define IOCTL_EVTCHN_RESTRICT_DOMID \ 99fbc872c3SDavid Vrabel _IOC(_IOC_NONE, 'E', 6, sizeof(struct ioctl_evtchn_restrict_domid)) 100fbc872c3SDavid Vrabel struct ioctl_evtchn_restrict_domid { 101fbc872c3SDavid Vrabel domid_t domid; 102fbc872c3SDavid Vrabel }; 103fbc872c3SDavid Vrabel 104*58f6259bSRahul Singh /* 105*58f6259bSRahul Singh * Bind statically allocated @port. 106*58f6259bSRahul Singh */ 107*58f6259bSRahul Singh #define IOCTL_EVTCHN_BIND_STATIC \ 108*58f6259bSRahul Singh _IOC(_IOC_NONE, 'E', 7, sizeof(struct ioctl_evtchn_bind)) 109*58f6259bSRahul Singh struct ioctl_evtchn_bind { 110*58f6259bSRahul Singh unsigned int port; 111*58f6259bSRahul Singh }; 112*58f6259bSRahul Singh 11372503791SDavid Howells #endif /* __LINUX_PUBLIC_EVTCHN_H__ */ 114