]>
Commit | Line | Data |
---|---|---|
d76d1650 AJ |
1 | /* |
2 | * Copyright 2008 IBM Corporation. | |
3 | * Authors: Hollis Blanchard <[email protected]> | |
4 | * | |
5 | * This work is licensed under the GNU GPL license version 2 or later. | |
6 | * | |
7 | */ | |
8 | ||
9 | #ifndef __KVM_PPC_H__ | |
10 | #define __KVM_PPC_H__ | |
11 | ||
2985b86b AF |
12 | #define TYPE_HOST_POWERPC_CPU "host-" TYPE_POWERPC_CPU |
13 | ||
d76d1650 | 14 | void kvmppc_init(void); |
d76d1650 | 15 | |
921e28db AG |
16 | #ifdef CONFIG_KVM |
17 | ||
dc333cd6 | 18 | uint32_t kvmppc_get_tbfreq(void); |
eadaada1 | 19 | uint64_t kvmppc_get_clockfreq(void); |
6659394f DG |
20 | uint32_t kvmppc_get_vmx(void); |
21 | uint32_t kvmppc_get_dfp(void); | |
1a61a9ae | 22 | int kvmppc_get_hasidle(CPUPPCState *env); |
1328c2bf | 23 | int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int buf_len); |
1bc22652 AF |
24 | int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, int level); |
25 | void kvmppc_set_papr(PowerPCCPU *cpu); | |
5b95b8b9 | 26 | void kvmppc_set_mpic_proxy(PowerPCCPU *cpu, int mpic_proxy); |
e97c3636 | 27 | int kvmppc_smt_threads(void); |
98efaf75 | 28 | #ifndef CONFIG_USER_ONLY |
354ac20a | 29 | off_t kvmppc_alloc_rma(const char *name, MemoryRegion *sysmem); |
0f5cb298 DG |
30 | void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t window_size, int *pfd); |
31 | int kvmppc_remove_spapr_tce(void *table, int pfd, uint32_t window_size); | |
7f763a5d DG |
32 | int kvmppc_reset_htab(int shift_hint); |
33 | uint64_t kvmppc_rma_size(uint64_t current_size, unsigned int hash_shift); | |
98efaf75 | 34 | #endif /* !CONFIG_USER_ONLY */ |
55e5c285 | 35 | int kvmppc_fixup_cpu(PowerPCCPU *cpu); |
3b961124 | 36 | bool kvmppc_has_cap_epr(void); |
fc87e185 | 37 | |
921e28db AG |
38 | #else |
39 | ||
40 | static inline uint32_t kvmppc_get_tbfreq(void) | |
41 | { | |
42 | return 0; | |
43 | } | |
44 | ||
45 | static inline uint64_t kvmppc_get_clockfreq(void) | |
46 | { | |
47 | return 0; | |
48 | } | |
49 | ||
6659394f DG |
50 | static inline uint32_t kvmppc_get_vmx(void) |
51 | { | |
52 | return 0; | |
53 | } | |
54 | ||
55 | static inline uint32_t kvmppc_get_dfp(void) | |
56 | { | |
57 | return 0; | |
58 | } | |
59 | ||
1a61a9ae SY |
60 | static inline int kvmppc_get_hasidle(CPUPPCState *env) |
61 | { | |
62 | return 0; | |
63 | } | |
64 | ||
1328c2bf | 65 | static inline int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int buf_len) |
921e28db AG |
66 | { |
67 | return -1; | |
68 | } | |
69 | ||
4656e1f0 BH |
70 | static inline int kvmppc_read_segment_page_sizes(uint32_t *prop, int maxcells) |
71 | { | |
72 | return -1; | |
73 | } | |
74 | ||
1bc22652 | 75 | static inline int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, int level) |
921e28db AG |
76 | { |
77 | return -1; | |
78 | } | |
79 | ||
1bc22652 | 80 | static inline void kvmppc_set_papr(PowerPCCPU *cpu) |
f61b4bed AG |
81 | { |
82 | } | |
83 | ||
5b95b8b9 AG |
84 | static inline void kvmppc_set_mpic_proxy(PowerPCCPU *cpu, int mpic_proxy) |
85 | { | |
86 | } | |
87 | ||
e97c3636 DG |
88 | static inline int kvmppc_smt_threads(void) |
89 | { | |
90 | return 1; | |
91 | } | |
92 | ||
98efaf75 | 93 | #ifndef CONFIG_USER_ONLY |
354ac20a DG |
94 | static inline off_t kvmppc_alloc_rma(const char *name, MemoryRegion *sysmem) |
95 | { | |
96 | return 0; | |
97 | } | |
98 | ||
0f5cb298 DG |
99 | static inline void *kvmppc_create_spapr_tce(uint32_t liobn, |
100 | uint32_t window_size, int *fd) | |
101 | { | |
102 | return NULL; | |
103 | } | |
104 | ||
105 | static inline int kvmppc_remove_spapr_tce(void *table, int pfd, | |
106 | uint32_t window_size) | |
107 | { | |
108 | return -1; | |
109 | } | |
7f763a5d DG |
110 | |
111 | static inline int kvmppc_reset_htab(int shift_hint) | |
112 | { | |
113 | return -1; | |
114 | } | |
115 | ||
116 | static inline uint64_t kvmppc_rma_size(uint64_t current_size, | |
117 | unsigned int hash_shift) | |
118 | { | |
119 | return ram_size; | |
120 | } | |
121 | ||
122 | static inline int kvmppc_update_sdr1(CPUPPCState *env) | |
123 | { | |
124 | return 0; | |
125 | } | |
126 | ||
98efaf75 | 127 | #endif /* !CONFIG_USER_ONLY */ |
0f5cb298 | 128 | |
55e5c285 | 129 | static inline int kvmppc_fixup_cpu(PowerPCCPU *cpu) |
12b1143b DG |
130 | { |
131 | return -1; | |
132 | } | |
3b961124 SY |
133 | |
134 | static inline bool kvmppc_has_cap_epr(void) | |
135 | { | |
136 | return false; | |
137 | } | |
921e28db AG |
138 | #endif |
139 | ||
b45d63b6 BH |
140 | #ifndef CONFIG_KVM |
141 | #define kvmppc_eieio() do { } while (0) | |
142 | #else | |
143 | #define kvmppc_eieio() \ | |
144 | do { \ | |
145 | if (kvm_enabled()) { \ | |
146 | asm volatile("eieio" : : : "memory"); \ | |
147 | } \ | |
148 | } while (0) | |
149 | #endif | |
150 | ||
fc87e185 AG |
151 | #ifndef KVM_INTERRUPT_SET |
152 | #define KVM_INTERRUPT_SET -1 | |
153 | #endif | |
154 | ||
155 | #ifndef KVM_INTERRUPT_UNSET | |
156 | #define KVM_INTERRUPT_UNSET -2 | |
157 | #endif | |
158 | ||
159 | #ifndef KVM_INTERRUPT_SET_LEVEL | |
160 | #define KVM_INTERRUPT_SET_LEVEL -3 | |
161 | #endif | |
dc333cd6 | 162 | |
d76d1650 | 163 | #endif /* __KVM_PPC_H__ */ |