1#ifndef KVM_DIRTY_RING_H
2#define KVM_DIRTY_RING_H
3
4#include <linux/kvm.h>
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21struct kvm_dirty_ring {
22 u32 dirty_index;
23 u32 reset_index;
24 u32 size;
25 u32 soft_limit;
26 struct kvm_dirty_gfn *dirty_gfns;
27 int index;
28};
29
30#if (KVM_DIRTY_LOG_PAGE_OFFSET == 0)
31
32
33
34
35static inline u32 kvm_dirty_ring_get_rsvd_entries(void)
36{
37 return 0;
38}
39
40static inline int kvm_dirty_ring_alloc(struct kvm_dirty_ring *ring,
41 int index, u32 size)
42{
43 return 0;
44}
45
46static inline struct kvm_dirty_ring *kvm_dirty_ring_get(struct kvm *kvm)
47{
48 return NULL;
49}
50
51static inline int kvm_dirty_ring_reset(struct kvm *kvm,
52 struct kvm_dirty_ring *ring)
53{
54 return 0;
55}
56
57static inline void kvm_dirty_ring_push(struct kvm_dirty_ring *ring,
58 u32 slot, u64 offset)
59{
60}
61
62static inline struct page *kvm_dirty_ring_get_page(struct kvm_dirty_ring *ring,
63 u32 offset)
64{
65 return NULL;
66}
67
68static inline void kvm_dirty_ring_free(struct kvm_dirty_ring *ring)
69{
70}
71
72static inline bool kvm_dirty_ring_soft_full(struct kvm_dirty_ring *ring)
73{
74 return true;
75}
76
77#else
78
79u32 kvm_dirty_ring_get_rsvd_entries(void);
80int kvm_dirty_ring_alloc(struct kvm_dirty_ring *ring, int index, u32 size);
81struct kvm_dirty_ring *kvm_dirty_ring_get(struct kvm *kvm);
82
83
84
85
86
87int kvm_dirty_ring_reset(struct kvm *kvm, struct kvm_dirty_ring *ring);
88
89
90
91
92
93void kvm_dirty_ring_push(struct kvm_dirty_ring *ring, u32 slot, u64 offset);
94
95
96struct page *kvm_dirty_ring_get_page(struct kvm_dirty_ring *ring, u32 offset);
97
98void kvm_dirty_ring_free(struct kvm_dirty_ring *ring);
99bool kvm_dirty_ring_soft_full(struct kvm_dirty_ring *ring);
100
101#endif
102
103#endif
104