From patchwork Wed Feb 11 08:32:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 44558 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B70D821527 for ; Wed, 11 Feb 2015 08:34:58 +0000 (UTC) Received: by mail-wg0-f71.google.com with SMTP id b13sf1205108wgh.2 for ; Wed, 11 Feb 2015 00:34:58 -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=1rb5smjxrPZR49l/npWU/JinQiErrgB1GMrmeGzi6KM=; b=lnwmSmqD5+FLiORpgVeCg8yfx1UHd+ifIQfp/mQMH1uvR48R7r0c0kraz8118lLupu hAbqRs7HGmhtorcL+WU5vEHtvXzKrtwdlGQ+fQzjC3469LTCUiL7+o9JVdw8lWlQ0Ipz 9QEJnjz2DZHezFF6hqKUNbtXly/GO1kR/1PjZU3WSVrb/yfX1ZiKBrXcUAlkQWtbgdBh t4rJunKl817QPh1X3gfOXrlR4xMIIZe79k/b/D7UHK5epacZpYgIbYTovA2OeIVfoE0e 6VZ4qCMVORKPKhKn6Eifzh2YfSZCtK7Df1aKkCuoUPoa1u4xO5wzCVAEUQ9XLLcHzMhp 5dTg== X-Gm-Message-State: ALoCoQnphgaRRD/93KscrZC9c7fiUgbgvt+4nozFTmgbJ+HwmB9s0H/zaL5M0mV+H681gnJv51oD X-Received: by 10.194.201.10 with SMTP id jw10mr3251574wjc.3.1423643698042; Wed, 11 Feb 2015 00:34:58 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.26.165 with SMTP id m5ls28816lag.104.gmail; Wed, 11 Feb 2015 00:34:57 -0800 (PST) X-Received: by 10.152.198.164 with SMTP id jd4mr26698396lac.4.1423643697766; Wed, 11 Feb 2015 00:34:57 -0800 (PST) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com. [209.85.217.172]) by mx.google.com with ESMTPS id n9si13739236lbp.165.2015.02.11.00.34.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Feb 2015 00:34:57 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.172 as permitted sender) client-ip=209.85.217.172; Received: by mail-lb0-f172.google.com with SMTP id p9so991540lbv.3 for ; Wed, 11 Feb 2015 00:34:57 -0800 (PST) X-Received: by 10.152.45.1 with SMTP id i1mr26411138lam.41.1423643697667; Wed, 11 Feb 2015 00:34:57 -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.35.133 with SMTP id h5csp1110042lbj; Wed, 11 Feb 2015 00:34:56 -0800 (PST) X-Received: by 10.43.66.9 with SMTP id xo9mr1803807icb.67.1423643696109; Wed, 11 Feb 2015 00:34:56 -0800 (PST) Received: from mail-ie0-f179.google.com (mail-ie0-f179.google.com. [209.85.223.179]) by mx.google.com with ESMTPS id i136si48140ioe.103.2015.02.11.00.34.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Feb 2015 00:34:56 -0800 (PST) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.223.179 as permitted sender) client-ip=209.85.223.179; Received: by iecar1 with SMTP id ar1so2413994iec.0 for ; Wed, 11 Feb 2015 00:34:55 -0800 (PST) X-Received: by 10.42.222.68 with SMTP id if4mr1812169icb.45.1423643695367; Wed, 11 Feb 2015 00:34:55 -0800 (PST) Received: from gnx2579.solutionip.com ([113.28.134.59]) by mx.google.com with ESMTPSA id m38sm62189ioi.39.2015.02.11.00.34.50 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 11 Feb 2015 00:34:54 -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, feng.wu@intel.com Cc: andre.przywara@arm.com, patches@linaro.org, a.motakis@virtualopensystems.com, a.rigo@virtualopensystems.com, b.reynal@virtualopensystems.com, gleb@kernel.org, pbonzini@redhat.com Subject: [RFC v4 02/13] VFIO: platform: test forwarded state when selecting IRQ handler Date: Wed, 11 Feb 2015 09:32:12 +0100 Message-Id: <1423643543-24409-3-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1423643543-24409-1-git-send-email-eric.auger@linaro.org> References: <1423643543-24409-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.172 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 88bba57..132bb3f 100644 --- a/drivers/vfio/platform/vfio_platform_irq.c +++ b/drivers/vfio/platform/vfio_platform_irq.c @@ -229,8 +229,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;