0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef __POWERPC_KVM_ASM_H__
0010 #define __POWERPC_KVM_ASM_H__
0011
0012 #ifdef __ASSEMBLY__
0013 #ifdef CONFIG_64BIT
0014 #define PPC_STD(sreg, offset, areg) std sreg, (offset)(areg)
0015 #define PPC_LD(treg, offset, areg) ld treg, (offset)(areg)
0016 #else
0017 #define PPC_STD(sreg, offset, areg) stw sreg, (offset+4)(areg)
0018 #define PPC_LD(treg, offset, areg) lwz treg, (offset+4)(areg)
0019 #endif
0020 #endif
0021
0022
0023 #define VCPU_SIZE_ORDER 4
0024 #define VCPU_SIZE_LOG (VCPU_SIZE_ORDER + 12)
0025 #define VCPU_SIZE_BYTES (1<<VCPU_SIZE_LOG)
0026
0027 #define BOOKE_INTERRUPT_CRITICAL 0
0028 #define BOOKE_INTERRUPT_MACHINE_CHECK 1
0029 #define BOOKE_INTERRUPT_DATA_STORAGE 2
0030 #define BOOKE_INTERRUPT_INST_STORAGE 3
0031 #define BOOKE_INTERRUPT_EXTERNAL 4
0032 #define BOOKE_INTERRUPT_ALIGNMENT 5
0033 #define BOOKE_INTERRUPT_PROGRAM 6
0034 #define BOOKE_INTERRUPT_FP_UNAVAIL 7
0035 #define BOOKE_INTERRUPT_SYSCALL 8
0036 #define BOOKE_INTERRUPT_AP_UNAVAIL 9
0037 #define BOOKE_INTERRUPT_DECREMENTER 10
0038 #define BOOKE_INTERRUPT_FIT 11
0039 #define BOOKE_INTERRUPT_WATCHDOG 12
0040 #define BOOKE_INTERRUPT_DTLB_MISS 13
0041 #define BOOKE_INTERRUPT_ITLB_MISS 14
0042 #define BOOKE_INTERRUPT_DEBUG 15
0043
0044
0045 #ifdef CONFIG_SPE_POSSIBLE
0046 #define BOOKE_INTERRUPT_SPE_UNAVAIL 32
0047 #define BOOKE_INTERRUPT_SPE_FP_DATA 33
0048 #define BOOKE_INTERRUPT_SPE_FP_ROUND 34
0049 #endif
0050
0051 #ifdef CONFIG_PPC_E500MC
0052 #define BOOKE_INTERRUPT_ALTIVEC_UNAVAIL 32
0053 #define BOOKE_INTERRUPT_ALTIVEC_ASSIST 33
0054 #endif
0055
0056 #define BOOKE_INTERRUPT_PERFORMANCE_MONITOR 35
0057 #define BOOKE_INTERRUPT_DOORBELL 36
0058 #define BOOKE_INTERRUPT_DOORBELL_CRITICAL 37
0059
0060
0061 #define BOOKE_INTERRUPT_GUEST_DBELL 38
0062 #define BOOKE_INTERRUPT_GUEST_DBELL_CRIT 39
0063 #define BOOKE_INTERRUPT_HV_SYSCALL 40
0064 #define BOOKE_INTERRUPT_HV_PRIV 41
0065 #define BOOKE_INTERRUPT_LRAT_ERROR 42
0066
0067
0068
0069 #define BOOK3S_INTERRUPT_SYSTEM_RESET 0x100
0070 #define BOOK3S_INTERRUPT_MACHINE_CHECK 0x200
0071 #define BOOK3S_INTERRUPT_DATA_STORAGE 0x300
0072 #define BOOK3S_INTERRUPT_DATA_SEGMENT 0x380
0073 #define BOOK3S_INTERRUPT_INST_STORAGE 0x400
0074 #define BOOK3S_INTERRUPT_INST_SEGMENT 0x480
0075 #define BOOK3S_INTERRUPT_EXTERNAL 0x500
0076 #define BOOK3S_INTERRUPT_EXTERNAL_HV 0x502
0077 #define BOOK3S_INTERRUPT_ALIGNMENT 0x600
0078 #define BOOK3S_INTERRUPT_PROGRAM 0x700
0079 #define BOOK3S_INTERRUPT_FP_UNAVAIL 0x800
0080 #define BOOK3S_INTERRUPT_DECREMENTER 0x900
0081 #define BOOK3S_INTERRUPT_HV_DECREMENTER 0x980
0082 #define BOOK3S_INTERRUPT_NESTED_HV_DECREMENTER 0x1980
0083 #define BOOK3S_INTERRUPT_DOORBELL 0xa00
0084 #define BOOK3S_INTERRUPT_SYSCALL 0xc00
0085 #define BOOK3S_INTERRUPT_TRACE 0xd00
0086 #define BOOK3S_INTERRUPT_H_DATA_STORAGE 0xe00
0087 #define BOOK3S_INTERRUPT_H_INST_STORAGE 0xe20
0088 #define BOOK3S_INTERRUPT_H_EMUL_ASSIST 0xe40
0089 #define BOOK3S_INTERRUPT_HMI 0xe60
0090 #define BOOK3S_INTERRUPT_H_DOORBELL 0xe80
0091 #define BOOK3S_INTERRUPT_H_VIRT 0xea0
0092 #define BOOK3S_INTERRUPT_PERFMON 0xf00
0093 #define BOOK3S_INTERRUPT_ALTIVEC 0xf20
0094 #define BOOK3S_INTERRUPT_VSX 0xf40
0095 #define BOOK3S_INTERRUPT_FAC_UNAVAIL 0xf60
0096 #define BOOK3S_INTERRUPT_H_FAC_UNAVAIL 0xf80
0097
0098
0099
0100 #define BOOK3S_INTERRUPT_HV_SOFTPATCH 0x1500
0101
0102
0103
0104
0105
0106
0107 #define BOOK3S_INTERRUPT_HV_RM_HARD 0x5555
0108
0109 #define BOOK3S_IRQPRIO_SYSTEM_RESET 0
0110 #define BOOK3S_IRQPRIO_DATA_SEGMENT 1
0111 #define BOOK3S_IRQPRIO_INST_SEGMENT 2
0112 #define BOOK3S_IRQPRIO_DATA_STORAGE 3
0113 #define BOOK3S_IRQPRIO_INST_STORAGE 4
0114 #define BOOK3S_IRQPRIO_ALIGNMENT 5
0115 #define BOOK3S_IRQPRIO_PROGRAM 6
0116 #define BOOK3S_IRQPRIO_FP_UNAVAIL 7
0117 #define BOOK3S_IRQPRIO_ALTIVEC 8
0118 #define BOOK3S_IRQPRIO_VSX 9
0119 #define BOOK3S_IRQPRIO_FAC_UNAVAIL 10
0120 #define BOOK3S_IRQPRIO_SYSCALL 11
0121 #define BOOK3S_IRQPRIO_MACHINE_CHECK 12
0122 #define BOOK3S_IRQPRIO_DEBUG 13
0123 #define BOOK3S_IRQPRIO_EXTERNAL 14
0124 #define BOOK3S_IRQPRIO_DECREMENTER 15
0125 #define BOOK3S_IRQPRIO_PERFORMANCE_MONITOR 16
0126 #define BOOK3S_IRQPRIO_MAX 17
0127
0128 #define BOOK3S_HFLAG_DCBZ32 0x1
0129 #define BOOK3S_HFLAG_SLB 0x2
0130 #define BOOK3S_HFLAG_PAIRED_SINGLE 0x4
0131 #define BOOK3S_HFLAG_NATIVE_PS 0x8
0132 #define BOOK3S_HFLAG_MULTI_PGSIZE 0x10
0133 #define BOOK3S_HFLAG_NEW_TLBIE 0x20
0134 #define BOOK3S_HFLAG_SPLIT_HACK 0x40
0135
0136 #define RESUME_FLAG_NV (1<<0)
0137 #define RESUME_FLAG_HOST (1<<1)
0138 #define RESUME_FLAG_ARCH1 (1<<2)
0139 #define RESUME_FLAG_ARCH2 (1<<3)
0140
0141 #define RESUME_GUEST 0
0142 #define RESUME_GUEST_NV RESUME_FLAG_NV
0143 #define RESUME_HOST RESUME_FLAG_HOST
0144 #define RESUME_HOST_NV (RESUME_FLAG_HOST|RESUME_FLAG_NV)
0145
0146 #define KVM_GUEST_MODE_NONE 0
0147 #define KVM_GUEST_MODE_GUEST 1
0148 #define KVM_GUEST_MODE_SKIP 2
0149 #define KVM_GUEST_MODE_GUEST_HV 3
0150 #define KVM_GUEST_MODE_HOST_HV 4
0151 #define KVM_GUEST_MODE_HV_P9 5
0152
0153 #define KVM_INST_FETCH_FAILED -1
0154
0155
0156 #define PO_XOP_OPCODE_MASK 0xfc0007fe
0157
0158 #endif