From patchwork Mon Jul 6 13:24:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 50754 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 568DB229FC for ; Mon, 6 Jul 2015 13:25:16 +0000 (UTC) Received: by wguu7 with SMTP id u7sf50145681wgu.0 for ; Mon, 06 Jul 2015 06:25:15 -0700 (PDT) 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=JjaSWiGkHPAxqHxoF/WrS/iRSuy0tzt86jp3gQ39QiY=; b=RfIZfRbzGLsvS6OZsaFffHCZSIjQA9keFVmObePfGDhhjx2Zv6w9IC6yOuVH8oVLx0 zprhLIroaMmuRyUPJd3JXWCeP1RS/zoAl2gA/XZqhpG3Zp9sfPeJWv9geI4A4Z+hjQvD 7X8gMLGWGuOz3dRXUBJkYFPS7wIVA/c6W1AVbZr1XUrhM/ETVUYZMGt5Vr6N7S+2ddKP nWlg7qaED3zVsNGKHsRc4+sxXj6/F9jmDttYAN64dM6H+lya4ph7Nf91TDA4A/YX/DOI voRDQMBm1x8E0pgprJwfzmgpqyo3hWyYOlDVfd+xolrEixwNd0t/KOfqCA+nWMULr6eT F9Xg== X-Gm-Message-State: ALoCoQn2R1Msr1OodNfsD8PhWXEMar8qAz8ZBLxmk6YwNV/VfbUwZyP+TB/XiCsE5iMt1K5qM2Hs X-Received: by 10.112.142.67 with SMTP id ru3mr30298714lbb.1.1436189115568; Mon, 06 Jul 2015 06:25:15 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.29.7 with SMTP id f7ls632305lah.48.gmail; Mon, 06 Jul 2015 06:25:15 -0700 (PDT) X-Received: by 10.152.20.106 with SMTP id m10mr20850382lae.7.1436189115044; Mon, 06 Jul 2015 06:25:15 -0700 (PDT) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id u9si15269092lau.48.2015.07.06.06.25.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jul 2015 06:25:14 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by laar3 with SMTP id r3so155067735laa.0 for ; Mon, 06 Jul 2015 06:25:14 -0700 (PDT) X-Received: by 10.152.42.177 with SMTP id p17mr48786895lal.29.1436189114433; Mon, 06 Jul 2015 06:25:14 -0700 (PDT) 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.108.230 with SMTP id hn6csp1725149lbb; Mon, 6 Jul 2015 06:25:13 -0700 (PDT) X-Received: by 10.180.83.135 with SMTP id q7mr52817920wiy.17.1436189112128; Mon, 06 Jul 2015 06:25:12 -0700 (PDT) Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com. [209.85.212.181]) by mx.google.com with ESMTPS id ga2si30226586wjb.135.2015.07.06.06.25.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jul 2015 06:25:12 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.181 as permitted sender) client-ip=209.85.212.181; Received: by wiwl6 with SMTP id l6so284724015wiw.0 for ; Mon, 06 Jul 2015 06:25:11 -0700 (PDT) X-Received: by 10.194.48.108 with SMTP id k12mr94356601wjn.151.1436189111807; Mon, 06 Jul 2015 06:25:11 -0700 (PDT) Received: from gnx2579.home (LCaen-156-56-7-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by mx.google.com with ESMTPSA id q4sm28148131wju.14.2015.07.06.06.25.10 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jul 2015 06:25:11 -0700 (PDT) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, christoffer.dall@linaro.org, marc.zyngier@arm.com, avi.kivity@gmail.com, mtosatti@redhat.com, feng.wu@intel.com, joro@8bytes.org, b.reynal@virtualopensystems.com Cc: linux-kernel@vger.kernel.org, patches@linaro.org, alex.williamson@redhat.com, pbonzini@redhat.com Subject: [RFC v2 2/9] VFIO: platform: test forwarded state when selecting IRQ handler Date: Mon, 6 Jul 2015 15:24:36 +0200 Message-Id: <1436189083-32527-3-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1436189083-32527-1-git-send-email-eric.auger@linaro.org> References: <1436189083-32527-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.215.41 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: , In case the IRQ is forwarded, the VFIO platform IRQ handler does not need to disable the IRQ anymore. When setting the IRQ handler we now also test the forwarded state. In case the IRQ is forwarded we select the vfio_irq_handler. Signed-off-by: Eric Auger --- v3 -> v4: - change title v2 -> v3: - forwarded state was tested in the handler. Now the forwarded state is tested before setting the handler. This definitively limits the dynamics of forwarded state changes but I don't think there is a use case where we need to be able to change the state at any time. Conflicts: drivers/vfio/platform/vfio_platform_irq.c --- drivers/vfio/platform/vfio_platform_irq.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/vfio/platform/vfio_platform_irq.c b/drivers/vfio/platform/vfio_platform_irq.c index 4b059bf..e39f795 100644 --- a/drivers/vfio/platform/vfio_platform_irq.c +++ b/drivers/vfio/platform/vfio_platform_irq.c @@ -260,8 +260,13 @@ static int vfio_platform_set_irq_trigger(struct vfio_platform_device *vdev, { struct vfio_platform_irq *irq = &vdev->irqs[index]; irq_handler_t handler; + struct irq_data *d; + bool is_forwarded; - if (vdev->irqs[index].flags & VFIO_IRQ_INFO_AUTOMASKED) + d = irq_get_irq_data(irq->hwirq); + is_forwarded = irqd_irq_forwarded(d); + + if (vdev->irqs[index].flags & VFIO_IRQ_INFO_AUTOMASKED && !is_forwarded) handler = vfio_automasked_irq_handler; else handler = vfio_irq_handler;