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