summaryrefslogtreecommitdiff
path: root/kvm_coalesced_mmio.h
blob: 58d7a3125cca9acadd9a4c44ce7d40645c3310ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef __KVM_COALESCED_MMIO_H__
#define __KVM_COALESCED_MMIO_H__

/*
 * KVM coalesced MMIO
 *
 * Copyright (c) 2008 Bull S.A.S.
 *
 *  Author: Laurent Vivier <Laurent.Vivier@bull.net>
 *
 */

/* XXX Linux doesn't define these structures here so why do we? */

typedef struct kvm_coalesced_mmio_zone {
	uint64_t addr;
	uint32_t size;
	uint32_t pad;
} kvm_coalesced_mmio_zone_t;

typedef struct kvm_coalesced_mmio_zone_ioc {
	struct kvm_coalesced_mmio_zone zone;
	int kvmid;
} kvm_coalesced_mmio_zone_ioc_t;

#ifdef CONFIG_KVM_MMIO

#define KVM_COALESCED_MMIO_ZONE_MAX 100

/* for KVM_REGISTER_COALESCED_MMIO / KVM_UNREGISTER_COALESCED_MMIO */

typedef struct kvm_coalesced_mmio_dev {
	struct kvm_io_device dev;
	struct kvm *kvm;
	kmutex_t lock;
	int nb_zones;
	struct kvm_coalesced_mmio_zone zone[KVM_COALESCED_MMIO_ZONE_MAX];
} kvm_coalesced_mmio_dev_t;

extern int kvm_coalesced_mmio_init(struct kvm *);
extern void kvm_coalesced_mmio_free(struct kvm *);
extern int kvm_vm_ioctl_register_coalesced_mmio(struct kvm *,
    struct kvm_coalesced_mmio_zone *);
extern int kvm_vm_ioctl_unregister_coalesced_mmio(struct kvm *,
    struct kvm_coalesced_mmio_zone *);

#else

#error "CONFIG_KVM_MMIO must be suupported"

#endif /* CONFIG_KVM_MMIO */

#endif /* __KVM_COALESCED_MMIO_H__ */