linux/arch/powerpc/include/asm/kvm_host.h
<<
>>
Prefs
   1/*
   2 * This program is free software; you can redistribute it and/or modify
   3 * it under the terms of the GNU General Public License, version 2, as
   4 * published by the Free Software Foundation.
   5 *
   6 * This program is distributed in the hope that it will be useful,
   7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
   8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   9 * GNU General Public License for more details.
  10 *
  11 * You should have received a copy of the GNU General Public License
  12 * along with this program; if not, write to the Free Software
  13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  14 *
  15 * Copyright IBM Corp. 2007
  16 *
  17 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
  18 */
  19
  20#ifndef __POWERPC_KVM_HOST_H__
  21#define __POWERPC_KVM_HOST_H__
  22
  23#include <linux/mutex.h>
  24#include <linux/timer.h>
  25#include <linux/types.h>
  26#include <linux/kvm_types.h>
  27#include <asm/kvm_asm.h>
  28
  29#define KVM_MAX_VCPUS 1
  30#define KVM_MEMORY_SLOTS 32
  31/* memory slots that does not exposed to userspace */
  32#define KVM_PRIVATE_MEM_SLOTS 4
  33
  34#define KVM_COALESCED_MMIO_PAGE_OFFSET 1
  35
  36/* We don't currently support large pages. */
  37#define KVM_NR_PAGE_SIZES       1
  38#define KVM_PAGES_PER_HPAGE(x)  (1UL<<31)
  39
  40struct kvm;
  41struct kvm_run;
  42struct kvm_vcpu;
  43
  44struct kvm_vm_stat {
  45        u32 remote_tlb_flush;
  46};
  47
  48struct kvm_vcpu_stat {
  49        u32 sum_exits;
  50        u32 mmio_exits;
  51        u32 dcr_exits;
  52        u32 signal_exits;
  53        u32 light_exits;
  54        /* Account for special types of light exits: */
  55        u32 itlb_real_miss_exits;
  56        u32 itlb_virt_miss_exits;
  57        u32 dtlb_real_miss_exits;
  58        u32 dtlb_virt_miss_exits;
  59        u32 syscall_exits;
  60        u32 isi_exits;
  61        u32 dsi_exits;
  62        u32 emulated_inst_exits;
  63        u32 dec_exits;
  64        u32 ext_intr_exits;
  65        u32 halt_wakeup;
  66};
  67
  68enum kvm_exit_types {
  69        MMIO_EXITS,
  70        DCR_EXITS,
  71        SIGNAL_EXITS,
  72        ITLB_REAL_MISS_EXITS,
  73        ITLB_VIRT_MISS_EXITS,
  74        DTLB_REAL_MISS_EXITS,
  75        DTLB_VIRT_MISS_EXITS,
  76        SYSCALL_EXITS,
  77        ISI_EXITS,
  78        DSI_EXITS,
  79        EMULATED_INST_EXITS,
  80        EMULATED_MTMSRWE_EXITS,
  81        EMULATED_WRTEE_EXITS,
  82        EMULATED_MTSPR_EXITS,
  83        EMULATED_MFSPR_EXITS,
  84        EMULATED_MTMSR_EXITS,
  85        EMULATED_MFMSR_EXITS,
  86        EMULATED_TLBSX_EXITS,
  87        EMULATED_TLBWE_EXITS,
  88        EMULATED_RFI_EXITS,
  89        DEC_EXITS,
  90        EXT_INTR_EXITS,
  91        HALT_WAKEUP,
  92        USR_PR_INST,
  93        FP_UNAVAIL,
  94        DEBUG_EXITS,
  95        TIMEINGUEST,
  96        __NUMBER_OF_KVM_EXIT_TYPES
  97};
  98
  99/* allow access to big endian 32bit upper/lower parts and 64bit var */
 100struct kvmppc_exit_timing {
 101        union {
 102                u64 tv64;
 103                struct {
 104                        u32 tbu, tbl;
 105                } tv32;
 106        };
 107};
 108
 109struct kvm_arch {
 110};
 111
 112struct kvm_vcpu_arch {
 113        u32 host_stack;
 114        u32 host_pid;
 115
 116        u64 fpr[32];
 117        ulong gpr[32];
 118
 119        ulong pc;
 120        u32 cr;
 121        ulong ctr;
 122        ulong lr;
 123        ulong xer;
 124
 125        ulong msr;
 126        u32 mmucr;
 127        ulong sprg0;
 128        ulong sprg1;
 129        ulong sprg2;
 130        ulong sprg3;
 131        ulong sprg4;
 132        ulong sprg5;
 133        ulong sprg6;
 134        ulong sprg7;
 135        ulong srr0;
 136        ulong srr1;
 137        ulong csrr0;
 138        ulong csrr1;
 139        ulong dsrr0;
 140        ulong dsrr1;
 141        ulong dear;
 142        ulong esr;
 143        u32 dec;
 144        u32 decar;
 145        u32 tbl;
 146        u32 tbu;
 147        u32 tcr;
 148        u32 tsr;
 149        u32 ivor[64];
 150        ulong ivpr;
 151        u32 pir;
 152
 153        u32 shadow_pid;
 154        u32 pid;
 155        u32 swap_pid;
 156
 157        u32 ccr0;
 158        u32 ccr1;
 159        u32 dbcr0;
 160        u32 dbcr1;
 161        u32 dbsr;
 162
 163#ifdef CONFIG_KVM_EXIT_TIMING
 164        struct kvmppc_exit_timing timing_exit;
 165        struct kvmppc_exit_timing timing_last_enter;
 166        u32 last_exit_type;
 167        u32 timing_count_type[__NUMBER_OF_KVM_EXIT_TYPES];
 168        u64 timing_sum_duration[__NUMBER_OF_KVM_EXIT_TYPES];
 169        u64 timing_sum_quad_duration[__NUMBER_OF_KVM_EXIT_TYPES];
 170        u64 timing_min_duration[__NUMBER_OF_KVM_EXIT_TYPES];
 171        u64 timing_max_duration[__NUMBER_OF_KVM_EXIT_TYPES];
 172        u64 timing_last_exit;
 173        struct dentry *debugfs_exit_timing;
 174#endif
 175
 176        u32 last_inst;
 177        ulong fault_dear;
 178        ulong fault_esr;
 179        gpa_t paddr_accessed;
 180
 181        u8 io_gpr; /* GPR used as IO source/target */
 182        u8 mmio_is_bigendian;
 183        u8 dcr_needed;
 184        u8 dcr_is_write;
 185
 186        u32 cpr0_cfgaddr; /* holds the last set cpr0_cfgaddr */
 187
 188        struct timer_list dec_timer;
 189        unsigned long pending_exceptions;
 190};
 191
 192#endif /* __POWERPC_KVM_HOST_H__ */
 193