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