Statistics
| Branch: | Revision:

root / target-ppc / kvm_ppc.h @ be40edcd

History | View | Annotate | Download (2.3 kB)

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

    
12
#include "memory.h"
13

    
14
void kvmppc_init(void);
15

    
16
#ifdef CONFIG_KVM
17

    
18
uint32_t kvmppc_get_tbfreq(void);
19
uint64_t kvmppc_get_clockfreq(void);
20
uint32_t kvmppc_get_vmx(void);
21
uint32_t kvmppc_get_dfp(void);
22
int kvmppc_get_hypercall(CPUState *env, uint8_t *buf, int buf_len);
23
int kvmppc_set_interrupt(CPUState *env, int irq, int level);
24
void kvmppc_set_papr(CPUState *env);
25
int kvmppc_smt_threads(void);
26
off_t kvmppc_alloc_rma(const char *name, MemoryRegion *sysmem);
27
void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t window_size, int *pfd);
28
int kvmppc_remove_spapr_tce(void *table, int pfd, uint32_t window_size);
29

    
30
#else
31

    
32
static inline uint32_t kvmppc_get_tbfreq(void)
33
{
34
    return 0;
35
}
36

    
37
static inline uint64_t kvmppc_get_clockfreq(void)
38
{
39
    return 0;
40
}
41

    
42
static inline uint32_t kvmppc_get_vmx(void)
43
{
44
    return 0;
45
}
46

    
47
static inline uint32_t kvmppc_get_dfp(void)
48
{
49
    return 0;
50
}
51

    
52
static inline int kvmppc_get_hypercall(CPUState *env, uint8_t *buf, int buf_len)
53
{
54
    return -1;
55
}
56

    
57
static inline int kvmppc_set_interrupt(CPUState *env, int irq, int level)
58
{
59
    return -1;
60
}
61

    
62
static inline void kvmppc_set_papr(CPUState *env)
63
{
64
}
65

    
66
static inline int kvmppc_smt_threads(void)
67
{
68
    return 1;
69
}
70

    
71
static inline off_t kvmppc_alloc_rma(const char *name, MemoryRegion *sysmem)
72
{
73
    return 0;
74
}
75

    
76
static inline void *kvmppc_create_spapr_tce(uint32_t liobn,
77
                                            uint32_t window_size, int *fd)
78
{
79
    return NULL;
80
}
81

    
82
static inline int kvmppc_remove_spapr_tce(void *table, int pfd,
83
                                          uint32_t window_size)
84
{
85
    return -1;
86
}
87

    
88
#endif
89

    
90
#ifndef CONFIG_KVM
91
#define kvmppc_eieio() do { } while (0)
92
#else
93
#define kvmppc_eieio() \
94
    do {                                          \
95
        if (kvm_enabled()) {                          \
96
            asm volatile("eieio" : : : "memory"); \
97
        } \
98
    } while (0)
99
#endif
100

    
101
#ifndef KVM_INTERRUPT_SET
102
#define KVM_INTERRUPT_SET -1
103
#endif
104

    
105
#ifndef KVM_INTERRUPT_UNSET
106
#define KVM_INTERRUPT_UNSET -2
107
#endif
108

    
109
#ifndef KVM_INTERRUPT_SET_LEVEL
110
#define KVM_INTERRUPT_SET_LEVEL -3
111
#endif
112

    
113
#endif /* __KVM_PPC_H__ */