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: 7658071 Return-Path: X-Original-To: patchwork-linux-arm@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 125F6BF90C 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 365DE20648 for ; Thu, 19 Nov 2015 14:59:53 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5B952204D9 for ; Thu, 19 Nov 2015 14:59:52 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZzQex-0005uW-5R; Thu, 19 Nov 2015 14:58:03 +0000 Received: from mail-wm0-x232.google.com ([2a00:1450:400c:c09::232]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZzQbf-00017E-Ta for linux-arm-kernel@lists.infradead.org; Thu, 19 Nov 2015 14:54:41 +0000 Received: by wmvv187 with SMTP id v187so29521743wmv.1 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=Y1q+8vpIOJH/yacwW51xtRNiIId5wn6O1O02fZp8jL+twkTuSKJ4bHXsRTq2kHjU2R fcZQS3V55UYW7HDG+bCZDWkiu3SLQEPUNUJ5+pw/nV31ZCJs83u1HrDVkr3CIRXqmb+2 2/imQcCMZKgQ68189zITMf9q0yBeg6WWo0ads5NBYkvFFUXwwUyYIvCVPwTtuf7MCcqD TSbvZTO0U3SSm8O6Qs3D21IN6wHOWaoymaNKCU3Ln+wpN30Ws3SBJzkc+nvDD6CMRjBy kiqLMhVa364TJ7dcA2hj0nTTtF0TIdOnl+r2JpW1AQ7v5LYrhFd78YOJM835PHkhpele 3QJg== X-Gm-Message-State: ALoCoQnfMvOcnXErPxOVNTpD9Mw6uJPtilL9ffemudQTnEJLOaYFL5kCo6xTA0G/W6gFH5jpiwhu 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151119_065440_334989_5E04DA5C X-CRM114-Status: GOOD ( 11.75 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: andre.przywara@arm.com, linux-kernel@vger.kernel.org, patches@linaro.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,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) { }