From patchwork Mon Aug 10 13:20:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 52239 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by patches.linaro.org (Postfix) with ESMTPS id 210E622919 for ; Mon, 10 Aug 2015 13:22:05 +0000 (UTC) Received: by wijp15 with SMTP id p15sf38831191wij.3 for ; Mon, 10 Aug 2015 06:22:04 -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=sMIALoXXI3Iq/0nA0DZfafY446ST6shebzfbyrX7Kak=; b=FosSda7LiQpg6D8HnMKA/JiwWPp3zg7PW5CSmRma1xSBi6TqjfxctrCxMmfGO5jE12 cwlVVLTeHqhylC0O77/5ktKOpPV1MpgAqaewANGw1ThoBBVXcTR76cVdSPD3aT/kn7Ok As9X9VIBEosgtcRKNW0bS4RUYx3gz+c/E9+kkGM9fwLnhBXOCDvJBSwpbrYffp3p8PcZ SFd4FhZ/uznlJM9J/WJ3WPKS4nLQDd2WUfssbEyH2XlHT3JiD91zQXA4dFGyvkEqD9ts CKPqrFnMT4beLTWz/3yEfhwWm7t4u1ASBMxqjN2caoVpEhvNXoqwvh3XZ4JBa7/dylkO xXWg== X-Gm-Message-State: ALoCoQlEaUGKUgoPuIE7aA6kW+w11AGUBzaTw3bEsI4t1Kw5byIWFsYbRhI2Tho2RusUK7pKCq3G X-Received: by 10.152.45.101 with SMTP id l5mr4670883lam.7.1439212924429; Mon, 10 Aug 2015 06:22:04 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.43.51 with SMTP id t19ls517525lal.22.gmail; Mon, 10 Aug 2015 06:22:04 -0700 (PDT) X-Received: by 10.152.219.3 with SMTP id pk3mr19978217lac.114.1439212924287; Mon, 10 Aug 2015 06:22:04 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id gb9si14043494lbc.19.2015.08.10.06.22.04 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Aug 2015 06:22:04 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by lbbsx3 with SMTP id sx3so11261290lbb.0 for ; Mon, 10 Aug 2015 06:22:04 -0700 (PDT) X-Received: by 10.152.36.102 with SMTP id p6mr19940282laj.19.1439212924198; Mon, 10 Aug 2015 06:22:04 -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.7.198 with SMTP id l6csp1931745lba; Mon, 10 Aug 2015 06:22:03 -0700 (PDT) X-Received: by 10.194.57.205 with SMTP id k13mr28756858wjq.100.1439212919689; Mon, 10 Aug 2015 06:21:59 -0700 (PDT) Received: from mail-wi0-f171.google.com (mail-wi0-f171.google.com. [209.85.212.171]) by mx.google.com with ESMTPS id wm6si19215370wjc.126.2015.08.10.06.21.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Aug 2015 06:21:59 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.171 as permitted sender) client-ip=209.85.212.171; Received: by wicja10 with SMTP id ja10so25457910wic.1 for ; Mon, 10 Aug 2015 06:21:59 -0700 (PDT) X-Received: by 10.194.175.200 with SMTP id cc8mr47060591wjc.87.1439212919341; Mon, 10 Aug 2015 06:21:59 -0700 (PDT) Received: from gnx2579.home (LCaen-156-56-7-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by smtp.gmail.com with ESMTPSA id fq15sm29517024wjc.12.2015.08.10.06.21.58 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Aug 2015 06:21:58 -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, alex.williamson@redhat.com, feng.wu@intel.com Cc: linux-kernel@vger.kernel.org, patches@linaro.org, pbonzini@redhat.com Subject: [PATCH v3 05/10] VFIO: platform: add vfio_platform_is_active Date: Mon, 10 Aug 2015 15:20:59 +0200 Message-Id: <1439212864-12954-6-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1439212864-12954-1-git-send-email-eric.auger@linaro.org> References: <1439212864-12954-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.178 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: , This function returns whether the IRQ is active at irqchip level or VFIO masked. If either is true, it is considered the IRQ is active. Currently there is no way to differentiate userspace masked IRQ from automasked IRQ. There might be false detection of activity. However it is currently acceptable to have false detection. Signed-off-by: Eric Auger --- --- 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 a285384..efaee58 100644 --- a/drivers/vfio/platform/vfio_platform_irq.c +++ b/drivers/vfio/platform/vfio_platform_irq.c @@ -205,6 +205,23 @@ static int vfio_platform_set_automasked(struct vfio_platform_irq *irq, return 0; } +static int vfio_platform_is_active(struct vfio_platform_irq *irq) +{ + unsigned long flags; + bool active, masked, outstanding; + int ret; + + spin_lock_irqsave(&irq->lock, flags); + + ret = irq_get_irqchip_state(irq->hwirq, IRQCHIP_STATE_ACTIVE, &active); + BUG_ON(ret); + masked = irq->masked; + outstanding = active || masked; + + spin_unlock_irqrestore(&irq->lock, flags); + return outstanding; +} + static void vfio_platform_irq_bypass_stop(struct irq_bypass_producer *prod) { }