From patchwork Thu Mar 19 14:55:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 6050471 Return-Path: X-Original-To: patchwork-linux-arm@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 2D9289F318 for ; Thu, 19 Mar 2015 15:08:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8D493202F8 for ; Thu, 19 Mar 2015 15:08:00 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4306C20519 for ; Thu, 19 Mar 2015 15:07:53 +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 1YYc05-0000rA-VD; Thu, 19 Mar 2015 15:04:46 +0000 Received: from mail-wi0-f173.google.com ([209.85.212.173]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YYbuU-00052Y-IS for linux-arm-kernel@lists.infradead.org; Thu, 19 Mar 2015 14:59:00 +0000 Received: by wifj2 with SMTP id j2so71511722wif.1 for ; Thu, 19 Mar 2015 07:58:39 -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=zJL7rBZQc246TYDiVspAT1naQ9KpA8fYgFFQtwzHP1g=; b=HmdLgnc86XqIU75RKjoz43vqvlTiPkkGq7uqjdDuji1+8SCw3sbCqW9jZqk4dWoeBz kKzMKNiZBcCw/emK7ZTdJR8E1RHR0/gyhN6rFVFjgDPE5qIY2KYQVGCYM7gTr7G85Uh2 CuVdEm8skgIODdXpjqx1i7e++91wJ/qTYRQzu6eFvgTWu+dCVUsFxckj9pzOBSAXWF9O pOyz5Dtwg8gv6nJoCElIPlcLpY7KN//VaaWu0OG0BcB8u9jmhB1Oa6dWdPw8M/Z9vOHZ 4sOuLOY+nFFQW9Zdc2pWTRTuHhqP/XQD6Ye1Up40FDiYLmtcih0BXHgYfiHL/gEf0g+i KCwQ== X-Gm-Message-State: ALoCoQlfdRQ6wDZDTkGccSNzFBxBn+oG7HNRAd+yv5QNlKCVcDH4Zf6mxhrs/xr+OPn6A5Ius5SN X-Received: by 10.194.2.43 with SMTP id 11mr153574744wjr.104.1426777119420; Thu, 19 Mar 2015 07:58:39 -0700 (PDT) Received: from gnx2579.gnb.st.com (weg38-3-78-232-41-119.fbx.proxad.net. [78.232.41.119]) by mx.google.com with ESMTPSA id a6sm1695350wiy.17.2015.03.19.07.58.37 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 19 Mar 2015 07:58:38 -0700 (PDT) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, christoffer.dall@linaro.org, marc.zyngier@arm.com, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, alex.williamson@redhat.com Subject: [RFC v5 08/13] KVM: kvm-vfio: wrappers for vfio_external_{mask|is_active|set_automasked} Date: Thu, 19 Mar 2015 15:55:46 +0100 Message-Id: <1426776951-24901-9-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1426776951-24901-1-git-send-email-eric.auger@linaro.org> References: <1426776951-24901-1-git-send-email-eric.auger@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150319_075858_849313_4B512D7D X-CRM114-Status: GOOD ( 12.69 ) X-Spam-Score: -0.7 (/) Cc: kim.phillips@freescale.com, b.reynal@virtualopensystems.com, patches@linaro.org, linux-kernel@vger.kernel.org, pbonzini@redhat.com, feng.wu@intel.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Those 3 new wrapper functions call the respective VFIO external functions. Signed-off-by: Eric Auger --- v4: creation --- include/linux/vfio.h | 8 +++----- virt/kvm/vfio.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 5 deletions(-) diff --git a/include/linux/vfio.h b/include/linux/vfio.h index 7aa6330..78c1202 100644 --- a/include/linux/vfio.h +++ b/include/linux/vfio.h @@ -108,14 +108,12 @@ extern struct device *vfio_external_base_device(struct vfio_device *vdev); struct vfio_platform_device; extern void vfio_external_mask(struct vfio_platform_device *vdev, int index); /* - * returns whether the VFIO IRQ is active: - * true if not yet deactivated at interrupt controller level or if - * automasked (level sensitive IRQ). Unfortunately there is no way to - * discriminate between handler auto-masking and user-space masking + * returns whether the VFIO IRQ is active at interrupt controller level + * or VFIO-masked. Note that if the use-space masked the IRQ index it + * cannot be discriminated from automasked handler situation. */ extern bool vfio_external_is_active(struct vfio_platform_device *vdev, int index); - extern void vfio_external_set_automasked(struct vfio_platform_device *vdev, int index, bool automasked); diff --git a/virt/kvm/vfio.c b/virt/kvm/vfio.c index 80a45e4..c995e51 100644 --- a/virt/kvm/vfio.c +++ b/virt/kvm/vfio.c @@ -134,6 +134,50 @@ static void kvm_vfio_put_vfio_device(struct vfio_device *vdev) kvm_vfio_device_put_external_user(vdev); } +bool kvm_vfio_external_is_active(struct vfio_platform_device *vpdev, + int index) +{ + bool (*fn)(struct vfio_platform_device *, int index); + bool active; + + fn = symbol_get(vfio_external_is_active); + if (!fn) + return -1; + + active = fn(vpdev, index); + + symbol_put(vfio_external_is_active); + return active; +} + +void kvm_vfio_external_mask(struct vfio_platform_device *vpdev, + int index) +{ + void (*fn)(struct vfio_platform_device *, int index); + + fn = symbol_get(vfio_external_mask); + if (!fn) + return; + + fn(vpdev, index); + + symbol_put(vfio_external_mask); +} + +void kvm_vfio_external_set_automasked(struct vfio_platform_device *vpdev, + int index, bool automasked) +{ + void (*fn)(struct vfio_platform_device *, int index, bool automasked); + + fn = symbol_get(vfio_external_set_automasked); + if (!fn) + return; + + fn(vpdev, index, automasked); + + symbol_put(vfio_external_set_automasked); +} + static bool kvm_vfio_group_is_coherent(struct vfio_group *vfio_group) { long (*fn)(struct vfio_group *, unsigned long);