From patchwork Mon Dec 22 20:43:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Williamson X-Patchwork-Id: 42550 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f70.google.com (mail-ee0-f70.google.com [74.125.83.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 74A1B26C8A for ; Mon, 22 Dec 2014 20:46:56 +0000 (UTC) Received: by mail-ee0-f70.google.com with SMTP id b57sf3359467eek.1 for ; Mon, 22 Dec 2014 12:46:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:user-agent:mime-version:content-type :content-transfer-encoding:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=/+ifoMRb6W8MESJPbMh39qAOfKN+Zb4b0CWvwyMDF9U=; b=D0Drt9JWffJVDw7+yW8rHcB7UuKZN/H2h/pToOMn0/Z1wBfACEVWBj8njjUGFpIRFD NMqMJl3r1j7Rbvu0UpjdhOTG6SEENxHDgaKC8SHqCB3IkUqMV5t+M48bxaIZza28FtIR cVeghGN3xQogZ/1i7yu9IqL/iYZY2q5zsMXMlsujpQMg6NWdCU9znfaAPzjJlFWktAE5 Ewp2zOSrKCUU8yRYT9h9qjWwVX4SiHcKhCPAEpuT5ruwmgL0PGQ4fnxcgU8qMRrGHTNq cT2nevGmvFTbWR+/Mq/9d/0+2RHHxaO+JjJ5imViJ/7ZqdePXw7d5Acmis9OzskC+nO/ 3bEQ== X-Gm-Message-State: ALoCoQm2rFxlQ0eFUdHJBrfMkySTNH+iK03eSlFeff8DN7avtQzD0w+Pj5CYztowAiZ5faRS7pCK X-Received: by 10.152.44.225 with SMTP id h1mr3007909lam.2.1419281215669; Mon, 22 Dec 2014 12:46:55 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.234.103 with SMTP id ud7ls476953lac.8.gmail; Mon, 22 Dec 2014 12:46:55 -0800 (PST) X-Received: by 10.152.25.129 with SMTP id c1mr17086023lag.65.1419281215498; Mon, 22 Dec 2014 12:46:55 -0800 (PST) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id tn9si19561641lbb.72.2014.12.22.12.46.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 22 Dec 2014 12:46:55 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by mail-la0-f44.google.com with SMTP id gd6so4651195lab.17 for ; Mon, 22 Dec 2014 12:46:55 -0800 (PST) X-Received: by 10.152.26.201 with SMTP id n9mr24184052lag.50.1419281215398; Mon, 22 Dec 2014 12:46:55 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.142.69 with SMTP id ru5csp1140755lbb; Mon, 22 Dec 2014 12:46:54 -0800 (PST) X-Received: by 10.140.17.70 with SMTP id 64mr25992993qgc.53.1419281212930; Mon, 22 Dec 2014 12:46:52 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id w9si21204079qgd.24.2014.12.22.12.46.52 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 22 Dec 2014 12:46:52 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:41871 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y39sR-0002Yj-Vj for patch@linaro.org; Mon, 22 Dec 2014 15:46:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37861) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y39pS-0006MD-Vv for qemu-devel@nongnu.org; Mon, 22 Dec 2014 15:43:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y39pN-0007iX-VY for qemu-devel@nongnu.org; Mon, 22 Dec 2014 15:43:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48497) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y39pN-0007iP-I2 for qemu-devel@nongnu.org; Mon, 22 Dec 2014 15:43:41 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sBMKhe3l013305 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 22 Dec 2014 15:43:41 -0500 Received: from bling.home (ovpn-113-45.phx2.redhat.com [10.3.113.45]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sBMKhewg002215; Mon, 22 Dec 2014 15:43:40 -0500 From: Alex Williamson To: qemu-devel@nongnu.org Date: Mon, 22 Dec 2014 13:43:40 -0700 Message-ID: <20141222204340.31398.13639.stgit@bling.home> In-Reply-To: <20141222204144.31398.31803.stgit@bling.home> References: <20141222204144.31398.31803.stgit@bling.home> User-Agent: StGit/0.17-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: alex.williamson@redhat.com Subject: [Qemu-devel] [PULL 05/14] 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: alex.williamson@redhat.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Eric Auger 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 Signed-off-by: Alex Williamson --- 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 f882dc7..7083151 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);