root / target-ppc / kvm_ppc.h @ 136be99e
History | View | Annotate | Download (2.6 kB)
1 | d76d1650 | aurel32 | /*
|
---|---|---|---|
2 | d76d1650 | aurel32 | * Copyright 2008 IBM Corporation.
|
3 | d76d1650 | aurel32 | * Authors: Hollis Blanchard <hollisb@us.ibm.com>
|
4 | d76d1650 | aurel32 | *
|
5 | d76d1650 | aurel32 | * This work is licensed under the GNU GPL license version 2 or later.
|
6 | d76d1650 | aurel32 | *
|
7 | d76d1650 | aurel32 | */
|
8 | d76d1650 | aurel32 | |
9 | d76d1650 | aurel32 | #ifndef __KVM_PPC_H__
|
10 | d76d1650 | aurel32 | #define __KVM_PPC_H__
|
11 | d76d1650 | aurel32 | |
12 | 354ac20a | David Gibson | #include "memory.h" |
13 | 354ac20a | David Gibson | |
14 | d76d1650 | aurel32 | void kvmppc_init(void); |
15 | d76d1650 | aurel32 | |
16 | 921e28db | Alexander Graf | #ifdef CONFIG_KVM
|
17 | 921e28db | Alexander Graf | |
18 | dc333cd6 | Alexander Graf | uint32_t kvmppc_get_tbfreq(void);
|
19 | eadaada1 | Alexander Graf | uint64_t kvmppc_get_clockfreq(void);
|
20 | 6659394f | David Gibson | uint32_t kvmppc_get_vmx(void);
|
21 | 6659394f | David Gibson | uint32_t kvmppc_get_dfp(void);
|
22 | 1328c2bf | Andreas Färber | int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int buf_len); |
23 | 1328c2bf | Andreas Färber | int kvmppc_set_interrupt(CPUPPCState *env, int irq, int level); |
24 | 1328c2bf | Andreas Färber | void kvmppc_set_papr(CPUPPCState *env);
|
25 | e97c3636 | David Gibson | int kvmppc_smt_threads(void); |
26 | 98efaf75 | David Gibson | #ifndef CONFIG_USER_ONLY
|
27 | 354ac20a | David Gibson | off_t kvmppc_alloc_rma(const char *name, MemoryRegion *sysmem); |
28 | 0f5cb298 | David Gibson | void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t window_size, int *pfd); |
29 | 0f5cb298 | David Gibson | int kvmppc_remove_spapr_tce(void *table, int pfd, uint32_t window_size); |
30 | 98efaf75 | David Gibson | #endif /* !CONFIG_USER_ONLY */ |
31 | a1e98583 | David Gibson | const ppc_def_t *kvmppc_host_cpu_def(void); |
32 | 12b1143b | David Gibson | int kvmppc_fixup_cpu(CPUPPCState *env);
|
33 | fc87e185 | Alexander Graf | |
34 | 921e28db | Alexander Graf | #else
|
35 | 921e28db | Alexander Graf | |
36 | 921e28db | Alexander Graf | static inline uint32_t kvmppc_get_tbfreq(void) |
37 | 921e28db | Alexander Graf | { |
38 | 921e28db | Alexander Graf | return 0; |
39 | 921e28db | Alexander Graf | } |
40 | 921e28db | Alexander Graf | |
41 | 921e28db | Alexander Graf | static inline uint64_t kvmppc_get_clockfreq(void) |
42 | 921e28db | Alexander Graf | { |
43 | 921e28db | Alexander Graf | return 0; |
44 | 921e28db | Alexander Graf | } |
45 | 921e28db | Alexander Graf | |
46 | 6659394f | David Gibson | static inline uint32_t kvmppc_get_vmx(void) |
47 | 6659394f | David Gibson | { |
48 | 6659394f | David Gibson | return 0; |
49 | 6659394f | David Gibson | } |
50 | 6659394f | David Gibson | |
51 | 6659394f | David Gibson | static inline uint32_t kvmppc_get_dfp(void) |
52 | 6659394f | David Gibson | { |
53 | 6659394f | David Gibson | return 0; |
54 | 6659394f | David Gibson | } |
55 | 6659394f | David Gibson | |
56 | 1328c2bf | Andreas Färber | static inline int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int buf_len) |
57 | 921e28db | Alexander Graf | { |
58 | 921e28db | Alexander Graf | return -1; |
59 | 921e28db | Alexander Graf | } |
60 | 921e28db | Alexander Graf | |
61 | 1328c2bf | Andreas Färber | static inline int kvmppc_set_interrupt(CPUPPCState *env, int irq, int level) |
62 | 921e28db | Alexander Graf | { |
63 | 921e28db | Alexander Graf | return -1; |
64 | 921e28db | Alexander Graf | } |
65 | 921e28db | Alexander Graf | |
66 | 1328c2bf | Andreas Färber | static inline void kvmppc_set_papr(CPUPPCState *env) |
67 | f61b4bed | Alexander Graf | { |
68 | f61b4bed | Alexander Graf | } |
69 | f61b4bed | Alexander Graf | |
70 | e97c3636 | David Gibson | static inline int kvmppc_smt_threads(void) |
71 | e97c3636 | David Gibson | { |
72 | e97c3636 | David Gibson | return 1; |
73 | e97c3636 | David Gibson | } |
74 | e97c3636 | David Gibson | |
75 | 98efaf75 | David Gibson | #ifndef CONFIG_USER_ONLY
|
76 | 354ac20a | David Gibson | static inline off_t kvmppc_alloc_rma(const char *name, MemoryRegion *sysmem) |
77 | 354ac20a | David Gibson | { |
78 | 354ac20a | David Gibson | return 0; |
79 | 354ac20a | David Gibson | } |
80 | 354ac20a | David Gibson | |
81 | 0f5cb298 | David Gibson | static inline void *kvmppc_create_spapr_tce(uint32_t liobn, |
82 | 0f5cb298 | David Gibson | uint32_t window_size, int *fd)
|
83 | 0f5cb298 | David Gibson | { |
84 | 0f5cb298 | David Gibson | return NULL; |
85 | 0f5cb298 | David Gibson | } |
86 | 0f5cb298 | David Gibson | |
87 | 0f5cb298 | David Gibson | static inline int kvmppc_remove_spapr_tce(void *table, int pfd, |
88 | 0f5cb298 | David Gibson | uint32_t window_size) |
89 | 0f5cb298 | David Gibson | { |
90 | 0f5cb298 | David Gibson | return -1; |
91 | 0f5cb298 | David Gibson | } |
92 | 98efaf75 | David Gibson | #endif /* !CONFIG_USER_ONLY */ |
93 | 0f5cb298 | David Gibson | |
94 | a1e98583 | David Gibson | static inline const ppc_def_t *kvmppc_host_cpu_def(void) |
95 | a1e98583 | David Gibson | { |
96 | a1e98583 | David Gibson | return NULL; |
97 | a1e98583 | David Gibson | } |
98 | a1e98583 | David Gibson | |
99 | 12b1143b | David Gibson | static inline int kvmppc_fixup_cpu(CPUPPCState *env) |
100 | 12b1143b | David Gibson | { |
101 | 12b1143b | David Gibson | return -1; |
102 | 12b1143b | David Gibson | } |
103 | 921e28db | Alexander Graf | #endif
|
104 | 921e28db | Alexander Graf | |
105 | b45d63b6 | Ben Herrenschmidt | #ifndef CONFIG_KVM
|
106 | b45d63b6 | Ben Herrenschmidt | #define kvmppc_eieio() do { } while (0) |
107 | b45d63b6 | Ben Herrenschmidt | #else
|
108 | b45d63b6 | Ben Herrenschmidt | #define kvmppc_eieio() \
|
109 | b45d63b6 | Ben Herrenschmidt | do { \
|
110 | b45d63b6 | Ben Herrenschmidt | if (kvm_enabled()) { \
|
111 | b45d63b6 | Ben Herrenschmidt | asm volatile("eieio" : : : "memory"); \ |
112 | b45d63b6 | Ben Herrenschmidt | } \ |
113 | b45d63b6 | Ben Herrenschmidt | } while (0) |
114 | b45d63b6 | Ben Herrenschmidt | #endif
|
115 | b45d63b6 | Ben Herrenschmidt | |
116 | fc87e185 | Alexander Graf | #ifndef KVM_INTERRUPT_SET
|
117 | fc87e185 | Alexander Graf | #define KVM_INTERRUPT_SET -1 |
118 | fc87e185 | Alexander Graf | #endif
|
119 | fc87e185 | Alexander Graf | |
120 | fc87e185 | Alexander Graf | #ifndef KVM_INTERRUPT_UNSET
|
121 | fc87e185 | Alexander Graf | #define KVM_INTERRUPT_UNSET -2 |
122 | fc87e185 | Alexander Graf | #endif
|
123 | fc87e185 | Alexander Graf | |
124 | fc87e185 | Alexander Graf | #ifndef KVM_INTERRUPT_SET_LEVEL
|
125 | fc87e185 | Alexander Graf | #define KVM_INTERRUPT_SET_LEVEL -3 |
126 | fc87e185 | Alexander Graf | #endif
|
127 | dc333cd6 | Alexander Graf | |
128 | d76d1650 | aurel32 | #endif /* __KVM_PPC_H__ */ |