Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR MIT) */
0002 /******************************************************************************
0003  * evtchn.h
0004  *
0005  * Interface to /dev/xen/evtchn.
0006  *
0007  * Copyright (c) 2003-2005, K A Fraser
0008  *
0009  * This program is free software; you can redistribute it and/or
0010  * modify it under the terms of the GNU General Public License version 2
0011  * as published by the Free Software Foundation; or, when distributed
0012  * separately from the Linux kernel or incorporated into other
0013  * software packages, subject to the following license:
0014  *
0015  * Permission is hereby granted, free of charge, to any person obtaining a copy
0016  * of this source file (the "Software"), to deal in the Software without
0017  * restriction, including without limitation the rights to use, copy, modify,
0018  * merge, publish, distribute, sublicense, and/or sell copies of the Software,
0019  * and to permit persons to whom the Software is furnished to do so, subject to
0020  * the following conditions:
0021  *
0022  * The above copyright notice and this permission notice shall be included in
0023  * all copies or substantial portions of the Software.
0024  *
0025  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0026  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0027  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
0028  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
0029  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
0030  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
0031  * IN THE SOFTWARE.
0032  */
0033 
0034 #ifndef __LINUX_PUBLIC_EVTCHN_H__
0035 #define __LINUX_PUBLIC_EVTCHN_H__
0036 
0037 /*
0038  * Bind a fresh port to VIRQ @virq.
0039  * Return allocated port.
0040  */
0041 #define IOCTL_EVTCHN_BIND_VIRQ              \
0042     _IOC(_IOC_NONE, 'E', 0, sizeof(struct ioctl_evtchn_bind_virq))
0043 struct ioctl_evtchn_bind_virq {
0044     unsigned int virq;
0045 };
0046 
0047 /*
0048  * Bind a fresh port to remote <@remote_domain, @remote_port>.
0049  * Return allocated port.
0050  */
0051 #define IOCTL_EVTCHN_BIND_INTERDOMAIN           \
0052     _IOC(_IOC_NONE, 'E', 1, sizeof(struct ioctl_evtchn_bind_interdomain))
0053 struct ioctl_evtchn_bind_interdomain {
0054     unsigned int remote_domain, remote_port;
0055 };
0056 
0057 /*
0058  * Allocate a fresh port for binding to @remote_domain.
0059  * Return allocated port.
0060  */
0061 #define IOCTL_EVTCHN_BIND_UNBOUND_PORT          \
0062     _IOC(_IOC_NONE, 'E', 2, sizeof(struct ioctl_evtchn_bind_unbound_port))
0063 struct ioctl_evtchn_bind_unbound_port {
0064     unsigned int remote_domain;
0065 };
0066 
0067 /*
0068  * Unbind previously allocated @port.
0069  */
0070 #define IOCTL_EVTCHN_UNBIND             \
0071     _IOC(_IOC_NONE, 'E', 3, sizeof(struct ioctl_evtchn_unbind))
0072 struct ioctl_evtchn_unbind {
0073     unsigned int port;
0074 };
0075 
0076 /*
0077  * Unbind previously allocated @port.
0078  */
0079 #define IOCTL_EVTCHN_NOTIFY             \
0080     _IOC(_IOC_NONE, 'E', 4, sizeof(struct ioctl_evtchn_notify))
0081 struct ioctl_evtchn_notify {
0082     unsigned int port;
0083 };
0084 
0085 /* Clear and reinitialise the event buffer. Clear error condition. */
0086 #define IOCTL_EVTCHN_RESET              \
0087     _IOC(_IOC_NONE, 'E', 5, 0)
0088 
0089 /*
0090  * Restrict this file descriptor so that it can only be used to bind
0091  * new interdomain events from one domain.
0092  *
0093  * Once a file descriptor has been restricted it cannot be
0094  * de-restricted, and must be closed and re-opened.  Event channels
0095  * which were bound before restricting remain bound afterwards, and
0096  * can be notified as usual.
0097  */
0098 #define IOCTL_EVTCHN_RESTRICT_DOMID         \
0099     _IOC(_IOC_NONE, 'E', 6, sizeof(struct ioctl_evtchn_restrict_domid))
0100 struct ioctl_evtchn_restrict_domid {
0101     domid_t domid;
0102 };
0103 
0104 #endif /* __LINUX_PUBLIC_EVTCHN_H__ */