From patchwork Thu Nov 19 14:53:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 7658011 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 3D76D9F2E2 for ; Thu, 19 Nov 2015 14:58:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6BCFB2069E for ; Thu, 19 Nov 2015 14:58:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BBC26206AD for ; Thu, 19 Nov 2015 14:58:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934260AbbKSOyW (ORCPT ); Thu, 19 Nov 2015 09:54:22 -0500 Received: from mail-wm0-f53.google.com ([74.125.82.53]:37541 "EHLO mail-wm0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758743AbbKSOyT (ORCPT ); Thu, 19 Nov 2015 09:54:19 -0500 Received: by wmww144 with SMTP id w144so119951088wmw.0 for ; Thu, 19 Nov 2015 06:54:18 -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=T54fAclPYIb5+MNWudxIB2PmluY5ZR/6b6Fwb+WuNDU=; b=RwXHgBo5xV0ELM5lxKMSrKrHyXhRF2ePrZcbtWMozDMbzseExmuvVmzO7myC5ok57H yPrhQX3KkX7xk7CRpFnuWizeDivhh/gUqJJF2Od7/j+IVUkMSXQ6FM1VqxC39NnW+3AB k6cLE053SqbpwymyFhdJPu2hy30JS3H1uiiY/4IGk8qTok5sFO2KBaYr1Qr1AG0DBXbA K9Rr2LimPOXyzjKS+6ABZOEMnw/De/0afl40QF0in58hH4wlrk6ils6N3oGBm9IVtf0Y zAGFwlgpQohakaPfFMRrTgc0nZkJ6yzM24Ez/h/Aipb7vO0u4sBNuaae9w/aBbA0DOEr cn5g== 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=T54fAclPYIb5+MNWudxIB2PmluY5ZR/6b6Fwb+WuNDU=; b=kfC8JB/v/bay/eYySrdVf/KpYo1zc3Cnsdq07fOn4Sw0totFcHAKZeXvPfCtxcLK1A rdH6HrJlCHphApdk73C25nH7pkIigNXPL5Fzrn7QsZ1ZDu3cTB9aGF/uVb4bG/GAbhyo yvo8w6aryM2KnI5r5WGm6ZGuG8tv/OdEQxbi4zXLBlAWOisEumA7FgCxHD2NVK1XINMX mPp+QBqlOMNrQMf/PdT7E0CaVHeBtDTDBx9Q9WnTU4k8j77vF8Ofj8k0Ny2aALakUJIc FZfmAs1mS+/jXM2G15/ItO44XkjnN6URFbJb8PGyp1dmIa+nDB1A9qjVvmKLX3COSTGO OetQ== X-Gm-Message-State: ALoCoQkH0upeAj9Cu6LzQUFsu7I6qYH/H07w9UiD03+623rCOWyo0UnTE9uCctPeKqkESjqOhAUS X-Received: by 10.194.200.134 with SMTP id js6mr10111882wjc.114.1447944858360; Thu, 19 Nov 2015 06:54:18 -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.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Nov 2015 06:54:17 -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 05/13] VFIO: platform: add vfio_platform_set_forwarded Date: Thu, 19 Nov 2015 14:53:55 +0000 Message-Id: <1447944843-17731-6-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 This function allows to change the forwarded mode and selects the IRQ handler accordingly. Signed-off-by: Eric Auger --- v3 -> v3: - renamed vfio_platform_set_automasked into vfio_platform_set_forwarded - do not change VFIO_IRQ_INFO_AUTOMASKED setting when turning forwarding on/off v1 -> v2: - set forwarded flag --- drivers/vfio/platform/vfio_platform_irq.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/vfio/platform/vfio_platform_irq.c b/drivers/vfio/platform/vfio_platform_irq.c index c58e0ad..257200b 100644 --- a/drivers/vfio/platform/vfio_platform_irq.c +++ b/drivers/vfio/platform/vfio_platform_irq.c @@ -186,6 +186,23 @@ static irqreturn_t vfio_handler(int irq, void *dev_id) return ret; } +static int vfio_platform_set_forwarded(struct vfio_platform_irq *irq, + bool forwarded) +{ + unsigned long flags; + + spin_lock_irqsave(&irq->lock, flags); + irq->forwarded = forwarded; + + if (!forwarded && (irq->flags & VFIO_IRQ_INFO_AUTOMASKED)) + irq->handler = vfio_automasked_irq_handler; + else + irq->handler = vfio_irq_handler; + + spin_unlock_irqrestore(&irq->lock, flags); + return 0; +} + static void vfio_platform_irq_bypass_stop(struct irq_bypass_producer *prod) { }