root / target-ppc / kvm_ppc.h @ be40edcd
History | View | Annotate | Download (2.3 kB)
1 | d76d1650 | aurel32 | /*
|
---|---|---|---|
2 | d76d1650 | aurel32 | * Copyright 2008 IBM Corporation.
|
3 | d76d1650 | aurel32 | * Authors: Hollis Blanchard <hollisb@us.ibm.com>
|
4 | d76d1650 | aurel32 | *
|
5 | d76d1650 | aurel32 | * This work is licensed under the GNU GPL license version 2 or later.
|
6 | d76d1650 | aurel32 | *
|
7 | d76d1650 | aurel32 | */
|
8 | d76d1650 | aurel32 | |
9 | d76d1650 | aurel32 | #ifndef __KVM_PPC_H__
|
10 | d76d1650 | aurel32 | #define __KVM_PPC_H__
|
11 | d76d1650 | aurel32 | |
12 | 354ac20a | David Gibson | #include "memory.h" |
13 | 354ac20a | David Gibson | |
14 | d76d1650 | aurel32 | void kvmppc_init(void); |
15 | d76d1650 | aurel32 | |
16 | 921e28db | Alexander Graf | #ifdef CONFIG_KVM
|
17 | 921e28db | Alexander Graf | |
18 | dc333cd6 | Alexander Graf | uint32_t kvmppc_get_tbfreq(void);
|
19 | eadaada1 | Alexander Graf | uint64_t kvmppc_get_clockfreq(void);
|
20 | 6659394f | David Gibson | uint32_t kvmppc_get_vmx(void);
|
21 | 6659394f | David Gibson | uint32_t kvmppc_get_dfp(void);
|
22 | 45024f09 | Alexander Graf | int kvmppc_get_hypercall(CPUState *env, uint8_t *buf, int buf_len); |
23 | fc87e185 | Alexander Graf | int kvmppc_set_interrupt(CPUState *env, int irq, int level); |
24 | f61b4bed | Alexander Graf | void kvmppc_set_papr(CPUState *env);
|
25 | e97c3636 | David Gibson | int kvmppc_smt_threads(void); |
26 | 354ac20a | David Gibson | off_t kvmppc_alloc_rma(const char *name, MemoryRegion *sysmem); |
27 | 0f5cb298 | David Gibson | void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t window_size, int *pfd); |
28 | 0f5cb298 | David Gibson | int kvmppc_remove_spapr_tce(void *table, int pfd, uint32_t window_size); |
29 | fc87e185 | Alexander Graf | |
30 | 921e28db | Alexander Graf | #else
|
31 | 921e28db | Alexander Graf | |
32 | 921e28db | Alexander Graf | static inline uint32_t kvmppc_get_tbfreq(void) |
33 | 921e28db | Alexander Graf | { |
34 | 921e28db | Alexander Graf | return 0; |
35 | 921e28db | Alexander Graf | } |
36 | 921e28db | Alexander Graf | |
37 | 921e28db | Alexander Graf | static inline uint64_t kvmppc_get_clockfreq(void) |
38 | 921e28db | Alexander Graf | { |
39 | 921e28db | Alexander Graf | return 0; |
40 | 921e28db | Alexander Graf | } |
41 | 921e28db | Alexander Graf | |
42 | 6659394f | David Gibson | static inline uint32_t kvmppc_get_vmx(void) |
43 | 6659394f | David Gibson | { |
44 | 6659394f | David Gibson | return 0; |
45 | 6659394f | David Gibson | } |
46 | 6659394f | David Gibson | |
47 | 6659394f | David Gibson | static inline uint32_t kvmppc_get_dfp(void) |
48 | 6659394f | David Gibson | { |
49 | 6659394f | David Gibson | return 0; |
50 | 6659394f | David Gibson | } |
51 | 6659394f | David Gibson | |
52 | 921e28db | Alexander Graf | static inline int kvmppc_get_hypercall(CPUState *env, uint8_t *buf, int buf_len) |
53 | 921e28db | Alexander Graf | { |
54 | 921e28db | Alexander Graf | return -1; |
55 | 921e28db | Alexander Graf | } |
56 | 921e28db | Alexander Graf | |
57 | 921e28db | Alexander Graf | static inline int kvmppc_set_interrupt(CPUState *env, int irq, int level) |
58 | 921e28db | Alexander Graf | { |
59 | 921e28db | Alexander Graf | return -1; |
60 | 921e28db | Alexander Graf | } |
61 | 921e28db | Alexander Graf | |
62 | f61b4bed | Alexander Graf | static inline void kvmppc_set_papr(CPUState *env) |
63 | f61b4bed | Alexander Graf | { |
64 | f61b4bed | Alexander Graf | } |
65 | f61b4bed | Alexander Graf | |
66 | e97c3636 | David Gibson | static inline int kvmppc_smt_threads(void) |
67 | e97c3636 | David Gibson | { |
68 | e97c3636 | David Gibson | return 1; |
69 | e97c3636 | David Gibson | } |
70 | e97c3636 | David Gibson | |
71 | 354ac20a | David Gibson | static inline off_t kvmppc_alloc_rma(const char *name, MemoryRegion *sysmem) |
72 | 354ac20a | David Gibson | { |
73 | 354ac20a | David Gibson | return 0; |
74 | 354ac20a | David Gibson | } |
75 | 354ac20a | David Gibson | |
76 | 0f5cb298 | David Gibson | static inline void *kvmppc_create_spapr_tce(uint32_t liobn, |
77 | 0f5cb298 | David Gibson | uint32_t window_size, int *fd)
|
78 | 0f5cb298 | David Gibson | { |
79 | 0f5cb298 | David Gibson | return NULL; |
80 | 0f5cb298 | David Gibson | } |
81 | 0f5cb298 | David Gibson | |
82 | 0f5cb298 | David Gibson | static inline int kvmppc_remove_spapr_tce(void *table, int pfd, |
83 | 0f5cb298 | David Gibson | uint32_t window_size) |
84 | 0f5cb298 | David Gibson | { |
85 | 0f5cb298 | David Gibson | return -1; |
86 | 0f5cb298 | David Gibson | } |
87 | 0f5cb298 | David Gibson | |
88 | 921e28db | Alexander Graf | #endif
|
89 | 921e28db | Alexander Graf | |
90 | b45d63b6 | Ben Herrenschmidt | #ifndef CONFIG_KVM
|
91 | b45d63b6 | Ben Herrenschmidt | #define kvmppc_eieio() do { } while (0) |
92 | b45d63b6 | Ben Herrenschmidt | #else
|
93 | b45d63b6 | Ben Herrenschmidt | #define kvmppc_eieio() \
|
94 | b45d63b6 | Ben Herrenschmidt | do { \
|
95 | b45d63b6 | Ben Herrenschmidt | if (kvm_enabled()) { \
|
96 | b45d63b6 | Ben Herrenschmidt | asm volatile("eieio" : : : "memory"); \ |
97 | b45d63b6 | Ben Herrenschmidt | } \ |
98 | b45d63b6 | Ben Herrenschmidt | } while (0) |
99 | b45d63b6 | Ben Herrenschmidt | #endif
|
100 | b45d63b6 | Ben Herrenschmidt | |
101 | fc87e185 | Alexander Graf | #ifndef KVM_INTERRUPT_SET
|
102 | fc87e185 | Alexander Graf | #define KVM_INTERRUPT_SET -1 |
103 | fc87e185 | Alexander Graf | #endif
|
104 | fc87e185 | Alexander Graf | |
105 | fc87e185 | Alexander Graf | #ifndef KVM_INTERRUPT_UNSET
|
106 | fc87e185 | Alexander Graf | #define KVM_INTERRUPT_UNSET -2 |
107 | fc87e185 | Alexander Graf | #endif
|
108 | fc87e185 | Alexander Graf | |
109 | fc87e185 | Alexander Graf | #ifndef KVM_INTERRUPT_SET_LEVEL
|
110 | fc87e185 | Alexander Graf | #define KVM_INTERRUPT_SET_LEVEL -3 |
111 | fc87e185 | Alexander Graf | #endif
|
112 | dc333cd6 | Alexander Graf | |
113 | d76d1650 | aurel32 | #endif /* __KVM_PPC_H__ */ |