From patchwork Tue Feb 4 16:53:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 3577891 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 52A819F382 for ; Tue, 4 Feb 2014 16:54:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 561912017D for ; Tue, 4 Feb 2014 16:54:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 73482201F7 for ; Tue, 4 Feb 2014 16:54:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932172AbaBDQyB (ORCPT ); Tue, 4 Feb 2014 11:54:01 -0500 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]:49545 "EHLO cam-admin0.cambridge.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932104AbaBDQx5 (ORCPT ); Tue, 4 Feb 2014 11:53:57 -0500 Received: from mudshark.cambridge.arm.com (mudshark.cambridge.arm.com [10.1.203.36]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id s14GrXkm003306; Tue, 4 Feb 2014 16:53:33 GMT Received: by mudshark.cambridge.arm.com (Postfix, from userid 1000) id C3B21C2B19; Tue, 4 Feb 2014 16:53:32 +0000 (GMT) From: Will Deacon To: kvm@vger.kernel.org Cc: kvmarm@lists.cs.columbia.edu, penberg@kernel.org, marc.zyngier@arm.com, arnd@arndb.de Subject: [PATCH 08/17] kvm tools: irq: remove pin parameter from irq__register_device Date: Tue, 4 Feb 2014 16:53:23 +0000 Message-Id: <1391532812-2043-9-git-send-email-will.deacon@arm.com> X-Mailer: git-send-email 1.8.2.2 In-Reply-To: <1391532812-2043-1-git-send-email-will.deacon@arm.com> References: <1391532812-2043-1-git-send-email-will.deacon@arm.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In preparation for moving the irq allocation into generic code, remove the pin parameter from irq__register_device and temporarily place the onus on the emulation driver to allocate the pin (which is always 1 and only used on PCI anyway). Signed-off-by: Will Deacon --- tools/kvm/arm/irq.c | 2 +- tools/kvm/hw/pci-shmem.c | 6 +++--- tools/kvm/hw/vesa.c | 6 +++--- tools/kvm/include/kvm/irq.h | 2 +- tools/kvm/powerpc/irq.c | 3 +-- tools/kvm/virtio/mmio.c | 4 ++-- tools/kvm/virtio/pci.c | 6 +++--- tools/kvm/x86/irq.c | 10 +--------- 8 files changed, 15 insertions(+), 24 deletions(-) diff --git a/tools/kvm/arm/irq.c b/tools/kvm/arm/irq.c index e173e04f3668..dd53f1216c51 100644 --- a/tools/kvm/arm/irq.c +++ b/tools/kvm/arm/irq.c @@ -4,7 +4,7 @@ #include "arm-common/gic.h" -int irq__register_device(u32 dev, u8 *pin, u8 *line) +int irq__register_device(u32 dev, u8 *line) { *line = gic__alloc_irqnum(); return 0; diff --git a/tools/kvm/hw/pci-shmem.c b/tools/kvm/hw/pci-shmem.c index 701231a6ce1e..d0d88f821aba 100644 --- a/tools/kvm/hw/pci-shmem.c +++ b/tools/kvm/hw/pci-shmem.c @@ -352,7 +352,7 @@ int shmem_parser(const struct option *opt, const char *arg, int unset) int pci_shmem__init(struct kvm *kvm) { - u8 line, pin; + u8 line; char *mem; int r; @@ -360,11 +360,11 @@ int pci_shmem__init(struct kvm *kvm) return 0; /* Register good old INTx */ - r = irq__register_device(PCI_DEVICE_ID_PCI_SHMEM, &pin, &line); + r = irq__register_device(PCI_DEVICE_ID_PCI_SHMEM, &line); if (r < 0) return r; - pci_shmem_pci_device.irq_pin = pin; + pci_shmem_pci_device.irq_pin = 1; pci_shmem_pci_device.irq_line = line; /* Register MMIO space for MSI-X */ diff --git a/tools/kvm/hw/vesa.c b/tools/kvm/hw/vesa.c index 47e3a694d98b..07c3978c785e 100644 --- a/tools/kvm/hw/vesa.c +++ b/tools/kvm/hw/vesa.c @@ -55,14 +55,14 @@ static struct framebuffer vesafb; struct framebuffer *vesa__init(struct kvm *kvm) { u16 vesa_base_addr; - u8 line, pin; + 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, &pin, &line); + r = irq__register_device(PCI_DEVICE_ID_VESA, &line); if (r < 0) return ERR_PTR(r); @@ -70,7 +70,7 @@ struct framebuffer *vesa__init(struct kvm *kvm) if (r < 0) return ERR_PTR(r); - vesa_pci_device.irq_pin = pin; + vesa_pci_device.irq_pin = 1; vesa_pci_device.irq_line = line; vesa_base_addr = (u16)r; vesa_pci_device.bar[0] = cpu_to_le32(vesa_base_addr | PCI_BASE_ADDRESS_SPACE_IO); diff --git a/tools/kvm/include/kvm/irq.h b/tools/kvm/include/kvm/irq.h index 5c1274b98610..20213c064b0b 100644 --- a/tools/kvm/include/kvm/irq.h +++ b/tools/kvm/include/kvm/irq.h @@ -22,7 +22,7 @@ struct pci_dev { struct list_head lines; }; -int irq__register_device(u32 dev, u8 *pin, u8 *line); +int irq__register_device(u32 dev, u8 *line); struct rb_node *irq__get_pci_tree(void); diff --git a/tools/kvm/powerpc/irq.c b/tools/kvm/powerpc/irq.c index ae9da507fb82..d906bb2840bc 100644 --- a/tools/kvm/powerpc/irq.c +++ b/tools/kvm/powerpc/irq.c @@ -32,9 +32,8 @@ * generic & cope with multiple PPC platform types. */ -int irq__register_device(u32 dev, u8 *pin, u8 *line) +int irq__register_device(u32 dev, u8 *line) { - *pin = 1; /* * Have I said how nasty I find this? Line should be dontcare... PHB * should determine which CPU/XICS IRQ to fire. diff --git a/tools/kvm/virtio/mmio.c b/tools/kvm/virtio/mmio.c index afae6a70f006..90f90ede3c1f 100644 --- a/tools/kvm/virtio/mmio.c +++ b/tools/kvm/virtio/mmio.c @@ -260,7 +260,7 @@ 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 pin, line; + u8 line; vmmio->addr = virtio_mmio_get_io_space_block(VIRTIO_MMIO_IO_SIZE); vmmio->kvm = kvm; @@ -277,7 +277,7 @@ int virtio_mmio_init(struct kvm *kvm, void *dev, struct virtio_device *vdev, .queue_num_max = 256, }; - if (irq__register_device(subsys_id, &pin, &line) < 0) + if (irq__register_device(subsys_id, &line) < 0) return -1; vmmio->irq = line; vmmio->dev_hdr = (struct device_header) { diff --git a/tools/kvm/virtio/pci.c b/tools/kvm/virtio/pci.c index e1b5be6b036e..77dde3bee741 100644 --- a/tools/kvm/virtio/pci.c +++ b/tools/kvm/virtio/pci.c @@ -335,7 +335,7 @@ 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 pin, line; + u8 line; int r; vpci->kvm = kvm; @@ -406,14 +406,14 @@ 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, &pin, &line); + 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 = pin; + vpci->pci_hdr.irq_pin = 1; vpci->pci_hdr.irq_line = line; r = device__register(&vpci->dev_hdr); if (r < 0) diff --git a/tools/kvm/x86/irq.c b/tools/kvm/x86/irq.c index 7447c6b7d7aa..17db2110e96f 100644 --- a/tools/kvm/x86/irq.c +++ b/tools/kvm/x86/irq.c @@ -85,7 +85,7 @@ static int insert(struct rb_root *root, struct pci_dev *data) return 0; } -int irq__register_device(u32 dev, u8 *pin, u8 *line) +int irq__register_device(u32 dev, u8 *line) { struct pci_dev *node; int r; @@ -100,13 +100,6 @@ int irq__register_device(u32 dev, u8 *pin, u8 *line) *node = (struct pci_dev) { .id = dev, - /* - * PCI supports only INTA#,B#,C#,D# per device. - * A#,B#,C#,D# are allowed for multifunctional - * devices so stick with A# for our single - * function devices. - */ - .pin = 1, }; INIT_LIST_HEAD(&node->lines); @@ -126,7 +119,6 @@ int irq__register_device(u32 dev, u8 *pin, u8 *line) new->line = next_line++; *line = new->line; - *pin = node->pin; list_add(&new->node, &node->lines);