1 /* $NetBSD: xenio.h,v 1.9 2011/01/10 11:13:03 cegger Exp $ */ 2 3 /****************************************************************************** 4 * privcmd.h 5 * 6 * Copyright (c) 2003-2004, K A Fraser 7 * 8 * This file may be distributed separately from the Linux kernel, or 9 * incorporated into other software packages, subject to the following license: 10 * 11 * Permission is hereby granted, free of charge, to any person obtaining a copy 12 * of this source file (the "Software"), to deal in the Software without 13 * restriction, including without limitation the rights to use, copy, modify, 14 * merge, publish, distribute, sublicense, and/or sell copies of the Software, 15 * and to permit persons to whom the Software is furnished to do so, subject to 16 * the following conditions: 17 * 18 * The above copyright notice and this permission notice shall be included in 19 * all copies or substantial portions of the Software. 20 * 21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 27 * IN THE SOFTWARE. 28 */ 29 30 #ifndef __XEN_XENIO_H__ 31 #define __XEN_XENIO_H__ 32 33 /* Interface to /proc/xen/privcmd */ 34 35 typedef struct privcmd_hypercall 36 { 37 unsigned long op; 38 unsigned long arg[5]; 39 long retval; 40 } privcmd_hypercall_t; 41 42 typedef struct privcmd_mmap_entry { 43 unsigned long va; 44 unsigned long mfn; 45 unsigned long npages; 46 } privcmd_mmap_entry_t; 47 48 typedef struct privcmd_mmap { 49 int num; 50 domid_t dom; /* target domain */ 51 privcmd_mmap_entry_t *entry; 52 } privcmd_mmap_t; 53 54 typedef struct privcmd_mmapbatch { 55 int num; /* number of pages to populate */ 56 domid_t dom; /* target domain */ 57 unsigned long addr; /* virtual address */ 58 unsigned long *arr; /* array of mfns - top nibble set on err */ 59 } privcmd_mmapbatch_t; 60 61 typedef struct privcmd_mmapbatch_v2 { 62 int num; /* number of pages to populate */ 63 domid_t dom; /* target domain */ 64 uint64_t addr; /* virtual address */ 65 const xen_pfn_t *arr; /* array of mfns */ 66 int *err; /* array of error codes */ 67 } privcmd_mmapbatch_v2_t; 68 69 typedef struct privcmd_blkmsg 70 { 71 unsigned long op; 72 void *buf; 73 int buf_size; 74 } privcmd_blkmsg_t; 75 76 /* 77 * @cmd: IOCTL_PRIVCMD_HYPERCALL 78 * @arg: &privcmd_hypercall_t 79 * Return: Value returned from execution of the specified hypercall. 80 */ 81 #define IOCTL_PRIVCMD_HYPERCALL \ 82 _IOWR('P', 0, privcmd_hypercall_t) 83 84 #if defined(_KERNEL) 85 /* compat */ 86 #define IOCTL_PRIVCMD_INITDOMAIN_EVTCHN_OLD \ 87 _IO('P', 1) 88 89 typedef struct oprivcmd_hypercall 90 { 91 unsigned long op; 92 unsigned long arg[5]; 93 } oprivcmd_hypercall_t; 94 95 #define IOCTL_PRIVCMD_HYPERCALL_OLD \ 96 _IOWR('P', 0, oprivcmd_hypercall_t) 97 #endif /* defined(_KERNEL) */ 98 99 #define IOCTL_PRIVCMD_MMAP \ 100 _IOW('P', 2, privcmd_mmap_t) 101 #define IOCTL_PRIVCMD_MMAPBATCH \ 102 _IOW('P', 3, privcmd_mmapbatch_t) 103 #define IOCTL_PRIVCMD_GET_MACH2PHYS_START_MFN \ 104 _IOR('P', 4, unsigned long) 105 106 /* 107 * @cmd: IOCTL_PRIVCMD_INITDOMAIN_EVTCHN 108 * @arg: n/a 109 * Return: Port associated with domain-controller end of control event channel 110 * for the initial domain. 111 */ 112 #define IOCTL_PRIVCMD_INITDOMAIN_EVTCHN \ 113 _IOR('P', 5, int) 114 #define IOCTL_PRIVCMD_MMAPBATCH_V2 \ 115 _IOW('P', 6, privcmd_mmapbatch_v2_t) 116 117 /* Interface to /dev/xenevt */ 118 /* EVTCHN_RESET: Clear and reinit the event buffer. Clear error condition. */ 119 #define EVTCHN_RESET _IO('E', 1) 120 /* EVTCHN_BIND: Bind to the specified event-channel port. */ 121 #define EVTCHN_BIND _IOW('E', 2, unsigned long) 122 /* EVTCHN_UNBIND: Unbind from the specified event-channel port. */ 123 #define EVTCHN_UNBIND _IOW('E', 3, unsigned long) 124 125 #endif /* __XEN_XENIO_H__ */ 126