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