2 * Copyright 2008 IBM Corporation.
3 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
5 * This work is licensed under the GNU GPL license version 2 or later.
12 #include "exec/memory.h"
14 #define TYPE_HOST_POWERPC_CPU "host-" TYPE_POWERPC_CPU
16 void kvmppc_init(void);
20 uint32_t kvmppc_get_tbfreq(void);
21 uint64_t kvmppc_get_clockfreq(void);
22 uint32_t kvmppc_get_vmx(void);
23 uint32_t kvmppc_get_dfp(void);
24 int kvmppc_get_hasidle(CPUPPCState
*env
);
25 int kvmppc_get_hypercall(CPUPPCState
*env
, uint8_t *buf
, int buf_len
);
26 int kvmppc_set_interrupt(PowerPCCPU
*cpu
, int irq
, int level
);
27 void kvmppc_set_papr(PowerPCCPU
*cpu
);
28 void kvmppc_set_mpic_proxy(PowerPCCPU
*cpu
, int mpic_proxy
);
29 int kvmppc_smt_threads(void);
30 #ifndef CONFIG_USER_ONLY
31 off_t
kvmppc_alloc_rma(const char *name
, MemoryRegion
*sysmem
);
32 void *kvmppc_create_spapr_tce(uint32_t liobn
, uint32_t window_size
, int *pfd
);
33 int kvmppc_remove_spapr_tce(void *table
, int pfd
, uint32_t window_size
);
34 int kvmppc_reset_htab(int shift_hint
);
35 uint64_t kvmppc_rma_size(uint64_t current_size
, unsigned int hash_shift
);
36 #endif /* !CONFIG_USER_ONLY */
37 int kvmppc_fixup_cpu(PowerPCCPU
*cpu
);
41 static inline uint32_t kvmppc_get_tbfreq(void)
46 static inline uint64_t kvmppc_get_clockfreq(void)
51 static inline uint32_t kvmppc_get_vmx(void)
56 static inline uint32_t kvmppc_get_dfp(void)
61 static inline int kvmppc_get_hasidle(CPUPPCState
*env
)
66 static inline int kvmppc_get_hypercall(CPUPPCState
*env
, uint8_t *buf
, int buf_len
)
71 static inline int kvmppc_read_segment_page_sizes(uint32_t *prop
, int maxcells
)
76 static inline int kvmppc_set_interrupt(PowerPCCPU
*cpu
, int irq
, int level
)
81 static inline void kvmppc_set_papr(PowerPCCPU
*cpu
)
85 static inline void kvmppc_set_mpic_proxy(PowerPCCPU
*cpu
, int mpic_proxy
)
89 static inline int kvmppc_smt_threads(void)
94 #ifndef CONFIG_USER_ONLY
95 static inline off_t
kvmppc_alloc_rma(const char *name
, MemoryRegion
*sysmem
)
100 static inline void *kvmppc_create_spapr_tce(uint32_t liobn
,
101 uint32_t window_size
, int *fd
)
106 static inline int kvmppc_remove_spapr_tce(void *table
, int pfd
,
107 uint32_t window_size
)
112 static inline int kvmppc_reset_htab(int shift_hint
)
117 static inline uint64_t kvmppc_rma_size(uint64_t current_size
,
118 unsigned int hash_shift
)
123 static inline int kvmppc_update_sdr1(CPUPPCState
*env
)
128 #endif /* !CONFIG_USER_ONLY */
130 static inline int kvmppc_fixup_cpu(PowerPCCPU
*cpu
)
137 #define kvmppc_eieio() do { } while (0)
139 #define kvmppc_eieio() \
141 if (kvm_enabled()) { \
142 asm volatile("eieio" : : : "memory"); \
147 #ifndef KVM_INTERRUPT_SET
148 #define KVM_INTERRUPT_SET -1
151 #ifndef KVM_INTERRUPT_UNSET
152 #define KVM_INTERRUPT_UNSET -2
155 #ifndef KVM_INTERRUPT_SET_LEVEL
156 #define KVM_INTERRUPT_SET_LEVEL -3
159 #endif /* __KVM_PPC_H__ */