linux/arch/ia64/include/asm/kvm.h
<<
>>
Prefs
   1#ifndef __ASM_IA64_KVM_H
   2#define __ASM_IA64_KVM_H
   3
   4/*
   5 * kvm structure definitions  for ia64
   6 *
   7 * Copyright (C) 2007 Xiantao Zhang <xiantao.zhang@intel.com>
   8 *
   9 * This program is free software; you can redistribute it and/or modify it
  10 * under the terms and conditions of the GNU General Public License,
  11 * version 2, as published by the Free Software Foundation.
  12 *
  13 * This program is distributed in the hope it will be useful, but WITHOUT
  14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  15 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  16 * more details.
  17 *
  18 * You should have received a copy of the GNU General Public License along with
  19 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
  20 * Place - Suite 330, Boston, MA 02111-1307 USA.
  21 *
  22 */
  23
  24#include <linux/types.h>
  25#include <linux/ioctl.h>
  26
  27/* Select x86 specific features in <linux/kvm.h> */
  28#define __KVM_HAVE_IOAPIC
  29#define __KVM_HAVE_DEVICE_ASSIGNMENT
  30
  31/* Architectural interrupt line count. */
  32#define KVM_NR_INTERRUPTS 256
  33
  34#define KVM_IOAPIC_NUM_PINS  48
  35
  36struct kvm_ioapic_state {
  37        __u64 base_address;
  38        __u32 ioregsel;
  39        __u32 id;
  40        __u32 irr;
  41        __u32 pad;
  42        union {
  43                __u64 bits;
  44                struct {
  45                        __u8 vector;
  46                        __u8 delivery_mode:3;
  47                        __u8 dest_mode:1;
  48                        __u8 delivery_status:1;
  49                        __u8 polarity:1;
  50                        __u8 remote_irr:1;
  51                        __u8 trig_mode:1;
  52                        __u8 mask:1;
  53                        __u8 reserve:7;
  54                        __u8 reserved[4];
  55                        __u8 dest_id;
  56                } fields;
  57        } redirtbl[KVM_IOAPIC_NUM_PINS];
  58};
  59
  60#define KVM_IRQCHIP_PIC_MASTER   0
  61#define KVM_IRQCHIP_PIC_SLAVE    1
  62#define KVM_IRQCHIP_IOAPIC       2
  63
  64#define KVM_CONTEXT_SIZE        8*1024
  65
  66struct kvm_fpreg {
  67        union {
  68                unsigned long bits[2];
  69                long double __dummy;    /* force 16-byte alignment */
  70        } u;
  71};
  72
  73union context {
  74        /* 8K size */
  75        char    dummy[KVM_CONTEXT_SIZE];
  76        struct {
  77                unsigned long       psr;
  78                unsigned long       pr;
  79                unsigned long       caller_unat;
  80                unsigned long       pad;
  81                unsigned long       gr[32];
  82                unsigned long       ar[128];
  83                unsigned long       br[8];
  84                unsigned long       cr[128];
  85                unsigned long       rr[8];
  86                unsigned long       ibr[8];
  87                unsigned long       dbr[8];
  88                unsigned long       pkr[8];
  89                struct kvm_fpreg   fr[128];
  90        };
  91};
  92
  93struct thash_data {
  94        union {
  95                struct {
  96                        unsigned long p    :  1; /* 0 */
  97                        unsigned long rv1  :  1; /* 1 */
  98                        unsigned long ma   :  3; /* 2-4 */
  99                        unsigned long a    :  1; /* 5 */
 100                        unsigned long d    :  1; /* 6 */
 101                        unsigned long pl   :  2; /* 7-8 */
 102                        unsigned long ar   :  3; /* 9-11 */
 103                        unsigned long ppn  : 38; /* 12-49 */
 104                        unsigned long rv2  :  2; /* 50-51 */
 105                        unsigned long ed   :  1; /* 52 */
 106                        unsigned long ig1  : 11; /* 53-63 */
 107                };
 108                struct {
 109                        unsigned long __rv1 : 53;     /* 0-52 */
 110                        unsigned long contiguous : 1; /*53 */
 111                        unsigned long tc : 1;         /* 54 TR or TC */
 112                        unsigned long cl : 1;
 113                        /* 55 I side or D side cache line */
 114                        unsigned long len  :  4;      /* 56-59 */
 115                        unsigned long io  : 1;  /* 60 entry is for io or not */
 116                        unsigned long nomap : 1;
 117                        /* 61 entry cann't be inserted into machine TLB.*/
 118                        unsigned long checked : 1;
 119                        /* 62 for VTLB/VHPT sanity check */
 120                        unsigned long invalid : 1;
 121                        /* 63 invalid entry */
 122                };
 123                unsigned long page_flags;
 124        };                  /* same for VHPT and TLB */
 125
 126        union {
 127                struct {
 128                        unsigned long rv3  :  2;
 129                        unsigned long ps   :  6;
 130                        unsigned long key  : 24;
 131                        unsigned long rv4  : 32;
 132                };
 133                unsigned long itir;
 134        };
 135        union {
 136                struct {
 137                        unsigned long ig2  :  12;
 138                        unsigned long vpn  :  49;
 139                        unsigned long vrn  :   3;
 140                };
 141                unsigned long ifa;
 142                unsigned long vadr;
 143                struct {
 144                        unsigned long tag  :  63;
 145                        unsigned long ti   :  1;
 146                };
 147                unsigned long etag;
 148        };
 149        union {
 150                struct thash_data *next;
 151                unsigned long rid;
 152                unsigned long gpaddr;
 153        };
 154};
 155
 156#define NITRS   8
 157#define NDTRS   8
 158
 159struct saved_vpd {
 160        unsigned long  vhpi;
 161        unsigned long  vgr[16];
 162        unsigned long  vbgr[16];
 163        unsigned long  vnat;
 164        unsigned long  vbnat;
 165        unsigned long  vcpuid[5];
 166        unsigned long  vpsr;
 167        unsigned long  vpr;
 168        union {
 169                unsigned long  vcr[128];
 170                struct {
 171                        unsigned long dcr;
 172                        unsigned long itm;
 173                        unsigned long iva;
 174                        unsigned long rsv1[5];
 175                        unsigned long pta;
 176                        unsigned long rsv2[7];
 177                        unsigned long ipsr;
 178                        unsigned long isr;
 179                        unsigned long rsv3;
 180                        unsigned long iip;
 181                        unsigned long ifa;
 182                        unsigned long itir;
 183                        unsigned long iipa;
 184                        unsigned long ifs;
 185                        unsigned long iim;
 186                        unsigned long iha;
 187                        unsigned long rsv4[38];
 188                        unsigned long lid;
 189                        unsigned long ivr;
 190                        unsigned long tpr;
 191                        unsigned long eoi;
 192                        unsigned long irr[4];
 193                        unsigned long itv;
 194                        unsigned long pmv;
 195                        unsigned long cmcv;
 196                        unsigned long rsv5[5];
 197                        unsigned long lrr0;
 198                        unsigned long lrr1;
 199                        unsigned long rsv6[46];
 200                };
 201        };
 202};
 203
 204struct kvm_regs {
 205        struct saved_vpd vpd;
 206        /*Arch-regs*/
 207        int mp_state;
 208        unsigned long vmm_rr;
 209        /* TR and TC.  */
 210        struct thash_data itrs[NITRS];
 211        struct thash_data dtrs[NDTRS];
 212        /* Bit is set if there is a tr/tc for the region.  */
 213        unsigned char itr_regions;
 214        unsigned char dtr_regions;
 215        unsigned char tc_regions;
 216
 217        char irq_check;
 218        unsigned long saved_itc;
 219        unsigned long itc_check;
 220        unsigned long timer_check;
 221        unsigned long timer_pending;
 222        unsigned long last_itc;
 223
 224        unsigned long vrr[8];
 225        unsigned long ibr[8];
 226        unsigned long dbr[8];
 227        unsigned long insvc[4];         /* Interrupt in service.  */
 228        unsigned long xtp;
 229
 230        unsigned long metaphysical_rr0; /* from kvm_arch (so is pinned) */
 231        unsigned long metaphysical_rr4; /* from kvm_arch (so is pinned) */
 232        unsigned long metaphysical_saved_rr0; /* from kvm_arch          */
 233        unsigned long metaphysical_saved_rr4; /* from kvm_arch          */
 234        unsigned long fp_psr;       /*used for lazy float register */
 235        unsigned long saved_gp;
 236        /*for phycial  emulation */
 237
 238        union context saved_guest;
 239
 240        unsigned long reserved[64];     /* for future use */
 241};
 242
 243struct kvm_sregs {
 244};
 245
 246struct kvm_fpu {
 247};
 248
 249#define KVM_IA64_VCPU_STACK_SHIFT       16
 250#define KVM_IA64_VCPU_STACK_SIZE        (1UL << KVM_IA64_VCPU_STACK_SHIFT)
 251
 252struct kvm_ia64_vcpu_stack {
 253        unsigned char stack[KVM_IA64_VCPU_STACK_SIZE];
 254};
 255
 256struct kvm_debug_exit_arch {
 257};
 258
 259/* for KVM_SET_GUEST_DEBUG */
 260struct kvm_guest_debug_arch {
 261};
 262
 263#endif
 264