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: Auger Eric X-Patchwork-Id: 46044 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C8B6D21515 for ; Thu, 19 Mar 2015 14:58:46 +0000 (UTC) Received: by wggx13 with SMTP id x13sf12905568wgg.0 for ; Thu, 19 Mar 2015 07:58:46 -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=zJL7rBZQc246TYDiVspAT1naQ9KpA8fYgFFQtwzHP1g=; b=BAKtrJ5uUYYd1h51U6adWSPXaLL62ntit8sY5mAKHsp15JW7EURpAvM81S5kKiK9na 8AUsUlCpsb3QV/wp6FEwn0+DVW75reguZJe+i74+pSoGuYOUoGepVEO4dPIAVaO/o79p dInJS/XojGlYEF462a57bO/Euj8GOD3naRULMMh7GBiEWKJ3aduU9N+dPhiBwWx5rVJ2 1YBv4d5IeIKpsGXdigo9vQy8jN8pXM1DY2sGBj4irDSDawCcBSy/oJvhkWRnqYhhou9Y 8KaTabASin8KvgHaW2xOQ8pZ7/wGZpQue31oc8yaECebpCuQb+VgEuQWvHfe1Bp4uEJS 26mg== X-Gm-Message-State: ALoCoQkUzmEj0WUkaBAiZy9FQIdq0G7UzkImAB7j1qMCy1CE1kOutbnQ64Aoqsv+QrisH78vbbtU X-Received: by 10.180.101.39 with SMTP id fd7mr824726wib.0.1426777126139; Thu, 19 Mar 2015 07:58:46 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.7.75 with SMTP id da11ls289127lad.95.gmail; Thu, 19 Mar 2015 07:58:45 -0700 (PDT) X-Received: by 10.152.18.225 with SMTP id z1mr70231676lad.124.1426777125971; Thu, 19 Mar 2015 07:58:45 -0700 (PDT) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id zj11si1130366lbb.148.2015.03.19.07.58.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Mar 2015 07:58:45 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by lamx15 with SMTP id x15so64450694lam.3 for ; Thu, 19 Mar 2015 07:58:45 -0700 (PDT) X-Received: by 10.152.8.15 with SMTP id n15mr41839730laa.41.1426777125889; Thu, 19 Mar 2015 07:58:45 -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.35.133 with SMTP id h5csp441517lbj; Thu, 19 Mar 2015 07:58:45 -0700 (PDT) X-Received: by 10.180.76.148 with SMTP id k20mr17130654wiw.71.1426777119798; Thu, 19 Mar 2015 07:58:39 -0700 (PDT) Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com. [209.85.212.173]) by mx.google.com with ESMTPS id q7si3461237wix.82.2015.03.19.07.58.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Mar 2015 07:58:39 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.173 as permitted sender) client-ip=209.85.212.173; Received: by wifj2 with SMTP id j2so71511728wif.1 for ; Thu, 19 Mar 2015 07:58:39 -0700 (PDT) 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 Cc: linux-kernel@vger.kernel.org, patches@linaro.org, pbonzini@redhat.com, kim.phillips@freescale.com, b.reynal@virtualopensystems.com, feng.wu@intel.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-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.215.44 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: , 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);