From: Jan Kiszka <jan.kiszka@xxxxxxxxxxx> Remove MSI-X from function names - the interface is valid for MSI as well - and use KVMMsiMessage as parameter. Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxxxxxxx> --- hw/msix.c | 15 ++++----------- kvm.h | 13 +++++-------- qemu-kvm.c | 32 +++++++++++++------------------- 3 files changed, 22 insertions(+), 38 deletions(-) diff --git a/hw/msix.c b/hw/msix.c index 42870c5..52facd4 100644 --- a/hw/msix.c +++ b/hw/msix.c @@ -51,12 +51,10 @@ int msix_supported; static void kvm_msix_free(PCIDevice *dev) { int vector, changed = 0; - KVMMsiMessage *kmm; for (vector = 0; vector < dev->msix_entries_nr; ++vector) { if (dev->msix_entry_used[vector]) { - kmm = &dev->msix_irq_entries[vector]; - kvm_del_msix(kmm->gsi, kmm->addr_lo, kmm->addr_hi, kmm->data); + kvm_msi_message_del(&dev->msix_irq_entries[vector]); changed = 1; } } @@ -94,9 +92,7 @@ static void kvm_msix_update(PCIDevice *dev, int vector, if (memcmp(entry, &e, sizeof e) != 0) { int r; - r = kvm_update_msix(entry->gsi, entry->addr_lo, - entry->addr_hi, entry->data, - e.gsi, e.addr_lo, e.addr_hi, e.data); + r = kvm_msi_message_update(entry, &e); if (r) { fprintf(stderr, "%s: kvm_update_msix failed: %s\n", __func__, strerror(-r)); @@ -131,7 +127,7 @@ static int kvm_msix_add(PCIDevice *dev, unsigned vector) } kmm->gsi = r; kvm_msix_message_from_vector(dev, vector, kmm); - r = kvm_add_msix(kmm->gsi, kmm->addr_lo, kmm->addr_hi, kmm->data); + r = kvm_msi_message_add(kmm); if (r < 0) { fprintf(stderr, "%s: kvm_add_msix failed: %s\n", __func__, strerror(-r)); return r; @@ -147,13 +143,10 @@ static int kvm_msix_add(PCIDevice *dev, unsigned vector) static void kvm_msix_del(PCIDevice *dev, unsigned vector) { - KVMMsiMessage *kmm; - if (dev->msix_entry_used[vector]) { return; } - kmm = &dev->msix_irq_entries[vector]; - kvm_del_msix(kmm->gsi, kmm->addr_lo, kmm->addr_hi, kmm->data); + kvm_msi_message_del(&dev->msix_irq_entries[vector]); kvm_commit_irq_routes(); } diff --git a/kvm.h b/kvm.h index 8ece0b3..179eb7e 100644 --- a/kvm.h +++ b/kvm.h @@ -223,14 +223,11 @@ typedef struct KVMMsiMessage { int kvm_has_gsi_routing(void); int kvm_get_irq_route_gsi(void); -int kvm_add_msix(uint32_t gsi, uint32_t addr_lo, - uint32_t addr_hi, uint32_t data); -int kvm_del_msix(uint32_t gsi, uint32_t addr_lo, - uint32_t addr_hi, uint32_t data); -int kvm_update_msix(uint32_t old_gsi, uint32_t old_addr_lo, - uint32_t old_addr_hi, uint32_t old_data, - uint32_t new_gsi, uint32_t new_addr_lo, - uint32_t new_addr_hi, uint32_t new_data); + +int kvm_msi_message_add(KVMMsiMessage *msg); +int kvm_msi_message_del(KVMMsiMessage *msg); +int kvm_msi_message_update(KVMMsiMessage *old, KVMMsiMessage *new); + int kvm_commit_irq_routes(void); int kvm_irqchip_in_kernel(void); diff --git a/qemu-kvm.c b/qemu-kvm.c index 7689225..9cbc109 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -969,46 +969,40 @@ int kvm_get_irq_route_gsi(void) return -ENOSPC; } -static void kvm_msix_routing_entry(struct kvm_irq_routing_entry *e, - uint32_t gsi, uint32_t addr_lo, - uint32_t addr_hi, uint32_t data) +static void kvm_msi_routing_entry(struct kvm_irq_routing_entry *e, + KVMMsiMessage *msg) { - e->gsi = gsi; + e->gsi = msg->gsi; e->type = KVM_IRQ_ROUTING_MSI; e->flags = 0; - e->u.msi.address_lo = addr_lo; - e->u.msi.address_hi = addr_hi; - e->u.msi.data = data; + e->u.msi.address_lo = msg->addr_lo; + e->u.msi.address_hi = msg->addr_hi; + e->u.msi.data = msg->data; } -int kvm_add_msix(uint32_t gsi, uint32_t addr_lo, - uint32_t addr_hi, uint32_t data) +int kvm_msi_message_add(KVMMsiMessage *msg) { struct kvm_irq_routing_entry e; - kvm_msix_routing_entry(&e, gsi, addr_lo, addr_hi, data); + kvm_msi_routing_entry(&e, msg); return kvm_add_routing_entry(&e); } -int kvm_del_msix(uint32_t gsi, uint32_t addr_lo, - uint32_t addr_hi, uint32_t data) +int kvm_msi_message_del(KVMMsiMessage *msg) { struct kvm_irq_routing_entry e; - kvm_msix_routing_entry(&e, gsi, addr_lo, addr_hi, data); + kvm_msi_routing_entry(&e, msg); return kvm_del_routing_entry(&e); } -int kvm_update_msix(uint32_t old_gsi, uint32_t old_addr_lo, - uint32_t old_addr_hi, uint32_t old_data, - uint32_t new_gsi, uint32_t new_addr_lo, - uint32_t new_addr_hi, uint32_t new_data) +int kvm_msi_message_update(KVMMsiMessage *old, KVMMsiMessage *new) { struct kvm_irq_routing_entry e1, e2; - kvm_msix_routing_entry(&e1, old_gsi, old_addr_lo, old_addr_hi, old_data); - kvm_msix_routing_entry(&e2, new_gsi, new_addr_lo, new_addr_hi, new_data); + kvm_msi_routing_entry(&e1, old); + kvm_msi_routing_entry(&e2, new); return kvm_update_routing_entry(&e1, &e2); } -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html