You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
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>
This commit is contained in:
committed by
Avi Kivity
parent
131d82791b
commit
92760499d0
+2
-1
@@ -307,7 +307,8 @@ void kvm_ioapic_update_eoi(struct kvm *kvm, int vector)
|
||||
__kvm_ioapic_update_eoi(ioapic, i);
|
||||
}
|
||||
|
||||
static int ioapic_in_range(struct kvm_io_device *this, gpa_t addr)
|
||||
static int ioapic_in_range(struct kvm_io_device *this, gpa_t addr,
|
||||
int len, int is_write)
|
||||
{
|
||||
struct kvm_ioapic *ioapic = (struct kvm_ioapic *)this->private;
|
||||
|
||||
|
||||
+5
-3
@@ -27,7 +27,8 @@ struct kvm_io_device {
|
||||
gpa_t addr,
|
||||
int len,
|
||||
const void *val);
|
||||
int (*in_range)(struct kvm_io_device *this, gpa_t addr);
|
||||
int (*in_range)(struct kvm_io_device *this, gpa_t addr, int len,
|
||||
int is_write);
|
||||
void (*destructor)(struct kvm_io_device *this);
|
||||
|
||||
void *private;
|
||||
@@ -49,9 +50,10 @@ static inline void kvm_iodevice_write(struct kvm_io_device *dev,
|
||||
dev->write(dev, addr, len, val);
|
||||
}
|
||||
|
||||
static inline int kvm_iodevice_inrange(struct kvm_io_device *dev, gpa_t addr)
|
||||
static inline int kvm_iodevice_inrange(struct kvm_io_device *dev,
|
||||
gpa_t addr, int len, int is_write)
|
||||
{
|
||||
return dev->in_range(dev, addr);
|
||||
return dev->in_range(dev, addr, len, is_write);
|
||||
}
|
||||
|
||||
static inline void kvm_iodevice_destructor(struct kvm_io_device *dev)
|
||||
|
||||
+3
-2
@@ -1350,14 +1350,15 @@ void kvm_io_bus_destroy(struct kvm_io_bus *bus)
|
||||
}
|
||||
}
|
||||
|
||||
struct kvm_io_device *kvm_io_bus_find_dev(struct kvm_io_bus *bus, gpa_t addr)
|
||||
struct kvm_io_device *kvm_io_bus_find_dev(struct kvm_io_bus *bus,
|
||||
gpa_t addr, int len, int is_write)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < bus->dev_count; i++) {
|
||||
struct kvm_io_device *pos = bus->devs[i];
|
||||
|
||||
if (pos->in_range(pos, addr))
|
||||
if (pos->in_range(pos, addr, len, is_write))
|
||||
return pos;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user