First Support on Ginger and OMAP TI
[linux-ginger.git] / arch / powerpc / kvm / booke.h
blobd59bcca1f9d8af1fa962222043a3955c68e2fe06
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.
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.
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.
15 * Copyright IBM Corp. 2008
17 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
20 #ifndef __KVM_BOOKE_H__
21 #define __KVM_BOOKE_H__
23 #include <linux/types.h>
24 #include <linux/kvm_host.h>
25 #include <asm/kvm_ppc.h>
26 #include "timing.h"
28 /* interrupt priortity ordering */
29 #define BOOKE_IRQPRIO_DATA_STORAGE 0
30 #define BOOKE_IRQPRIO_INST_STORAGE 1
31 #define BOOKE_IRQPRIO_ALIGNMENT 2
32 #define BOOKE_IRQPRIO_PROGRAM 3
33 #define BOOKE_IRQPRIO_FP_UNAVAIL 4
34 #define BOOKE_IRQPRIO_SPE_UNAVAIL 5
35 #define BOOKE_IRQPRIO_SPE_FP_DATA 6
36 #define BOOKE_IRQPRIO_SPE_FP_ROUND 7
37 #define BOOKE_IRQPRIO_SYSCALL 8
38 #define BOOKE_IRQPRIO_AP_UNAVAIL 9
39 #define BOOKE_IRQPRIO_DTLB_MISS 10
40 #define BOOKE_IRQPRIO_ITLB_MISS 11
41 #define BOOKE_IRQPRIO_MACHINE_CHECK 12
42 #define BOOKE_IRQPRIO_DEBUG 13
43 #define BOOKE_IRQPRIO_CRITICAL 14
44 #define BOOKE_IRQPRIO_WATCHDOG 15
45 #define BOOKE_IRQPRIO_EXTERNAL 16
46 #define BOOKE_IRQPRIO_FIT 17
47 #define BOOKE_IRQPRIO_DECREMENTER 18
48 #define BOOKE_IRQPRIO_PERFORMANCE_MONITOR 19
49 #define BOOKE_IRQPRIO_MAX 19
51 extern unsigned long kvmppc_booke_handlers;
53 /* Helper function for "full" MSR writes. No need to call this if only EE is
54 * changing. */
55 static inline void kvmppc_set_msr(struct kvm_vcpu *vcpu, u32 new_msr)
57 if ((new_msr & MSR_PR) != (vcpu->arch.msr & MSR_PR))
58 kvmppc_mmu_priv_switch(vcpu, new_msr & MSR_PR);
60 vcpu->arch.msr = new_msr;
62 if (vcpu->arch.msr & MSR_WE) {
63 kvm_vcpu_block(vcpu);
64 kvmppc_set_exit_type(vcpu, EMULATED_MTMSRWE_EXITS);
68 int kvmppc_booke_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
69 unsigned int inst, int *advance);
70 int kvmppc_booke_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, int rt);
71 int kvmppc_booke_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, int rs);
73 #endif /* __KVM_BOOKE_H__ */