aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWill Deacon <will.deacon@arm.com>2014-02-04 16:53:58 +0000
committerWill Deacon <will.deacon@arm.com>2015-06-01 16:39:55 +0100
commit7f542b0f39bd6ef93d323a5ac27ca677606c337b (patch)
treeb5aa79b8b0b8e67b05538e46a2f013909c866d3b
parentf83cd1611d4b1524a1cbf7f7ae8cb79fd9b76c22 (diff)
downloadkvmtool-7f542b0f39bd6ef93d323a5ac27ca677606c337b.tar.gz
kvm tools: irq: remove remaining parameters to irq__register_device
With the removal of the x86 irq rbtree, the only parameter used by irq__register_device is actually used to return the new line. This patch removes all of the parameters from irq__register_device and returns the allocated line directly. Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
-rw-r--r--arm/irq.c5
-rw-r--r--hw/pci-shmem.c7
-rw-r--r--hw/vesa.c7
-rw-r--r--include/kvm/irq.h2
-rw-r--r--powerpc/irq.c5
-rw-r--r--virtio/mmio.c7
-rw-r--r--virtio/pci.c7
-rw-r--r--x86/irq.c5
8 files changed, 12 insertions, 33 deletions
diff --git a/arm/irq.c b/arm/irq.c
index dd53f121..39d4fbc2 100644
--- a/arm/irq.c
+++ b/arm/irq.c
@@ -4,10 +4,9 @@
#include "arm-common/gic.h"
-int irq__register_device(u32 dev, u8 *line)
+int irq__register_device(void)
{
- *line = gic__alloc_irqnum();
- return 0;
+ return gic__alloc_irqnum();
}
int irq__add_msix_route(struct kvm *kvm, struct msi_msg *msg)
diff --git a/hw/pci-shmem.c b/hw/pci-shmem.c
index d0d88f82..c0c63223 100644
--- a/hw/pci-shmem.c
+++ b/hw/pci-shmem.c
@@ -352,7 +352,6 @@ int shmem_parser(const struct option *opt, const char *arg, int unset)
int pci_shmem__init(struct kvm *kvm)
{
- u8 line;
char *mem;
int r;
@@ -360,12 +359,8 @@ int pci_shmem__init(struct kvm *kvm)
return 0;
/* Register good old INTx */
- r = irq__register_device(PCI_DEVICE_ID_PCI_SHMEM, &line);
- if (r < 0)
- return r;
-
pci_shmem_pci_device.irq_pin = 1;
- pci_shmem_pci_device.irq_line = line;
+ pci_shmem_pci_device.irq_line = irq__register_device();
/* Register MMIO space for MSI-X */
r = ioport__register(kvm, IOPORT_EMPTY, &shmem_pci__io_ops, IOPORT_SIZE, NULL);
diff --git a/hw/vesa.c b/hw/vesa.c
index 07c3978c..f033ebed 100644
--- a/hw/vesa.c
+++ b/hw/vesa.c
@@ -55,23 +55,18 @@ static struct framebuffer vesafb;
struct framebuffer *vesa__init(struct kvm *kvm)
{
u16 vesa_base_addr;
- u8 line;
char *mem;
int r;
if (!kvm->cfg.vnc && !kvm->cfg.sdl && !kvm->cfg.gtk)
return NULL;
- r = irq__register_device(PCI_DEVICE_ID_VESA, &line);
- if (r < 0)
- return ERR_PTR(r);
-
r = ioport__register(kvm, IOPORT_EMPTY, &vesa_io_ops, IOPORT_SIZE, NULL);
if (r < 0)
return ERR_PTR(r);
vesa_pci_device.irq_pin = 1;
- vesa_pci_device.irq_line = line;
+ vesa_pci_device.irq_line = irq__register_device();
vesa_base_addr = (u16)r;
vesa_pci_device.bar[0] = cpu_to_le32(vesa_base_addr | PCI_BASE_ADDRESS_SPACE_IO);
device__register(&vesa_device);
diff --git a/include/kvm/irq.h b/include/kvm/irq.h
index 7652b858..14cf5748 100644
--- a/include/kvm/irq.h
+++ b/include/kvm/irq.h
@@ -10,7 +10,7 @@
struct kvm;
-int irq__register_device(u32 dev, u8 *line);
+int irq__register_device(void);
int irq__init(struct kvm *kvm);
int irq__exit(struct kvm *kvm);
diff --git a/powerpc/irq.c b/powerpc/irq.c
index d906bb28..3436ae85 100644
--- a/powerpc/irq.c
+++ b/powerpc/irq.c
@@ -32,14 +32,13 @@
* generic & cope with multiple PPC platform types.
*/
-int irq__register_device(u32 dev, u8 *line)
+int irq__register_device(void)
{
/*
* Have I said how nasty I find this? Line should be dontcare... PHB
* should determine which CPU/XICS IRQ to fire.
*/
- *line = xics_alloc_irqnum();
- return 0;
+ return xics_alloc_irqnum();
}
int irq__add_msix_route(struct kvm *kvm, struct msi_msg *msg)
diff --git a/virtio/mmio.c b/virtio/mmio.c
index 90f90ede..a8212bac 100644
--- a/virtio/mmio.c
+++ b/virtio/mmio.c
@@ -260,7 +260,6 @@ int virtio_mmio_init(struct kvm *kvm, void *dev, struct virtio_device *vdev,
int device_id, int subsys_id, int class)
{
struct virtio_mmio *vmmio = vdev->virtio;
- u8 line;
vmmio->addr = virtio_mmio_get_io_space_block(VIRTIO_MMIO_IO_SIZE);
vmmio->kvm = kvm;
@@ -277,9 +276,7 @@ int virtio_mmio_init(struct kvm *kvm, void *dev, struct virtio_device *vdev,
.queue_num_max = 256,
};
- if (irq__register_device(subsys_id, &line) < 0)
- return -1;
- vmmio->irq = line;
+ vmmio->irq = irq__register_device();
vmmio->dev_hdr = (struct device_header) {
.bus_type = DEVICE_BUS_MMIO,
.data = generate_virtio_mmio_fdt_node,
@@ -293,7 +290,7 @@ int virtio_mmio_init(struct kvm *kvm, void *dev, struct virtio_device *vdev,
*
* virtio_mmio.devices=0x200@0xd2000000:5,0x200@0xd2000200:6
*/
- pr_info("virtio-mmio.devices=0x%x@0x%x:%d\n", VIRTIO_MMIO_IO_SIZE, vmmio->addr, line);
+ pr_info("virtio-mmio.devices=0x%x@0x%x:%d\n", VIRTIO_MMIO_IO_SIZE, vmmio->addr, vmmio->irq);
return 0;
}
diff --git a/virtio/pci.c b/virtio/pci.c
index 77dde3be..8005e171 100644
--- a/virtio/pci.c
+++ b/virtio/pci.c
@@ -335,7 +335,6 @@ int virtio_pci__init(struct kvm *kvm, void *dev, struct virtio_device *vdev,
int device_id, int subsys_id, int class)
{
struct virtio_pci *vpci = vdev->virtio;
- u8 line;
int r;
vpci->kvm = kvm;
@@ -406,15 +405,11 @@ int virtio_pci__init(struct kvm *kvm, void *dev, struct virtio_device *vdev,
vpci->pci_hdr.msix.pba_offset = cpu_to_le32(2 | PCI_IO_SIZE);
vpci->config_vector = 0;
- r = irq__register_device(subsys_id, &line);
- if (r < 0)
- goto free_msix_mmio;
-
if (kvm__supports_extension(kvm, KVM_CAP_SIGNAL_MSI))
vpci->features |= VIRTIO_PCI_F_SIGNAL_MSI;
vpci->pci_hdr.irq_pin = 1;
- vpci->pci_hdr.irq_line = line;
+ vpci->pci_hdr.irq_line = irq__register_device();
r = device__register(&vpci->dev_hdr);
if (r < 0)
goto free_msix_mmio;
diff --git a/x86/irq.c b/x86/irq.c
index ef5ec34a..2c760699 100644
--- a/x86/irq.c
+++ b/x86/irq.c
@@ -39,10 +39,9 @@ static int irq__add_routing(u32 gsi, u32 type, u32 irqchip, u32 pin)
return 0;
}
-int irq__register_device(u32 dev, u8 *line)
+int irq__register_device(void)
{
- *line = next_line++;
- return 0;
+ return next_line++;
}
int irq__init(struct kvm *kvm)