![]() |
|
|||
0001 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR MIT) */ 0002 /****************************************************************************** 0003 * privcmd.h 0004 * 0005 * Interface to /proc/xen/privcmd. 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_PRIVCMD_H__ 0035 #define __LINUX_PUBLIC_PRIVCMD_H__ 0036 0037 #include <linux/types.h> 0038 #include <linux/compiler.h> 0039 #include <xen/interface/xen.h> 0040 0041 struct privcmd_hypercall { 0042 __u64 op; 0043 __u64 arg[5]; 0044 }; 0045 0046 struct privcmd_mmap_entry { 0047 __u64 va; 0048 /* 0049 * This should be a GFN. It's not possible to change the name because 0050 * it's exposed to the user-space. 0051 */ 0052 __u64 mfn; 0053 __u64 npages; 0054 }; 0055 0056 struct privcmd_mmap { 0057 int num; 0058 domid_t dom; /* target domain */ 0059 struct privcmd_mmap_entry __user *entry; 0060 }; 0061 0062 struct privcmd_mmapbatch { 0063 int num; /* number of pages to populate */ 0064 domid_t dom; /* target domain */ 0065 __u64 addr; /* virtual address */ 0066 xen_pfn_t __user *arr; /* array of mfns - or'd with 0067 PRIVCMD_MMAPBATCH_*_ERROR on err */ 0068 }; 0069 0070 #define PRIVCMD_MMAPBATCH_MFN_ERROR 0xf0000000U 0071 #define PRIVCMD_MMAPBATCH_PAGED_ERROR 0x80000000U 0072 0073 struct privcmd_mmapbatch_v2 { 0074 unsigned int num; /* number of pages to populate */ 0075 domid_t dom; /* target domain */ 0076 __u64 addr; /* virtual address */ 0077 const xen_pfn_t __user *arr; /* array of mfns */ 0078 int __user *err; /* array of error codes */ 0079 }; 0080 0081 struct privcmd_dm_op_buf { 0082 void __user *uptr; 0083 size_t size; 0084 }; 0085 0086 struct privcmd_dm_op { 0087 domid_t dom; 0088 __u16 num; 0089 const struct privcmd_dm_op_buf __user *ubufs; 0090 }; 0091 0092 struct privcmd_mmap_resource { 0093 domid_t dom; 0094 __u32 type; 0095 __u32 id; 0096 __u32 idx; 0097 __u64 num; 0098 __u64 addr; 0099 }; 0100 0101 /* 0102 * @cmd: IOCTL_PRIVCMD_HYPERCALL 0103 * @arg: &privcmd_hypercall_t 0104 * Return: Value returned from execution of the specified hypercall. 0105 * 0106 * @cmd: IOCTL_PRIVCMD_MMAPBATCH_V2 0107 * @arg: &struct privcmd_mmapbatch_v2 0108 * Return: 0 on success (i.e., arg->err contains valid error codes for 0109 * each frame). On an error other than a failed frame remap, -1 is 0110 * returned and errno is set to EINVAL, EFAULT etc. As an exception, 0111 * if the operation was otherwise successful but any frame failed with 0112 * -ENOENT, then -1 is returned and errno is set to ENOENT. 0113 */ 0114 #define IOCTL_PRIVCMD_HYPERCALL \ 0115 _IOC(_IOC_NONE, 'P', 0, sizeof(struct privcmd_hypercall)) 0116 #define IOCTL_PRIVCMD_MMAP \ 0117 _IOC(_IOC_NONE, 'P', 2, sizeof(struct privcmd_mmap)) 0118 #define IOCTL_PRIVCMD_MMAPBATCH \ 0119 _IOC(_IOC_NONE, 'P', 3, sizeof(struct privcmd_mmapbatch)) 0120 #define IOCTL_PRIVCMD_MMAPBATCH_V2 \ 0121 _IOC(_IOC_NONE, 'P', 4, sizeof(struct privcmd_mmapbatch_v2)) 0122 #define IOCTL_PRIVCMD_DM_OP \ 0123 _IOC(_IOC_NONE, 'P', 5, sizeof(struct privcmd_dm_op)) 0124 #define IOCTL_PRIVCMD_RESTRICT \ 0125 _IOC(_IOC_NONE, 'P', 6, sizeof(domid_t)) 0126 #define IOCTL_PRIVCMD_MMAP_RESOURCE \ 0127 _IOC(_IOC_NONE, 'P', 7, sizeof(struct privcmd_mmap_resource)) 0128 0129 #endif /* __LINUX_PUBLIC_PRIVCMD_H__ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |