kvm_ppc.h 3.2 KB
Newer Older
A
aurel32 已提交
1 2 3 4 5 6 7 8 9 10 11
/*
 * Copyright 2008 IBM Corporation.
 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
 *
 * This work is licensed under the GNU GPL license version 2 or later.
 *
 */

#ifndef __KVM_PPC_H__
#define __KVM_PPC_H__

12
#include "exec/memory.h"
13

A
aurel32 已提交
14 15
void kvmppc_init(void);

16 17
#ifdef CONFIG_KVM

18
uint32_t kvmppc_get_tbfreq(void);
19
uint64_t kvmppc_get_clockfreq(void);
20 21
uint32_t kvmppc_get_vmx(void);
uint32_t kvmppc_get_dfp(void);
22
int kvmppc_get_hasidle(CPUPPCState *env);
23
int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int buf_len);
24 25
int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, int level);
void kvmppc_set_papr(PowerPCCPU *cpu);
26
int kvmppc_smt_threads(void);
D
David Gibson 已提交
27
#ifndef CONFIG_USER_ONLY
28
off_t kvmppc_alloc_rma(const char *name, MemoryRegion *sysmem);
29 30
void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t window_size, int *pfd);
int kvmppc_remove_spapr_tce(void *table, int pfd, uint32_t window_size);
31 32
int kvmppc_reset_htab(int shift_hint);
uint64_t kvmppc_rma_size(uint64_t current_size, unsigned int hash_shift);
D
David Gibson 已提交
33
#endif /* !CONFIG_USER_ONLY */
34
const ppc_def_t *kvmppc_host_cpu_def(void);
35
int kvmppc_fixup_cpu(CPUPPCState *env);
36

37 38 39 40 41 42 43 44 45 46 47 48
#else

static inline uint32_t kvmppc_get_tbfreq(void)
{
    return 0;
}

static inline uint64_t kvmppc_get_clockfreq(void)
{
    return 0;
}

49 50 51 52 53 54 55 56 57 58
static inline uint32_t kvmppc_get_vmx(void)
{
    return 0;
}

static inline uint32_t kvmppc_get_dfp(void)
{
    return 0;
}

59 60 61 62 63
static inline int kvmppc_get_hasidle(CPUPPCState *env)
{
    return 0;
}

64
static inline int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int buf_len)
65 66 67 68
{
    return -1;
}

69 70 71 72 73
static inline int kvmppc_read_segment_page_sizes(uint32_t *prop, int maxcells)
{
    return -1;
}

74
static inline int kvmppc_set_interrupt(PowerPCCPU *cpu, int irq, int level)
75 76 77 78
{
    return -1;
}

79
static inline void kvmppc_set_papr(PowerPCCPU *cpu)
80 81 82
{
}

83 84 85 86 87
static inline int kvmppc_smt_threads(void)
{
    return 1;
}

D
David Gibson 已提交
88
#ifndef CONFIG_USER_ONLY
89 90 91 92 93
static inline off_t kvmppc_alloc_rma(const char *name, MemoryRegion *sysmem)
{
    return 0;
}

94 95 96 97 98 99 100 101 102 103 104
static inline void *kvmppc_create_spapr_tce(uint32_t liobn,
                                            uint32_t window_size, int *fd)
{
    return NULL;
}

static inline int kvmppc_remove_spapr_tce(void *table, int pfd,
                                          uint32_t window_size)
{
    return -1;
}
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121

static inline int kvmppc_reset_htab(int shift_hint)
{
    return -1;
}

static inline uint64_t kvmppc_rma_size(uint64_t current_size,
                                       unsigned int hash_shift)
{
    return ram_size;
}

static inline int kvmppc_update_sdr1(CPUPPCState *env)
{
    return 0;
}

D
David Gibson 已提交
122
#endif /* !CONFIG_USER_ONLY */
123

124 125 126 127 128
static inline const ppc_def_t *kvmppc_host_cpu_def(void)
{
    return NULL;
}

129 130 131 132
static inline int kvmppc_fixup_cpu(CPUPPCState *env)
{
    return -1;
}
133 134
#endif

135 136 137 138 139 140 141 142 143 144 145
#ifndef CONFIG_KVM
#define kvmppc_eieio() do { } while (0)
#else
#define kvmppc_eieio() \
    do {                                          \
        if (kvm_enabled()) {                          \
            asm volatile("eieio" : : : "memory"); \
        } \
    } while (0)
#endif

146 147 148 149 150 151 152 153 154 155 156
#ifndef KVM_INTERRUPT_SET
#define KVM_INTERRUPT_SET -1
#endif

#ifndef KVM_INTERRUPT_UNSET
#define KVM_INTERRUPT_UNSET -2
#endif

#ifndef KVM_INTERRUPT_SET_LEVEL
#define KVM_INTERRUPT_SET_LEVEL -3
#endif
157

A
aurel32 已提交
158
#endif /* __KVM_PPC_H__ */