diff options
author | Nikolay Nikolaev <n.nikolaev@virtualopensystems.com> | 2015-03-26 10:39:28 -0400 |
---|---|---|
committer | Marc Zyngier <marc.zyngier@arm.com> | 2015-03-26 17:43:11 -0400 |
commit | e32edf4fd0fa4897e12ca66118ab67bf257e16e4 (patch) | |
tree | 8bd79dc3e3d03576e084ce2dbbde68c95fdd0ea8 /virt/kvm/iodev.h | |
parent | 1a74847885cc87857d631f91cca4d83924f75674 (diff) |
KVM: Redesign kvm_io_bus_ API to pass VCPU structure to the callbacks.
This is needed in e.g. ARM vGIC emulation, where the MMIO handling
depends on the VCPU that does the access.
Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Christoffer Dall <christoffer.dall@linaro.org>
Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'virt/kvm/iodev.h')
-rw-r--r-- | virt/kvm/iodev.h | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/virt/kvm/iodev.h b/virt/kvm/iodev.h index 12fd3caffd2b..9ef709cc2cae 100644 --- a/virt/kvm/iodev.h +++ b/virt/kvm/iodev.h | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <asm/errno.h> | 20 | #include <asm/errno.h> |
21 | 21 | ||
22 | struct kvm_io_device; | 22 | struct kvm_io_device; |
23 | struct kvm_vcpu; | ||
23 | 24 | ||
24 | /** | 25 | /** |
25 | * kvm_io_device_ops are called under kvm slots_lock. | 26 | * kvm_io_device_ops are called under kvm slots_lock. |
@@ -27,11 +28,13 @@ struct kvm_io_device; | |||
27 | * or non-zero to have it passed to the next device. | 28 | * or non-zero to have it passed to the next device. |
28 | **/ | 29 | **/ |
29 | struct kvm_io_device_ops { | 30 | struct kvm_io_device_ops { |
30 | int (*read)(struct kvm_io_device *this, | 31 | int (*read)(struct kvm_vcpu *vcpu, |
32 | struct kvm_io_device *this, | ||
31 | gpa_t addr, | 33 | gpa_t addr, |
32 | int len, | 34 | int len, |
33 | void *val); | 35 | void *val); |
34 | int (*write)(struct kvm_io_device *this, | 36 | int (*write)(struct kvm_vcpu *vcpu, |
37 | struct kvm_io_device *this, | ||
35 | gpa_t addr, | 38 | gpa_t addr, |
36 | int len, | 39 | int len, |
37 | const void *val); | 40 | const void *val); |
@@ -49,16 +52,20 @@ static inline void kvm_iodevice_init(struct kvm_io_device *dev, | |||
49 | dev->ops = ops; | 52 | dev->ops = ops; |
50 | } | 53 | } |
51 | 54 | ||
52 | static inline int kvm_iodevice_read(struct kvm_io_device *dev, | 55 | static inline int kvm_iodevice_read(struct kvm_vcpu *vcpu, |
53 | gpa_t addr, int l, void *v) | 56 | struct kvm_io_device *dev, gpa_t addr, |
57 | int l, void *v) | ||
54 | { | 58 | { |
55 | return dev->ops->read ? dev->ops->read(dev, addr, l, v) : -EOPNOTSUPP; | 59 | return dev->ops->read ? dev->ops->read(vcpu, dev, addr, l, v) |
60 | : -EOPNOTSUPP; | ||
56 | } | 61 | } |
57 | 62 | ||
58 | static inline int kvm_iodevice_write(struct kvm_io_device *dev, | 63 | static inline int kvm_iodevice_write(struct kvm_vcpu *vcpu, |
59 | gpa_t addr, int l, const void *v) | 64 | struct kvm_io_device *dev, gpa_t addr, |
65 | int l, const void *v) | ||
60 | { | 66 | { |
61 | return dev->ops->write ? dev->ops->write(dev, addr, l, v) : -EOPNOTSUPP; | 67 | return dev->ops->write ? dev->ops->write(vcpu, dev, addr, l, v) |
68 | : -EOPNOTSUPP; | ||
62 | } | 69 | } |
63 | 70 | ||
64 | static inline void kvm_iodevice_destructor(struct kvm_io_device *dev) | 71 | static inline void kvm_iodevice_destructor(struct kvm_io_device *dev) |