From patchwork Sun Nov 30 18:35:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 416236 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 02CB814010B for ; Mon, 1 Dec 2014 05:39:28 +1100 (AEDT) Received: from localhost ([::1]:51317 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xv9P4-0002jC-62 for incoming@patchwork.ozlabs.org; Sun, 30 Nov 2014 13:39:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57529) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xv9LX-0005dZ-SQ for qemu-devel@nongnu.org; Sun, 30 Nov 2014 13:35:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xv9LR-0001pk-76 for qemu-devel@nongnu.org; Sun, 30 Nov 2014 13:35:47 -0500 Received: from mail-wg0-f50.google.com ([74.125.82.50]:51280) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xv9LQ-0001pX-Ut for qemu-devel@nongnu.org; Sun, 30 Nov 2014 13:35:41 -0500 Received: by mail-wg0-f50.google.com with SMTP id k14so12291123wgh.23 for ; Sun, 30 Nov 2014 10:35:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Kr9uhoCPNpnl9wxbyLNjvLA3wcIS4qz2jpMHzFtP73s=; b=BbvMeIVqQ3j/AUcHen0WdcPRmUkH051yD+EFnXTkBSE+zCwzNOmxljCI6XUBIcWKst Eq3Rvbw1JgMX3odiLFG8BO+Npy4yt/bm4reOhUa1lVEZzc6Gh8YUoAFaJZnlwxzml6pd Ika5PZnkm5ucFIk4gdh7aCjI5Vv86Pchilzcn3Hncy+kxUfZPbj2ZoPM17Gf66zo3AYV tOA2NwlKrOPAz4RJyxfQcDBecIdcI1gKh5IUaNr6TgVbmQokPtsu7KdLQiikF0Pe2BNa VmnnK8SgNYFYxObO2BioatDirgklQOGknoNBr6Cobuzn2l8CLsIVRDrqa76ZTZVJIWld aPRA== X-Gm-Message-State: ALoCoQndhLckntWNymCQSTDA9q1lB7D7ugpr5X0OzedAddIaff91nNpd2ye7ZByI2RArTyDn/b09 X-Received: by 10.180.91.201 with SMTP id cg9mr79708896wib.63.1417372540388; Sun, 30 Nov 2014 10:35:40 -0800 (PST) Received: from midway01-04-00.lavalab ([81.128.185.50]) by mx.google.com with ESMTPSA id z7sm38794058wia.22.2014.11.30.10.35.39 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 30 Nov 2014 10:35:39 -0800 (PST) From: Eric Auger To: eric.auger@st.com, christoffer.dall@linaro.org, qemu-devel@nongnu.org, agraf@suse.de, pbonzini@redhat.com, kim.phillips@freescale.com, a.rigo@virtualopensystems.com, manish.jaggi@caviumnetworks.com, joel.schopp@amd.com, zhaoshenglong@huawei.com, ard.biesheuvel@linaro.org Date: Sun, 30 Nov 2014 18:35:08 +0000 Message-Id: <1417372524-12936-4-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1417372524-12936-1-git-send-email-eric.auger@linaro.org> References: <1417372524-12936-1-git-send-email-eric.auger@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 74.125.82.50 Cc: peter.maydell@linaro.org, patches@linaro.org, eric.auger@linaro.org, will.deacon@arm.com, stuart.yoder@freescale.com, Bharat.Bhushan@freescale.com, alex.williamson@redhat.com, a.motakis@virtualopensystems.com, kvmarm@lists.cs.columbia.edu Subject: [Qemu-devel] [PATCH v8 03/19] hw/vfio/pci: generalize mask/unmask to any IRQ index X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org To prepare for platform device introduction, rename vfio_mask_intx and vfio_unmask_intx into vfio_mask_single_irqindex and respectively unmask_single_irqindex. Also use a nex index parameter. With that name and prototype the function will be usable for other indexes than VFIO_PCI_INTX_IRQ_INDEX. Signed-off-by: Eric Auger --- hw/vfio/pci.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 0d7d4a0..387da1a 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -293,12 +293,12 @@ static void vfio_disable_irqindex(VFIOPCIDevice *vdev, int index) /* * INTx */ -static void vfio_unmask_intx(VFIOPCIDevice *vdev) +static void vfio_unmask_single_irqindex(VFIOPCIDevice *vdev, int index) { struct vfio_irq_set irq_set = { .argsz = sizeof(irq_set), .flags = VFIO_IRQ_SET_DATA_NONE | VFIO_IRQ_SET_ACTION_UNMASK, - .index = VFIO_PCI_INTX_IRQ_INDEX, + .index = index, .start = 0, .count = 1, }; @@ -307,12 +307,12 @@ static void vfio_unmask_intx(VFIOPCIDevice *vdev) } #ifdef CONFIG_KVM /* Unused outside of CONFIG_KVM code */ -static void vfio_mask_intx(VFIOPCIDevice *vdev) +static void vfio_mask_single_irqindex(VFIOPCIDevice *vdev, int index) { struct vfio_irq_set irq_set = { .argsz = sizeof(irq_set), .flags = VFIO_IRQ_SET_DATA_NONE | VFIO_IRQ_SET_ACTION_MASK, - .index = VFIO_PCI_INTX_IRQ_INDEX, + .index = index, .start = 0, .count = 1, }; @@ -381,7 +381,7 @@ static void vfio_eoi(VFIOPCIDevice *vdev) vdev->intx.pending = false; pci_irq_deassert(&vdev->pdev); - vfio_unmask_intx(vdev); + vfio_unmask_single_irqindex(vdev, VFIO_PCI_INTX_IRQ_INDEX); } static void vfio_enable_intx_kvm(VFIOPCIDevice *vdev) @@ -404,7 +404,7 @@ static void vfio_enable_intx_kvm(VFIOPCIDevice *vdev) /* Get to a known interrupt state */ qemu_set_fd_handler(irqfd.fd, NULL, NULL, vdev); - vfio_mask_intx(vdev); + vfio_mask_single_irqindex(vdev, VFIO_PCI_INTX_IRQ_INDEX); vdev->intx.pending = false; pci_irq_deassert(&vdev->pdev); @@ -442,7 +442,7 @@ static void vfio_enable_intx_kvm(VFIOPCIDevice *vdev) } /* Let'em rip */ - vfio_unmask_intx(vdev); + vfio_unmask_single_irqindex(vdev, VFIO_PCI_INTX_IRQ_INDEX); vdev->intx.kvm_accel = true; @@ -458,7 +458,7 @@ fail_irqfd: event_notifier_cleanup(&vdev->intx.unmask); fail: qemu_set_fd_handler(irqfd.fd, vfio_intx_interrupt, NULL, vdev); - vfio_unmask_intx(vdev); + vfio_unmask_single_irqindex(vdev, VFIO_PCI_INTX_IRQ_INDEX); #endif } @@ -479,7 +479,7 @@ static void vfio_disable_intx_kvm(VFIOPCIDevice *vdev) * Get to a known state, hardware masked, QEMU ready to accept new * interrupts, QEMU IRQ de-asserted. */ - vfio_mask_intx(vdev); + vfio_mask_single_irqindex(vdev, VFIO_PCI_INTX_IRQ_INDEX); vdev->intx.pending = false; pci_irq_deassert(&vdev->pdev); @@ -497,7 +497,7 @@ static void vfio_disable_intx_kvm(VFIOPCIDevice *vdev) vdev->intx.kvm_accel = false; /* If we've missed an event, let it re-fire through QEMU */ - vfio_unmask_intx(vdev); + vfio_unmask_single_irqindex(vdev, VFIO_PCI_INTX_IRQ_INDEX); trace_vfio_disable_intx_kvm(vdev->host.domain, vdev->host.bus, vdev->host.slot, vdev->host.function);