@@ -439,7 +439,8 @@ static inline int pit_in_range(gpa_t addr)
}
static int pit_ioport_write(struct kvm_io_device *this,
- gpa_t addr, int len, const void *data)
+ gpa_t addr, int len, const void *data,
+ struct kvm_io_ext_data *ext_data)
{
struct kvm_pit *pit = dev_to_pit(this);
struct kvm_kpit_state *pit_state = &pit->pit_state;
@@ -585,7 +586,8 @@ static int pit_ioport_read(struct kvm_io_device *this,
}
static int speaker_ioport_write(struct kvm_io_device *this,
- gpa_t addr, int len, const void *data)
+ gpa_t addr, int len, const void *data,
+ struct kvm_io_ext_data *ext_data)
{
struct kvm_pit *pit = speaker_to_pit(this);
struct kvm_kpit_state *pit_state = &pit->pit_state;
@@ -480,7 +480,8 @@ static inline struct kvm_pic *to_pic(struct kvm_io_device *dev)
}
static int picdev_write(struct kvm_io_device *this,
- gpa_t addr, int len, const void *val)
+ gpa_t addr, int len, const void *val,
+ struct kvm_io_ext_data *ext_data)
{
struct kvm_pic *s = to_pic(this);
unsigned char data = *(unsigned char *)val;
@@ -836,7 +836,8 @@ static int apic_reg_write(struct kvm_lapic *apic, u32 reg, u32 val)
}
static int apic_mmio_write(struct kvm_io_device *this,
- gpa_t address, int len, const void *data)
+ gpa_t address, int len, const void *data,
+ struct kvm_io_ext_data *ext_data)
{
struct kvm_lapic *apic = to_lapic(this);
unsigned int offset = address - apic->base_address;
@@ -3571,13 +3571,14 @@ static void kvm_init_msr_list(void)
}
static int vcpu_mmio_write(struct kvm_vcpu *vcpu, gpa_t addr, int len,
- const void *v)
+ const void *v, struct kvm_io_ext_data *ext_data)
{
if (vcpu->arch.apic &&
- !kvm_iodevice_write(&vcpu->arch.apic->dev, addr, len, v))
+ !kvm_iodevice_write(&vcpu->arch.apic->dev, addr, len, v, ext_data))
return 0;
- return kvm_io_bus_write(vcpu->kvm, KVM_MMIO_BUS, addr, len, v);
+ return kvm_io_bus_write(vcpu->kvm, KVM_MMIO_BUS,
+ addr, len, v, ext_data);
}
static int vcpu_mmio_read(struct kvm_vcpu *vcpu, gpa_t addr, int len, void *v)
@@ -3807,6 +3808,7 @@ static int emulator_write_emulated_onepage(unsigned long addr,
struct kvm_vcpu *vcpu)
{
gpa_t gpa;
+ struct kvm_io_ext_data ext_data;
gpa = kvm_mmu_gva_to_gpa_write(vcpu, addr, exception);
@@ -3825,7 +3827,7 @@ mmio:
/*
* Is this MMIO handled locally?
*/
- if (!vcpu_mmio_write(vcpu, gpa, bytes, val))
+ if (!vcpu_mmio_write(vcpu, gpa, bytes, val, &ext_data))
return X86EMUL_CONTINUE;
vcpu->mmio_needed = 1;
@@ -3940,6 +3942,7 @@ static int kernel_pio(struct kvm_vcpu *vcpu, void *pd)
{
/* TODO: String I/O for in kernel device */
int r;
+ struct kvm_io_ext_data ext_data;
if (vcpu->arch.pio.in)
r = kvm_io_bus_read(vcpu->kvm, KVM_PIO_BUS, vcpu->arch.pio.port,
@@ -3947,7 +3950,7 @@ static int kernel_pio(struct kvm_vcpu *vcpu, void *pd)
else
r = kvm_io_bus_write(vcpu->kvm, KVM_PIO_BUS,
vcpu->arch.pio.port, vcpu->arch.pio.size,
- pd);
+ pd, &ext_data);
return r;
}
@@ -68,8 +68,12 @@ enum kvm_bus {
KVM_NR_BUSES
};
+struct kvm_io_ext_data {
+ int type; /* Extended data type */
+};
+
int kvm_io_bus_write(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
- int len, const void *val);
+ int len, const void *val, struct kvm_io_ext_data *data);
int kvm_io_bus_read(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, int len,
void *val);
int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx,
@@ -113,7 +117,8 @@ struct kvm_io_device_ops {
int (*write)(struct kvm_io_device *this,
gpa_t addr,
int len,
- const void *val);
+ const void *val,
+ struct kvm_io_ext_data *data);
void (*destructor)(struct kvm_io_device *this);
};
@@ -59,7 +59,8 @@ static int coalesced_mmio_in_range(struct kvm_coalesced_mmio_dev *dev,
}
static int coalesced_mmio_write(struct kvm_io_device *this,
- gpa_t addr, int len, const void *val)
+ gpa_t addr, int len, const void *val,
+ struct kvm_io_ext_data *ext_data)
{
struct kvm_coalesced_mmio_dev *dev = to_mmio(this);
struct kvm_coalesced_mmio_ring *ring = dev->kvm->coalesced_mmio_ring;
@@ -483,7 +483,7 @@ ioeventfd_in_range(struct _ioeventfd *p, gpa_t addr, int len, const void *val)
/* MMIO/PIO writes trigger an event if the addr/val match */
static int
ioeventfd_write(struct kvm_io_device *this, gpa_t addr, int len,
- const void *val)
+ const void *val, struct kvm_io_ext_data *ext_data)
{
struct _ioeventfd *p = to_ioeventfd(this);
@@ -321,7 +321,7 @@ static int ioapic_mmio_read(struct kvm_io_device *this, gpa_t addr, int len,
}
static int ioapic_mmio_write(struct kvm_io_device *this, gpa_t addr, int len,
- const void *val)
+ const void *val, struct kvm_io_ext_data *ext_data)
{
struct kvm_ioapic *ioapic = to_ioapic(this);
u32 data;
@@ -33,9 +33,11 @@ static inline int kvm_iodevice_read(struct kvm_io_device *dev,
}
static inline int kvm_iodevice_write(struct kvm_io_device *dev,
- gpa_t addr, int l, const void *v)
+ gpa_t addr, int l, const void *v,
+ struct kvm_io_ext_data *data)
{
- return dev->ops->write ? dev->ops->write(dev, addr, l, v) : -EOPNOTSUPP;
+ return dev->ops->write ?
+ dev->ops->write(dev, addr, l, v, data) : -EOPNOTSUPP;
}
static inline void kvm_iodevice_destructor(struct kvm_io_device *dev)
@@ -2221,14 +2221,14 @@ static void kvm_io_bus_destroy(struct kvm_io_bus *bus)
/* kvm_io_bus_write - called under kvm->slots_lock */
int kvm_io_bus_write(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
- int len, const void *val)
+ int len, const void *val, struct kvm_io_ext_data *ext_data)
{
int i;
struct kvm_io_bus *bus;
bus = srcu_dereference(kvm->buses[bus_idx], &kvm->srcu);
for (i = 0; i < bus->dev_count; i++)
- if (!kvm_iodevice_write(bus->devs[i], addr, len, val))
+ if (!kvm_iodevice_write(bus->devs[i], addr, len, val, ext_data))
return 0;
return -EOPNOTSUPP;
}