| Hollis Blanchard | 75f74f0 | 2008-11-05 09:36:16 -0600 | [diff] [blame] | 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. 2008 | 
|  | 16 | * | 
|  | 17 | * Authors: Hollis Blanchard <hollisb@us.ibm.com> | 
|  | 18 | */ | 
|  | 19 |  | 
|  | 20 | #ifndef __KVM_BOOKE_H__ | 
|  | 21 | #define __KVM_BOOKE_H__ | 
|  | 22 |  | 
|  | 23 | #include <linux/types.h> | 
|  | 24 | #include <linux/kvm_host.h> | 
| Hollis Blanchard | 73e75b4 | 2008-12-02 15:51:57 -0600 | [diff] [blame] | 25 | #include "timing.h" | 
| Hollis Blanchard | 75f74f0 | 2008-11-05 09:36:16 -0600 | [diff] [blame] | 26 |  | 
| Hollis Blanchard | d4cf389 | 2008-11-05 09:36:23 -0600 | [diff] [blame] | 27 | /* interrupt priortity ordering */ | 
|  | 28 | #define BOOKE_IRQPRIO_DATA_STORAGE 0 | 
|  | 29 | #define BOOKE_IRQPRIO_INST_STORAGE 1 | 
|  | 30 | #define BOOKE_IRQPRIO_ALIGNMENT 2 | 
|  | 31 | #define BOOKE_IRQPRIO_PROGRAM 3 | 
|  | 32 | #define BOOKE_IRQPRIO_FP_UNAVAIL 4 | 
|  | 33 | #define BOOKE_IRQPRIO_SYSCALL 5 | 
|  | 34 | #define BOOKE_IRQPRIO_AP_UNAVAIL 6 | 
|  | 35 | #define BOOKE_IRQPRIO_DTLB_MISS 7 | 
|  | 36 | #define BOOKE_IRQPRIO_ITLB_MISS 8 | 
|  | 37 | #define BOOKE_IRQPRIO_MACHINE_CHECK 9 | 
|  | 38 | #define BOOKE_IRQPRIO_DEBUG 10 | 
|  | 39 | #define BOOKE_IRQPRIO_CRITICAL 11 | 
|  | 40 | #define BOOKE_IRQPRIO_WATCHDOG 12 | 
|  | 41 | #define BOOKE_IRQPRIO_EXTERNAL 13 | 
|  | 42 | #define BOOKE_IRQPRIO_FIT 14 | 
|  | 43 | #define BOOKE_IRQPRIO_DECREMENTER 15 | 
|  | 44 |  | 
| Hollis Blanchard | 75f74f0 | 2008-11-05 09:36:16 -0600 | [diff] [blame] | 45 | /* Helper function for "full" MSR writes. No need to call this if only EE is | 
|  | 46 | * changing. */ | 
|  | 47 | static inline void kvmppc_set_msr(struct kvm_vcpu *vcpu, u32 new_msr) | 
|  | 48 | { | 
|  | 49 | if ((new_msr & MSR_PR) != (vcpu->arch.msr & MSR_PR)) | 
|  | 50 | kvmppc_mmu_priv_switch(vcpu, new_msr & MSR_PR); | 
|  | 51 |  | 
|  | 52 | vcpu->arch.msr = new_msr; | 
|  | 53 |  | 
| Hollis Blanchard | 73e75b4 | 2008-12-02 15:51:57 -0600 | [diff] [blame] | 54 | if (vcpu->arch.msr & MSR_WE) { | 
| Hollis Blanchard | 75f74f0 | 2008-11-05 09:36:16 -0600 | [diff] [blame] | 55 | kvm_vcpu_block(vcpu); | 
| Hollis Blanchard | 73e75b4 | 2008-12-02 15:51:57 -0600 | [diff] [blame] | 56 | kvmppc_set_exit_type(vcpu, EMULATED_MTMSRWE_EXITS); | 
|  | 57 | }; | 
| Hollis Blanchard | 75f74f0 | 2008-11-05 09:36:16 -0600 | [diff] [blame] | 58 | } | 
|  | 59 |  | 
|  | 60 | #endif /* __KVM_BOOKE_H__ */ |