From patchwork Wed Feb 11 08:32:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 5810961 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 0AD419F37F for ; Wed, 11 Feb 2015 08:35:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3A800201BB for ; Wed, 11 Feb 2015 08:35:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 516542011D for ; Wed, 11 Feb 2015 08:35:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752231AbbBKIf3 (ORCPT ); Wed, 11 Feb 2015 03:35:29 -0500 Received: from mail-ig0-f171.google.com ([209.85.213.171]:50612 "EHLO mail-ig0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752204AbbBKIf1 (ORCPT ); Wed, 11 Feb 2015 03:35:27 -0500 Received: by mail-ig0-f171.google.com with SMTP id h15so29191781igd.4 for ; Wed, 11 Feb 2015 00:35:27 -0800 (PST) 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=RMaylED7orN/pedawcqDmWdaYZq4BGmkuiTLfqrxTaU=; b=Quz0dmzID++dh/x4ffLBo3Ut3eG8G8zA+v/htXGC5S9Mdku0sryHHq/ynPOTU0HFj2 CBNnl7MjkjbkcUSDAWy5mRVROlWW1jTM8kIklO5ZWVsETmuz06FhhqslQ5snelJ2oEYH emBItoTM62M6O4ee3dJDt44plL4G10kQUl+hwwqVuAay+keZV6Y1TzM27SPeISlQPfiL I1L1V+Iq3BzM3KoAEiccDoeNoKIg80h2EFHqyGKabWpNdJPbWJstuA+4ETGYqBEQDW11 +QshD35JlCyfZ1YCY1brkqJnCNjn5dvAkBR0MhXJSQwcoCmEoo/yz6zQ2pdvKiOX8jnU pm/A== X-Gm-Message-State: ALoCoQnwdS60+6SgXlVNbowhzt1CTspXhNe1azsUt9pVVZ140C/BZzj7PPa8tsx60wRlcrDdjwPm X-Received: by 10.107.161.75 with SMTP id k72mr37354263ioe.46.1423643727162; Wed, 11 Feb 2015 00:35:27 -0800 (PST) Received: from gnx2579.solutionip.com ([113.28.134.59]) by mx.google.com with ESMTPSA id m38sm62189ioi.39.2015.02.11.00.35.22 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 11 Feb 2015 00:35:26 -0800 (PST) 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, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, alex.williamson@redhat.com, feng.wu@intel.com Cc: andre.przywara@arm.com, patches@linaro.org, a.motakis@virtualopensystems.com, a.rigo@virtualopensystems.com, b.reynal@virtualopensystems.com, gleb@kernel.org, pbonzini@redhat.com Subject: [RFC v4 08/13] KVM: kvm-vfio: wrappers for vfio_external_{mask|is_active|set_automasked} Date: Wed, 11 Feb 2015 09:32:18 +0100 Message-Id: <1423643543-24409-9-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1423643543-24409-1-git-send-email-eric.auger@linaro.org> References: <1423643543-24409-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=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 e04ca93..565f5f7 100644 --- a/include/linux/vfio.h +++ b/include/linux/vfio.h @@ -106,14 +106,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);