From patchwork Fri Feb 26 11:32:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 8436081 Return-Path: X-Original-To: patchwork-qemu-devel@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 14A509F1D4 for ; Fri, 26 Feb 2016 11:40:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 69C962037C for ; Fri, 26 Feb 2016 11:40:36 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B6E6F2035E for ; Fri, 26 Feb 2016 11:40:35 +0000 (UTC) Received: from localhost ([::1]:49119 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZGl9-0000cj-6q for patchwork-qemu-devel@patchwork.kernel.org; Fri, 26 Feb 2016 06:40:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36538) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZGc5-00021G-Br for qemu-devel@nongnu.org; Fri, 26 Feb 2016 06:31:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aZGby-0006ic-NN for qemu-devel@nongnu.org; Fri, 26 Feb 2016 06:31:13 -0500 Received: from ozlabs.org ([103.22.144.67]:39510) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZGby-0006h6-D7; Fri, 26 Feb 2016 06:31:06 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 81E7314032B; Fri, 26 Feb 2016 22:31:03 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1456486263; bh=3pnwX7n4lztg3YsWrYapGJImbBckF6/IkR4ApSq1gKI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hrkY6Q5PneD86euCVQv2V/AuzAQZLEp5keKuSejoGFrZzTDPLD7LIJqjyCTsZaVEl EvAMSW8rXiBunuXzwNJ8bSjdpmengLCSVY2PgKcE3YLyYoC68TPlm8acyPVby4I9VR nWSIkA8v7yYsfDuo891VHikdykvdSpM0n79xM4bE= From: David Gibson To: aik@ozlabs.ru, benh@kernel.crashing.org Date: Fri, 26 Feb 2016 22:32:03 +1100 Message-Id: <1456486323-8047-13-git-send-email-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1456486323-8047-1-git-send-email-david@gibson.dropbear.id.au> References: <1456486323-8047-1-git-send-email-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 103.22.144.67 Cc: agraf@suse.de, qemu-devel@nongnu.org, gwshan@au1.ibm.com, mdroth@linux.vnet.ibm.com, alex.williamson@redhat.com, qemu-ppc@nongnu.org, David Gibson Subject: [Qemu-devel] [PATCH 12/12] vfio: Eliminate vfio_container_ioctl() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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 vfio_container_ioctl() was a bad interface that bypassed abstraction boundaries, had semantics that sat uneasily with its name, and was unsafe in many realistic circumstances. Now that spapr-pci-vfio-host-bridge has been folded into spapr-pci-host-bridge, there are no more users, so remove it. Signed-off-by: David Gibson Reviewed-by: Alexey Kardashevskiy --- hw/vfio/common.c | 45 --------------------------------------------- include/hw/vfio/vfio.h | 2 -- 2 files changed, 47 deletions(-) diff --git a/hw/vfio/common.c b/hw/vfio/common.c index e419241..26e91ad 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -959,51 +959,6 @@ void vfio_put_base_device(VFIODevice *vbasedev) close(vbasedev->fd); } -static int vfio_container_do_ioctl(AddressSpace *as, int32_t groupid, - int req, void *param) -{ - VFIOGroup *group; - VFIOContainer *container; - int ret = -1; - - group = vfio_get_group(groupid, as); - if (!group) { - error_report("vfio: group %d not registered", groupid); - return ret; - } - - container = group->container; - if (group->container) { - ret = ioctl(container->fd, req, param); - if (ret < 0) { - error_report("vfio: failed to ioctl %d to container: ret=%d, %s", - _IOC_NR(req) - VFIO_BASE, ret, strerror(errno)); - } - } - - vfio_put_group(group); - - return ret; -} - -int vfio_container_ioctl(AddressSpace *as, int32_t groupid, - int req, void *param) -{ - /* We allow only certain ioctls to the container */ - switch (req) { - case VFIO_CHECK_EXTENSION: - case VFIO_IOMMU_SPAPR_TCE_GET_INFO: - case VFIO_EEH_PE_OP: - break; - default: - /* Return an error on unknown requests */ - error_report("vfio: unsupported ioctl %X", req); - return -1; - } - - return vfio_container_do_ioctl(as, groupid, req, param); -} - /* * Interfaces for IBM EEH (Enhanced Error Handling) */ diff --git a/include/hw/vfio/vfio.h b/include/hw/vfio/vfio.h index fd3933b..7153604 100644 --- a/include/hw/vfio/vfio.h +++ b/include/hw/vfio/vfio.h @@ -3,8 +3,6 @@ #include "qemu/typedefs.h" -extern int vfio_container_ioctl(AddressSpace *as, int32_t groupid, - int req, void *param); bool vfio_eeh_as_ok(AddressSpace *as); int vfio_eeh_as_op(AddressSpace *as, uint32_t op);