]>
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 | ||
354ac20a DG |
12 | #include "memory.h" |
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); | |
45024f09 | 22 | int kvmppc_get_hypercall(CPUState *env, uint8_t *buf, int buf_len); |
fc87e185 | 23 | int kvmppc_set_interrupt(CPUState *env, int irq, int level); |
f61b4bed | 24 | void kvmppc_set_papr(CPUState *env); |
e97c3636 | 25 | int kvmppc_smt_threads(void); |
354ac20a | 26 | off_t kvmppc_alloc_rma(const char *name, MemoryRegion *sysmem); |
0f5cb298 DG |
27 | void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t window_size, int *pfd); |
28 | int kvmppc_remove_spapr_tce(void *table, int pfd, uint32_t window_size); | |
fc87e185 | 29 | |
921e28db AG |
30 | #else |
31 | ||
32 | static inline uint32_t kvmppc_get_tbfreq(void) | |
33 | { | |
34 | return 0; | |
35 | } | |
36 | ||
37 | static inline uint64_t kvmppc_get_clockfreq(void) | |
38 | { | |
39 | return 0; | |
40 | } | |
41 | ||
6659394f DG |
42 | static inline uint32_t kvmppc_get_vmx(void) |
43 | { | |
44 | return 0; | |
45 | } | |
46 | ||
47 | static inline uint32_t kvmppc_get_dfp(void) | |
48 | { | |
49 | return 0; | |
50 | } | |
51 | ||
921e28db AG |
52 | static inline int kvmppc_get_hypercall(CPUState *env, uint8_t *buf, int buf_len) |
53 | { | |
54 | return -1; | |
55 | } | |
56 | ||
57 | static inline int kvmppc_set_interrupt(CPUState *env, int irq, int level) | |
58 | { | |
59 | return -1; | |
60 | } | |
61 | ||
f61b4bed AG |
62 | static inline void kvmppc_set_papr(CPUState *env) |
63 | { | |
64 | } | |
65 | ||
e97c3636 DG |
66 | static inline int kvmppc_smt_threads(void) |
67 | { | |
68 | return 1; | |
69 | } | |
70 | ||
354ac20a DG |
71 | static inline off_t kvmppc_alloc_rma(const char *name, MemoryRegion *sysmem) |
72 | { | |
73 | return 0; | |
74 | } | |
75 | ||
0f5cb298 DG |
76 | static inline void *kvmppc_create_spapr_tce(uint32_t liobn, |
77 | uint32_t window_size, int *fd) | |
78 | { | |
79 | return NULL; | |
80 | } | |
81 | ||
82 | static inline int kvmppc_remove_spapr_tce(void *table, int pfd, | |
83 | uint32_t window_size) | |
84 | { | |
85 | return -1; | |
86 | } | |
87 | ||
921e28db AG |
88 | #endif |
89 | ||
b45d63b6 BH |
90 | #ifndef CONFIG_KVM |
91 | #define kvmppc_eieio() do { } while (0) | |
92 | #else | |
93 | #define kvmppc_eieio() \ | |
94 | do { \ | |
95 | if (kvm_enabled()) { \ | |
96 | asm volatile("eieio" : : : "memory"); \ | |
97 | } \ | |
98 | } while (0) | |
99 | #endif | |
100 | ||
fc87e185 AG |
101 | #ifndef KVM_INTERRUPT_SET |
102 | #define KVM_INTERRUPT_SET -1 | |
103 | #endif | |
104 | ||
105 | #ifndef KVM_INTERRUPT_UNSET | |
106 | #define KVM_INTERRUPT_UNSET -2 | |
107 | #endif | |
108 | ||
109 | #ifndef KVM_INTERRUPT_SET_LEVEL | |
110 | #define KVM_INTERRUPT_SET_LEVEL -3 | |
111 | #endif | |
dc333cd6 | 112 | |
d76d1650 | 113 | #endif /* __KVM_PPC_H__ */ |