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: 6208781 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 12D9B9F2EC for ; Mon, 13 Apr 2015 12:42:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 36722202F8 for ; Mon, 13 Apr 2015 12:42:32 +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 2873D2035E for ; Mon, 13 Apr 2015 12:42:31 +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 1Yhde1-0004bw-V3; Mon, 13 Apr 2015 12:39:17 +0000 Received: from mail-wi0-f177.google.com ([209.85.212.177]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YhdY9-0007E6-FE for linux-arm-kernel@lists.infradead.org; Mon, 13 Apr 2015 12:33:14 +0000 Received: by wiun10 with SMTP id n10so64597895wiu.1 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=ijwnZSc3ghzBTCfVTOu5GNBCEJj5F3V62Q2Y3P0bfbMqxsaAIstP0inLIvg0lZR0vC O07Qxerd7Y7yxrSSCt3y9o4NlGh3PUYXAQfx0AwpTd8gOVI5yGwe1t2HDhVsDnl9pYMK LF7VWZVNBYAVSR0AvIBm/8jW+o9iCpnaZQtDdWVV9coo7fwSorLh1MlUXqf9LibwZzPA BZ+9whp9NJlEKKgqmG1c+xOFutOXgT5ETfQI7xk1rQHayM1JrEfvphzOTE+rWpUsRbvw 1KpLFUpj374bJtJwX6Xrwca3osHAhNkCh6ulZGTAN2a++zmnQkQ1BX6FRyYy7eXXF2Wh Rmjw== X-Gm-Message-State: ALoCoQnTUyfHBSQNGUFA/SFVxMGykdOamC0fbQ7nWFJ9ofEot5YTw79SEiR6cvFhb/D7oYSzhEzs 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 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150413_053313_666377_97921DD0 X-CRM114-Status: UNSURE ( 9.87 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) Cc: b.reynal@virtualopensystems.com, feng.wu@intel.com, linux-kernel@vger.kernel.org, patches@linaro.org 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 - 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);