From patchwork Mon Apr 13 12:29:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 6208581 Return-Path: X-Original-To: patchwork-kvm@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 3A54CBF4A6 for ; Mon, 13 Apr 2015 12:39:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 61A46202F8 for ; Mon, 13 Apr 2015 12:39:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DCC122035E for ; Mon, 13 Apr 2015 12:39:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932268AbbDMMgk (ORCPT ); Mon, 13 Apr 2015 08:36:40 -0400 Received: from mail-wg0-f42.google.com ([74.125.82.42]:36100 "EHLO mail-wg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932318AbbDMMcw (ORCPT ); Mon, 13 Apr 2015 08:32:52 -0400 Received: by wgsk9 with SMTP id k9so79023175wgs.3 for ; Mon, 13 Apr 2015 05:32:51 -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=FZIKY9rK/SBSM7xLVH3eFQmISz8Fu4sfWxOqaa/qG4w=; b=QkpPxWTILf1mgvOpXhuh2VYlVZDRW638Cd+z9Ulg2zZ/olY6a83aoeS/rmAC7ZsPvF zk7MnD0B4PG74B99PbyxFwrMRiUzEBACMhoLyGjKoQ9y5+cz20EeAatkAyGW608BJS5E y+9TnDIEGYwM8in6wM23f5+21NcL0BaGsEYM97hPDK/YJp9Ju8s896WmQVJAV3oXcNZp bs/3ssXjgi06NR+WSKBmjb+oiwhvGzc8GQaKK13LfX33Hma6/PKhZtEXwkTdbFhgUoLk NSxA21FUo82YsG5RNVNrhYaq8AHcx7XiAxQ6TJPxhVbJHJQOghmTuJFvKDcom1gsV/UF thJA== X-Gm-Message-State: ALoCoQmlMvfo3oPA3hhO8fvJXgdFoC1D5QfAQU1MQjGs9ntpM3W79F62VP1lVtzEp6F0WWYvsawq X-Received: by 10.180.87.105 with SMTP id w9mr2942264wiz.32.1428928371545; Mon, 13 Apr 2015 05:32:51 -0700 (PDT) Received: from gnx2579.gnb.st.com (LCaen-156-56-7-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by mx.google.com with ESMTPSA id fl14sm2879910wjc.11.2015.04.13.05.32.49 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 13 Apr 2015 05:32:50 -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, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, alex.williamson@redhat.com, pbonzini@redhat.com Cc: linux-kernel@vger.kernel.org, patches@linaro.org, feng.wu@intel.com, b.reynal@virtualopensystems.com Subject: [RFC v6 11/16] KVM: kvm-vfio: wrappers for vfio_external_{mask|is_active|set_automasked} Date: Mon, 13 Apr 2015 14:29:26 +0200 Message-Id: <1428928171-18884-12-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1428928171-18884-1-git-send-email-eric.auger@linaro.org> References: <1428928171-18884-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 - v5 -> v6: x vfio.h modifications duly moved in "VFIO: platform: add vfio_external_{mask|is_active|set_automasked}" x all external functions use vfio_device handle x change proto of above function (unsigned index, unsigned start, unsigned count); also return int. --- virt/kvm/vfio.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/virt/kvm/vfio.c b/virt/kvm/vfio.c index 80a45e4..f4e86d3 100644 --- a/virt/kvm/vfio.c +++ b/virt/kvm/vfio.c @@ -134,6 +134,58 @@ static void kvm_vfio_put_vfio_device(struct vfio_device *vdev) kvm_vfio_device_put_external_user(vdev); } +int kvm_vfio_external_is_active(struct vfio_device *vdev, + unsigned index, unsigned start, unsigned count) +{ + int (*fn)(struct vfio_device *, unsigned index, unsigned start, + unsigned count); + bool active; + + fn = symbol_get(vfio_external_is_active); + if (!fn) + return -ENXIO; + + active = fn(vdev, index, start, count); + + symbol_put(vfio_external_is_active); + return active; +} + +int kvm_vfio_external_mask(struct vfio_device *vdev, unsigned index, + unsigned start, unsigned count) +{ + int ret; + int (*fn)(struct vfio_device *, unsigned index, unsigned start, + unsigned count); + + fn = symbol_get(vfio_external_mask); + if (!fn) + return -ENXIO; + + ret = fn(vdev, index, start, count); + + symbol_put(vfio_external_mask); + return ret; +} + +int kvm_vfio_external_set_automasked(struct vfio_device *vdev, + unsigned index, unsigned start, + unsigned count, bool automasked) +{ + int ret; + int (*fn)(struct vfio_device *, unsigned index, unsigned start, + unsigned count, bool automasked); + + fn = symbol_get(vfio_external_set_automasked); + if (!fn) + return -ENXIO; + + ret = fn(vdev, index, start, count, automasked); + + symbol_put(vfio_external_set_automasked); + return ret; +} + static bool kvm_vfio_group_is_coherent(struct vfio_group *vfio_group) { long (*fn)(struct vfio_group *, unsigned long);