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: Auger Eric X-Patchwork-Id: 41726 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AF67824001 for ; Sun, 30 Nov 2014 18:35:42 +0000 (UTC) Received: by mail-wi0-f197.google.com with SMTP id l15sf5877908wiw.4 for ; Sun, 30 Nov 2014 10:35:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=Kr9uhoCPNpnl9wxbyLNjvLA3wcIS4qz2jpMHzFtP73s=; b=QldNwfwOouvboTkEANZTeE9qAnInZFlAfFF/pza5xE311HgvMZFik1nSEgsO9A5CT8 BFwfZJrqUKtQEl79bSRuPfhSYltTqUTGalotry/AINXvMCJloKVuqkun5X+aarII5ZEa k5vGJh9GAKO596eCd5k8IHScupS+D++jwCyqFp9fJ0nf/Ln4GdDKsZn/OSnlqvpEnXZV i9GpY0vN2Tse44PjmIKGmql0oKBlmsHi1R/wSKR2xUdg6EYqzqNu/Tm7ir5/bQ/yDTn1 oPrGT1K57MVc5hAWKcpXhMagxFPpdaQiO68XyYLLTKCFpFZPlCjFGyJWWwqk9W1PY40R Aekg== X-Gm-Message-State: ALoCoQlphefYczF03Ek65IJockyz3+TaIK9T7wmi+HmFLjBbl1V27tZpDhX/y3Ty5iacIMv/Uk7S X-Received: by 10.194.95.74 with SMTP id di10mr5151159wjb.0.1417372541959; Sun, 30 Nov 2014 10:35:41 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.2.67 with SMTP id 3ls963414las.61.gmail; Sun, 30 Nov 2014 10:35:41 -0800 (PST) X-Received: by 10.152.115.230 with SMTP id jr6mr53478638lab.2.1417372541664; Sun, 30 Nov 2014 10:35:41 -0800 (PST) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id v9si15613294lbw.113.2014.11.30.10.35.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 30 Nov 2014 10:35:41 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by mail-lb0-f182.google.com with SMTP id f15so8065993lbj.41 for ; Sun, 30 Nov 2014 10:35:41 -0800 (PST) X-Received: by 10.112.235.196 with SMTP id uo4mr52443939lbc.66.1417372541335; Sun, 30 Nov 2014 10:35:41 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp172657lbc; Sun, 30 Nov 2014 10:35:40 -0800 (PST) X-Received: by 10.180.85.33 with SMTP id e1mr38341130wiz.61.1417372540717; Sun, 30 Nov 2014 10:35:40 -0800 (PST) Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com. [209.85.212.179]) by mx.google.com with ESMTPS id p6si41836455wix.81.2014.11.30.10.35.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 30 Nov 2014 10:35:40 -0800 (PST) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.179 as permitted sender) client-ip=209.85.212.179; Received: by mail-wi0-f179.google.com with SMTP id ex7so15253430wid.6 for ; Sun, 30 Nov 2014 10:35:40 -0800 (PST) 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 Cc: eric.auger@linaro.org, kvmarm@lists.cs.columbia.edu, patches@linaro.org, alex.williamson@redhat.com, peter.maydell@linaro.org, will.deacon@arm.com, Bharat.Bhushan@freescale.com, stuart.yoder@freescale.com, a.motakis@virtualopensystems.com Subject: [PATCH v8 03/19] hw/vfio/pci: generalize mask/unmask to any IRQ index 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-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: eric.auger@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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);