1 /* 2 * PPC64 cpu-specific definitions 3 * 4 * Copyright 2011 Matt Evans <matt@ozlabs.org>, IBM Corporation. 5 * 6 * This program is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License version 2 as published 8 * by the Free Software Foundation. 9 */ 10 11 #ifndef KVM__KVM_CPU_ARCH_H 12 #define KVM__KVM_CPU_ARCH_H 13 14 /* Architecture-specific kvm_cpu definitions. */ 15 16 #include <linux/kvm.h> /* for struct kvm_regs */ 17 #include <stdbool.h> 18 #include <pthread.h> 19 20 #define MSR_SF (1ULL<<63) 21 #define MSR_HV (1ULL<<60) 22 #define MSR_VEC (1ULL<<25) 23 #define MSR_VSX (1ULL<<23) 24 #define MSR_POW (1ULL<<18) 25 #define MSR_EE (1ULL<<15) 26 #define MSR_PR (1ULL<<14) 27 #define MSR_FP (1ULL<<13) 28 #define MSR_ME (1ULL<<12) 29 #define MSR_FE0 (1ULL<<11) 30 #define MSR_SE (1ULL<<10) 31 #define MSR_BE (1ULL<<9) 32 #define MSR_FE1 (1ULL<<8) 33 #define MSR_IR (1ULL<<5) 34 #define MSR_DR (1ULL<<4) 35 #define MSR_PMM (1ULL<<2) 36 #define MSR_RI (1ULL<<1) 37 #define MSR_LE (1ULL<<0) 38 39 #define POWER7_EXT_IRQ 0 40 41 struct kvm; 42 43 struct kvm_cpu { 44 pthread_t thread; /* VCPU thread */ 45 46 unsigned long cpu_id; 47 48 struct kvm *kvm; /* parent KVM */ 49 int vcpu_fd; /* For VCPU ioctls() */ 50 struct kvm_run *kvm_run; 51 struct kvm_cpu_task *task; 52 53 struct kvm_regs regs; 54 struct kvm_sregs sregs; 55 struct kvm_fpu fpu; 56 57 u8 is_running; 58 u8 paused; 59 u8 needs_nmi; 60 /* 61 * Although PPC KVM doesn't yet support coalesced MMIO, generic code 62 * needs this in our kvm_cpu: 63 */ 64 struct kvm_coalesced_mmio_ring *ring; 65 }; 66 67 void kvm_cpu__irq(struct kvm_cpu *vcpu, int pin, int level); 68 69 /* This is never actually called on PPC. */ 70 static inline bool kvm_cpu__emulate_io(struct kvm_cpu *vcpu, u16 port, void *data, int direction, int size, u32 count) 71 { 72 return false; 73 } 74 75 bool kvm_cpu__emulate_mmio(struct kvm_cpu *vcpu, u64 phys_addr, u8 *data, u32 len, u8 is_write); 76 77 #endif /* KVM__KVM_CPU_ARCH_H */ 78