From patchwork Mon Apr 13 12:29:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 47103 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AD8D020553 for ; Mon, 13 Apr 2015 12:32:37 +0000 (UTC) Received: by labgx2 with SMTP id gx2sf17654752lab.1 for ; Mon, 13 Apr 2015 05:32:36 -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=ZEJLtTzl5E+Y3okTmxZhFXR8GdgJ0MPO8rJNXKlyer81c9SnnkVdCIra01wSqFrldI qtbwjpb3r4IpTnZCfJ2k/f4YiSHiY/2ROJ7oC3A+jK28Bwn1MuOzJtwuRw9d90r9wR1K F6RRxhSx5P71r5NBouURbYkDbQ9uvuZ3IYwdbOOPcd+UT4i819hDiR/+JD1tMIQXbyfA zhsZG9sNUgBPu88ebM8o53fAGX1SvUQntW+Ota0uXpaq7Li3iSYOFyUAjqrCHugx9dD1 XjhwwpPFt0X4ZhcDhulEXHaErGgA+zTLlaekBM9Na7kWjrZT6TAmb1l6tXJUQt3egTNl +FLQ== X-Gm-Message-State: ALoCoQnkXb3xcOqXq+x7vO1cO9mBCx5RRUfIhoL3jY9/p6hu9/zKBsShTWMcVUqFxjFsPOEziJcJ X-Received: by 10.152.3.70 with SMTP id a6mr2221194laa.0.1428928356516; Mon, 13 Apr 2015 05:32:36 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.224.165 with SMTP id rd5ls644868lac.77.gmail; Mon, 13 Apr 2015 05:32:36 -0700 (PDT) X-Received: by 10.112.134.202 with SMTP id pm10mr13362563lbb.34.1428928356371; Mon, 13 Apr 2015 05:32:36 -0700 (PDT) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id w2si8319894lbs.15.2015.04.13.05.32.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Apr 2015 05:32:36 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by lbbqq2 with SMTP id qq2so57220040lbb.3 for ; Mon, 13 Apr 2015 05:32:36 -0700 (PDT) X-Received: by 10.112.163.168 with SMTP id yj8mr12668161lbb.36.1428928355966; Mon, 13 Apr 2015 05:32:35 -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.67.65 with SMTP id l1csp1174940lbt; Mon, 13 Apr 2015 05:32:35 -0700 (PDT) X-Received: by 10.180.8.98 with SMTP id q2mr20554872wia.80.1428928355265; Mon, 13 Apr 2015 05:32:35 -0700 (PDT) Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com. [209.85.212.172]) by mx.google.com with ESMTPS id x1si13800897wif.27.2015.04.13.05.32.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Apr 2015 05:32:35 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.172 as permitted sender) client-ip=209.85.212.172; Received: by wiun10 with SMTP id n10so64589250wiu.1 for ; Mon, 13 Apr 2015 05:32:35 -0700 (PDT) X-Received: by 10.180.101.98 with SMTP id ff2mr21134163wib.15.1428928355033; Mon, 13 Apr 2015 05:32:35 -0700 (PDT) Received: from gnx2579.gnb.st.com (LCaen-156-56-7-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by mx.google.com with ESMTPSA id fl14sm2879910wjc.11.2015.04.13.05.32.33 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 13 Apr 2015 05:32:34 -0700 (PDT) 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, pbonzini@redhat.com Cc: linux-kernel@vger.kernel.org, patches@linaro.org, feng.wu@intel.com, b.reynal@virtualopensystems.com Subject: [RFC v6 02/16] VFIO: platform: test forwarded state when selecting IRQ handler Date: Mon, 13 Apr 2015 14:29:17 +0200 Message-Id: <1428928171-18884-3-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1428928171-18884-1-git-send-email-eric.auger@linaro.org> References: <1428928171-18884-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.173 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;