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