From patchwork Thu Jul 2 13:17:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 50575 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 B6584214B3 for ; Thu, 2 Jul 2015 13:17:58 +0000 (UTC) Received: by wguu7 with SMTP id u7sf21163576wgu.0 for ; Thu, 02 Jul 2015 06:17:58 -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=1rb5smjxrPZR49l/npWU/JinQiErrgB1GMrmeGzi6KM=; b=M4of0iQhDw/hkSZfJ2gUAytMlqm2cpME3+Mn+RwB1tZ85twf5xe88yHpgBHTH9p9hg AJfeaCBNzklD09OQf4vXKdW3cu33/W8bbBISnqYYukU0zmzSwP/3VV887JJCvUSx/wd6 8kZN8jpW5RguSKJ+8qhkUqJG1W44d9ZllVxPy6cF3WSXENJEk8Dobr4z5q/yahYQ6bVn IO+GjiFNoYpLtGT/SWWzRromqNSDSFW4fryRxUhR/6j798m3ekzyyfcbetKSXj1VNK/w emjUAkN0v6j14qN4O7qFZTgXQvr6Eu6xcmCCrOhvg2AKnz9NlE59ZJEm8iF/tvGhl/Lg A1yg== X-Gm-Message-State: ALoCoQnXX9mong52elsxJslbT+GfePXy37c7nUQKbBynl0KxemxxUAg+g0NDqEIPMOYUie6GFIPe X-Received: by 10.152.37.101 with SMTP id x5mr19923048laj.5.1435843077918; Thu, 02 Jul 2015 06:17:57 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.225.129 with SMTP id rk1ls346286lac.71.gmail; Thu, 02 Jul 2015 06:17:57 -0700 (PDT) X-Received: by 10.112.10.166 with SMTP id j6mr27711522lbb.120.1435843077777; Thu, 02 Jul 2015 06:17:57 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id e14si4429742lbo.160.2015.07.02.06.17.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jul 2015 06:17:57 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbbpo10 with SMTP id po10so31804080lbb.3 for ; Thu, 02 Jul 2015 06:17:57 -0700 (PDT) X-Received: by 10.153.5.38 with SMTP id cj6mr30414338lad.36.1435843077511; Thu, 02 Jul 2015 06:17:57 -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 hn6csp475989lbb; Thu, 2 Jul 2015 06:17:57 -0700 (PDT) X-Received: by 10.180.107.138 with SMTP id hc10mr16356635wib.2.1435843076844; Thu, 02 Jul 2015 06:17:56 -0700 (PDT) Received: from mail-wi0-f180.google.com (mail-wi0-f180.google.com. [209.85.212.180]) by mx.google.com with ESMTPS id es12si2890961wjc.61.2015.07.02.06.17.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jul 2015 06:17:56 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.180 as permitted sender) client-ip=209.85.212.180; Received: by wiga1 with SMTP id a1so152625871wig.0 for ; Thu, 02 Jul 2015 06:17:56 -0700 (PDT) X-Received: by 10.195.11.3 with SMTP id ee3mr59055142wjd.89.1435843076583; Thu, 02 Jul 2015 06:17:56 -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 tl3sm8157099wjc.20.2015.07.02.06.17.54 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jul 2015 06:17:55 -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, alex.williamson@redhat.com, pbonzini@redhat.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 Subject: [RFC 01/17] VFIO: platform: test forwarded state when selecting IRQ handler Date: Thu, 2 Jul 2015 15:17:11 +0200 Message-Id: <1435843047-6327-2-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1435843047-6327-1-git-send-email-eric.auger@linaro.org> References: <1435843047-6327-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.182 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;