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: Auger Eric X-Patchwork-Id: 47112 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E074D20553 for ; Mon, 13 Apr 2015 12:33:06 +0000 (UTC) Received: by widjs5 with SMTP id js5sf12367337wid.3 for ; Mon, 13 Apr 2015 05:33:06 -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=FZIKY9rK/SBSM7xLVH3eFQmISz8Fu4sfWxOqaa/qG4w=; b=XFIcK5+uQsrNPLuuRprk+fOBShtJ+Qe9ePIxVgXyPUoRdQAcddshPI0VSaqMe969y2 EiK2v4wOhvqub7xav1HePKavnsAvCOBMQP+6+xAuUgeg19GuXI0tPUFVBloMDHRKSTj0 Izq4qZeHJt9RCH0qqwoeAhlpfr8fC3klO1gNWnD4aXfCWF26G8jii1LRGG7JnKfU2JHk S55edgjeLNRP2JfWlG16Rsp113m3agJgkKAHfYb2vrAh/OwOtKQnlUedb+Pq1P/f44Ne sl/Fbx7VWDT4wmXjByFyP2lXPAu6mg4nFxczJ50jTkM+rV1e0BDzZYEm6TM+fvGzewFk F6BA== X-Gm-Message-State: ALoCoQlluP14DJ/pC8OMRsGJxjreKCvrfO3QSq/8owRKsxgaWNwAz99pbrq+OucFbwxiCpQoyYBM X-Received: by 10.180.10.136 with SMTP id i8mr1694906wib.7.1428928386163; Mon, 13 Apr 2015 05:33:06 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.194 with SMTP id a2ls643796lak.88.gmail; Mon, 13 Apr 2015 05:33:06 -0700 (PDT) X-Received: by 10.112.150.130 with SMTP id ui2mr13014509lbb.116.1428928385990; Mon, 13 Apr 2015 05:33:05 -0700 (PDT) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com. [209.85.217.172]) by mx.google.com with ESMTPS id yd8si8287741lbb.144.2015.04.13.05.33.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Apr 2015 05:33:05 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.172 as permitted sender) client-ip=209.85.217.172; Received: by lbbzk7 with SMTP id zk7so57332359lbb.0 for ; Mon, 13 Apr 2015 05:33:05 -0700 (PDT) X-Received: by 10.112.162.232 with SMTP id yd8mr12855331lbb.41.1428928385907; Mon, 13 Apr 2015 05:33:05 -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.67.65 with SMTP id l1csp1175231lbt; Mon, 13 Apr 2015 05:33:05 -0700 (PDT) X-Received: by 10.194.86.9 with SMTP id l9mr1470615wjz.80.1428928371851; Mon, 13 Apr 2015 05:32:51 -0700 (PDT) Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com. [209.85.212.169]) by mx.google.com with ESMTPS id pd7si13751145wic.106.2015.04.13.05.32.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Apr 2015 05:32:51 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.169 as permitted sender) client-ip=209.85.212.169; Received: by widdi4 with SMTP id di4so49678937wid.0 for ; Mon, 13 Apr 2015 05:32:51 -0700 (PDT) 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> 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.172 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 - 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);