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: Eric Auger X-Patchwork-Id: 5362391 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4BF409F39D for ; Sun, 23 Nov 2014 18:40:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 746362028D for ; Sun, 23 Nov 2014 18:40:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A61C220274 for ; Sun, 23 Nov 2014 18:40:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752618AbaKWSju (ORCPT ); Sun, 23 Nov 2014 13:39:50 -0500 Received: from mail-wg0-f48.google.com ([74.125.82.48]:32906 "EHLO mail-wg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752136AbaKWShf (ORCPT ); Sun, 23 Nov 2014 13:37:35 -0500 Received: by mail-wg0-f48.google.com with SMTP id y19so10541219wgg.7 for ; Sun, 23 Nov 2014 10:37:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2nWT1kjGNyJ+sPbRqCKY8MGxJktnGXpsE9/Shf+s9hA=; b=EOT8uIEn6L5F3oyz4jA+3nHtpY8KzQ6SNFA2i9m985TKRhD3Vv900mv2Qu5Kq/uRBC m7ng638i17297BrgjdWQE8fF2QIhz5TxEw+3xNzxCnNbjhFax9U6cppMpS7xzLwhoosu yAcQ7lxDn1PL9ntD+B7wqfodaqKQkjrFl4vsbYEWGAdDpb8zf0L8OC4D+OJ1TmjKFJqY MOL6lo1zMoHr8IYXJhsm9t4R5pswp9dUdpppletvau/0AYB8oXElcaJFa+NGMOFmTq0A 20S0+JpVIT3wQ720Ci+cebnxHA4bFngCnAtZkRgC72bkPh31nPHbg6NZ74rzHdTbok58 w9Jw== X-Gm-Message-State: ALoCoQkWorc1x/rn9GaRwhv3oRVk+m8wDtwx47IZbuuLkfplJql5caD3yHdt+4zn6TFSK77GMEv2 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> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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;