diff options
author | Laurent Vivier <Laurent.Vivier@bull.net> | 2008-05-30 10:05:53 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-07-20 05:42:30 -0400 |
commit | 92760499d01ef91518119908eb9b8798b6c9bd3f (patch) | |
tree | a6bd80fbad82589eb5aa98f81edda4537bc1f625 /virt/kvm | |
parent | 131d82791b628d4aeafd94ddc74a9b68f3d15a83 (diff) |
KVM: kvm_io_device: extend in_range() to manage len and write attribute
Modify member in_range() of structure kvm_io_device to pass length and the type
of the I/O (write or read).
This modification allows to use kvm_io_device with coalesced MMIO.
Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.net>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'virt/kvm')
-rw-r--r-- | virt/kvm/ioapic.c | 3 | ||||
-rw-r--r-- | virt/kvm/iodev.h | 8 | ||||
-rw-r--r-- | virt/kvm/kvm_main.c | 5 |
3 files changed, 10 insertions, 6 deletions
diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c index d0c668c6959e..c0d22870ee9c 100644 --- a/virt/kvm/ioapic.c +++ b/virt/kvm/ioapic.c | |||
@@ -307,7 +307,8 @@ void kvm_ioapic_update_eoi(struct kvm *kvm, int vector) | |||
307 | __kvm_ioapic_update_eoi(ioapic, i); | 307 | __kvm_ioapic_update_eoi(ioapic, i); |
308 | } | 308 | } |
309 | 309 | ||
310 | static int ioapic_in_range(struct kvm_io_device *this, gpa_t addr) | 310 | static int ioapic_in_range(struct kvm_io_device *this, gpa_t addr, |
311 | int len, int is_write) | ||
311 | { | 312 | { |
312 | struct kvm_ioapic *ioapic = (struct kvm_ioapic *)this->private; | 313 | struct kvm_ioapic *ioapic = (struct kvm_ioapic *)this->private; |
313 | 314 | ||
diff --git a/virt/kvm/iodev.h b/virt/kvm/iodev.h index c14e642027b2..55e8846ac3a6 100644 --- a/virt/kvm/iodev.h +++ b/virt/kvm/iodev.h | |||
@@ -27,7 +27,8 @@ struct kvm_io_device { | |||
27 | gpa_t addr, | 27 | gpa_t addr, |
28 | int len, | 28 | int len, |
29 | const void *val); | 29 | const void *val); |
30 | int (*in_range)(struct kvm_io_device *this, gpa_t addr); | 30 | int (*in_range)(struct kvm_io_device *this, gpa_t addr, int len, |
31 | int is_write); | ||
31 | void (*destructor)(struct kvm_io_device *this); | 32 | void (*destructor)(struct kvm_io_device *this); |
32 | 33 | ||
33 | void *private; | 34 | void *private; |
@@ -49,9 +50,10 @@ static inline void kvm_iodevice_write(struct kvm_io_device *dev, | |||
49 | dev->write(dev, addr, len, val); | 50 | dev->write(dev, addr, len, val); |
50 | } | 51 | } |
51 | 52 | ||
52 | static inline int kvm_iodevice_inrange(struct kvm_io_device *dev, gpa_t addr) | 53 | static inline int kvm_iodevice_inrange(struct kvm_io_device *dev, |
54 | gpa_t addr, int len, int is_write) | ||
53 | { | 55 | { |
54 | return dev->in_range(dev, addr); | 56 | return dev->in_range(dev, addr, len, is_write); |
55 | } | 57 | } |
56 | 58 | ||
57 | static inline void kvm_iodevice_destructor(struct kvm_io_device *dev) | 59 | static inline void kvm_iodevice_destructor(struct kvm_io_device *dev) |
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 83a0e5ce6037..9330fad2b918 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -1350,14 +1350,15 @@ void kvm_io_bus_destroy(struct kvm_io_bus *bus) | |||
1350 | } | 1350 | } |
1351 | } | 1351 | } |
1352 | 1352 | ||
1353 | struct kvm_io_device *kvm_io_bus_find_dev(struct kvm_io_bus *bus, gpa_t addr) | 1353 | struct kvm_io_device *kvm_io_bus_find_dev(struct kvm_io_bus *bus, |
1354 | gpa_t addr, int len, int is_write) | ||
1354 | { | 1355 | { |
1355 | int i; | 1356 | int i; |
1356 | 1357 | ||
1357 | for (i = 0; i < bus->dev_count; i++) { | 1358 | for (i = 0; i < bus->dev_count; i++) { |
1358 | struct kvm_io_device *pos = bus->devs[i]; | 1359 | struct kvm_io_device *pos = bus->devs[i]; |
1359 | 1360 | ||
1360 | if (pos->in_range(pos, addr)) | 1361 | if (pos->in_range(pos, addr, len, is_write)) |
1361 | return pos; | 1362 | return pos; |
1362 | } | 1363 | } |
1363 | 1364 | ||