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