From patchwork Thu Nov 19 14:53:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 7658081 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 243EE9F2EC for ; Thu, 19 Nov 2015 14:59:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 447E520699 for ; Thu, 19 Nov 2015 14:59:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 559F22063C for ; Thu, 19 Nov 2015 14:59:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030201AbbKSO7Y (ORCPT ); Thu, 19 Nov 2015 09:59:24 -0500 Received: from mail-wm0-f52.google.com ([74.125.82.52]:33752 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758721AbbKSOyQ (ORCPT ); Thu, 19 Nov 2015 09:54:16 -0500 Received: by wmec201 with SMTP id c201so29563329wme.0 for ; Thu, 19 Nov 2015 06:54:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3SdPQeGXjtwujZCm+J1FZpKbFxFECFRnkDod/goUhTI=; b=igG4RlJRDQFAPjf7e3TaIa5yXqVaevTkl/cxquapiMCvqicpVYS/XqieqOGB4571YM uOVFq32NWa6N3BZ8Bz3ORObc+JDtlBmU2383u8/QUW9MFDucxplObYiRGDPKnk4EeRkg 3AUr8ZwiWEgPS4IdnrVhp8zDfdzYEA/2FDvEgEm+Eq3t1SOU5gw/rI5fAi4CzY8ahG8R +rTyBQLhk6o/pdFam1x2zRjeZ4+BSNAbYADPyefwsO3yORKTRN1XejzqHhatJSRVnzJP 5DKaBWc3wnQXIXFAVd9X6KeVnYSaTrG5Iej504C/yNw6nyHNlPHJz9tQajY9UVG5AX8q fL0A== 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=3SdPQeGXjtwujZCm+J1FZpKbFxFECFRnkDod/goUhTI=; b=EhOaKAiopVNCDHTG8RRJsbBUCgL7vu+JHFMEnNbu5jBb0q78floAU0a29FdPTxl9Vg klQJwzB74d1uGBmmfvjP7u5LrJGZlhlbSFE3S/DIQfuvsmv8QoIb0qjWHxNpcmd2pEkF 7R5U/dG/6KNJZPvtwy63FtbAZVxW0YlvEVAyLLNnj+3BeBQNToPqXd2FARKYGde9OC13 QjPlQ6Q3CRLxbxUTOONv/4nl+Lm6rrcEGYuMHyNE6wF2aVYSJ6ecrgXajS1t8w8nIMB3 0i7GoHxK7+ywY+VBtDlwlqMl6AuWjgu+ZkQUnmiEQlUF9XS857E4BgFQMRIVCfJYvjPd ttaw== X-Gm-Message-State: ALoCoQmEdL06G6ZtdiN2cHlUNj+RGVZlNE0Jft/w8YRdtQ0yGbBPCxC88TkcjUc0m0l2unlq2Auq X-Received: by 10.194.93.164 with SMTP id cv4mr8585097wjb.43.1447944855173; Thu, 19 Nov 2015 06:54:15 -0800 (PST) Received: from new-host-3.home (LMontsouris-657-1-37-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by smtp.gmail.com with ESMTPSA id h67sm34493865wmf.17.2015.11.19.06.54.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Nov 2015 06:54:14 -0800 (PST) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, alex.williamson@redhat.com, b.reynal@virtualopensystems.com, christoffer.dall@linaro.org, marc.zyngier@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Cc: andre.przywara@arm.com, linux-kernel@vger.kernel.org, patches@linaro.org Subject: [PATCH v4 03/13] VFIO: platform: test forwarded state when selecting the IRQ handler Date: Thu, 19 Nov 2015 14:53:53 +0000 Message-Id: <1447944843-17731-4-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1447944843-17731-1-git-send-email-eric.auger@linaro.org> References: <1447944843-17731-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.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 Add a new forwarded flag in vfio_platform_irq. 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 --- v2: - add a new forwarded flag and do not use irqd_irq_forwarded anymore --- drivers/vfio/platform/vfio_platform_irq.c | 3 ++- drivers/vfio/platform/vfio_platform_private.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/vfio/platform/vfio_platform_irq.c b/drivers/vfio/platform/vfio_platform_irq.c index ab7658a..d4462fd 100644 --- a/drivers/vfio/platform/vfio_platform_irq.c +++ b/drivers/vfio/platform/vfio_platform_irq.c @@ -265,7 +265,8 @@ static int vfio_platform_set_irq_trigger(struct vfio_platform_device *vdev, struct vfio_platform_irq *irq = &vdev->irqs[index]; irq_handler_t handler; - if (vdev->irqs[index].flags & VFIO_IRQ_INFO_AUTOMASKED) + if (vdev->irqs[index].flags & VFIO_IRQ_INFO_AUTOMASKED && + !irq->forwarded) handler = vfio_automasked_irq_handler; else handler = vfio_irq_handler; diff --git a/drivers/vfio/platform/vfio_platform_private.h b/drivers/vfio/platform/vfio_platform_private.h index 979c191..55e8043 100644 --- a/drivers/vfio/platform/vfio_platform_private.h +++ b/drivers/vfio/platform/vfio_platform_private.h @@ -39,6 +39,7 @@ struct vfio_platform_irq { struct virqfd *unmask; struct virqfd *mask; struct irq_bypass_producer producer; + bool forwarded; }; struct vfio_platform_region {