From patchwork Mon Jul 6 13:24:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 6723801 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 315F5C05AC for ; Mon, 6 Jul 2015 13:25:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 53CEE205E9 for ; Mon, 6 Jul 2015 13:25:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 67941201ED for ; Mon, 6 Jul 2015 13:25:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755864AbbGFNZP (ORCPT ); Mon, 6 Jul 2015 09:25:15 -0400 Received: from mail-wi0-f182.google.com ([209.85.212.182]:38103 "EHLO mail-wi0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755822AbbGFNZN (ORCPT ); Mon, 6 Jul 2015 09:25:13 -0400 Received: by wibdq8 with SMTP id dq8so153313902wib.1 for ; Mon, 06 Jul 2015 06:25:11 -0700 (PDT) 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=JjaSWiGkHPAxqHxoF/WrS/iRSuy0tzt86jp3gQ39QiY=; b=JRrHPQzQ5P6UgLkkdtuXqDj3G32qUgB7rZKoLkKTUCNEbR+GelQ3SHk3SvSNUL62Qh qVy7KnQDAT9NBfptz2wxfgQ7x2XI32vafVchNldQ++W0x89vJoZMMvP25f20X9DP89fX dybl/q3HLsefTeWRhDXhRUD5vzmwA0kFFlOuhH8PlwPIMMe9m/+q2NokvReE7vRU5ML/ g3MksCNA7rVo1++oHWqSbvqM5U6O37m0mwrLjAKDwrpcgJp7mcgQkRQaROlS+Vv2Cgfe n/CCNWDlR0hE5U34JBdu675dOl3XcjCwwGJC5SQFvMc75QzSihTvqvxJu+c5449KaHPH Q9cw== X-Gm-Message-State: ALoCoQle8REYw1MXvy+RNhC7NtXsHDxfrxQwOnGAs2Ks8Dkz8HDTIqd3vQXxz8C2peBHPMzv8Ls5 X-Received: by 10.194.48.108 with SMTP id k12mr94356601wjn.151.1436189111807; Mon, 06 Jul 2015 06:25:11 -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 q4sm28148131wju.14.2015.07.06.06.25.10 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jul 2015 06:25:11 -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, 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, alex.williamson@redhat.com, pbonzini@redhat.com Subject: [RFC v2 2/9] VFIO: platform: test forwarded state when selecting IRQ handler Date: Mon, 6 Jul 2015 15:24:36 +0200 Message-Id: <1436189083-32527-3-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1436189083-32527-1-git-send-email-eric.auger@linaro.org> References: <1436189083-32527-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=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 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 4b059bf..e39f795 100644 --- a/drivers/vfio/platform/vfio_platform_irq.c +++ b/drivers/vfio/platform/vfio_platform_irq.c @@ -260,8 +260,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;