From patchwork Sun Nov 23 18:35:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 41389 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 2D17E2036A for ; Sun, 23 Nov 2014 18:37:37 +0000 (UTC) Received: by mail-wi0-f197.google.com with SMTP id l15sf1212179wiw.8 for ; Sun, 23 Nov 2014 10:37:36 -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=2nWT1kjGNyJ+sPbRqCKY8MGxJktnGXpsE9/Shf+s9hA=; b=jE9fK6Ns3ZEqNrw4uVyiRxlvadFH3WLhNrmXD9UHMh7UVapubzUqapyt75ij+EWlaU 3HGf8sTWEr7jy90udmKi4EmzWIGN4+6x/P05ERPZzUdVSo1CHWvjKAkGmfObKwuzTx8q VqeeWJbLgVlnUWPfPDGSHNyCXNkuYLKJ3C/HR6qc01mcsIqjpLjAawxz6d82QP0b5Y2R y/+HswtmQOOZyuvxadnq5Ip5xiDlBk/jxYeOIie5Hm//fXskTcgqyyCECYUs/MbHnhTV mtg9B8fNCKFki9kmQvBjHse4RcdSMzeFzPorcV3YSRqnLQTqWnI2FG8qmD6fQ9cUyYHO ipXw== X-Gm-Message-State: ALoCoQkMF7IXps1Xfg8S23SpT+BGG4gWDG0y0Qig/7QO7XC9agBkRBKJoQwwcChG7ZNc74iEvXED X-Received: by 10.112.50.243 with SMTP id f19mr5085085lbo.1.1416767856448; Sun, 23 Nov 2014 10:37:36 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.197 with SMTP id q5ls382182lal.39.gmail; Sun, 23 Nov 2014 10:37:35 -0800 (PST) X-Received: by 10.112.24.130 with SMTP id u2mr16454300lbf.57.1416767855737; Sun, 23 Nov 2014 10:37:35 -0800 (PST) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id jn6si5285397lbc.119.2014.11.23.10.37.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 23 Nov 2014 10:37:35 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by mail-la0-f51.google.com with SMTP id mc6so6505764lab.24 for ; Sun, 23 Nov 2014 10:37:35 -0800 (PST) X-Received: by 10.112.235.196 with SMTP id uo4mr16315633lbc.66.1416767855617; Sun, 23 Nov 2014 10:37:35 -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 ew9csp156303lbc; Sun, 23 Nov 2014 10:37:35 -0800 (PST) X-Received: by 10.194.157.35 with SMTP id wj3mr26291444wjb.91.1416767854792; Sun, 23 Nov 2014 10:37:34 -0800 (PST) Received: from mail-wg0-f42.google.com (mail-wg0-f42.google.com. [74.125.82.42]) by mx.google.com with ESMTPS id ud6si8795650wib.12.2014.11.23.10.37.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 23 Nov 2014 10:37:34 -0800 (PST) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 74.125.82.42 as permitted sender) client-ip=74.125.82.42; Received: by mail-wg0-f42.google.com with SMTP id z12so10689265wgg.29 for ; Sun, 23 Nov 2014 10:37:34 -0800 (PST) X-Received: by 10.194.123.99 with SMTP id lz3mr9355731wjb.31.1416767854590; Sun, 23 Nov 2014 10:37:34 -0800 (PST) Received: from gnx2579.gnb.st.com (weg38-3-78-232-41-119.fbx.proxad.net. [78.232.41.119]) by mx.google.com with ESMTPSA id hk9sm17535471wjb.46.2014.11.23.10.37.32 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 23 Nov 2014 10:37:34 -0800 (PST) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, christoffer.dall@linaro.org, marc.zyngier@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, alex.williamson@redhat.com, joel.schopp@amd.com, kim.phillips@freescale.com, paulus@samba.org, gleb@kernel.org, pbonzini@redhat.com, agraf@suse.de Cc: linux-kernel@vger.kernel.org, patches@linaro.org, will.deacon@arm.com, a.motakis@virtualopensystems.com, a.rigo@virtualopensystems.com, john.liuli@huawei.com, ming.lei@canonical.com, feng.wu@intel.com Subject: [PATCH v3 3/8] VFIO: platform: forwarded state tested when selecting IRQ handler Date: Sun, 23 Nov 2014 19:35:55 +0100 Message-Id: <1416767760-14487-4-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1416767760-14487-1-git-send-email-eric.auger@linaro.org> References: <1416767760-14487-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.51 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 edge handler (no automaske). Signed-off-by: Eric Auger --- 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. --- 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 08d400e..61a2920 100644 --- a/drivers/vfio/platform/vfio_platform_irq.c +++ b/drivers/vfio/platform/vfio_platform_irq.c @@ -230,8 +230,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_MASKABLE) + d = irq_get_irq_data(irq->hwirq); + is_forwarded = irqd_irq_forwarded(d); + + if ((vdev->irqs[index].flags & VFIO_IRQ_INFO_MASKABLE) && !is_forwarded) handler = vfio_maskable_irq_handler; else handler = vfio_irq_handler;