From patchwork Tue Mar 8 02:10:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 8528621 Return-Path: X-Original-To: patchwork-qemu-devel@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 6E570C0553 for ; Tue, 8 Mar 2016 02:25:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B73902015A for ; Tue, 8 Mar 2016 02:25:13 +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 0F85420155 for ; Tue, 8 Mar 2016 02:25:13 +0000 (UTC) Received: from localhost ([::1]:59671 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ad7Ki-0000AN-Bx for patchwork-qemu-devel@patchwork.kernel.org; Mon, 07 Mar 2016 21:25:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58561) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ad7Hf-0002tw-KV for qemu-devel@nongnu.org; Mon, 07 Mar 2016 21:22:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ad7Hd-0002US-Ss for qemu-devel@nongnu.org; Mon, 07 Mar 2016 21:22:03 -0500 Received: from ozlabs.org ([103.22.144.67]:56215) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ad7Hd-0002Tt-IY; Mon, 07 Mar 2016 21:22:01 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id D251A140BC6; Tue, 8 Mar 2016 13:21:57 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1457403718; bh=ZtDN2QA/oYFBVabv05+qgFL9HEquw76cGO2NdGqn3UE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j8XKhxOBxHw3qayb36fajjDHF/TnXqQ/f/8KrgA2vTzbamdjDIPa/SSP3L06PiHPx dl3DUKM91fPLhM4I4tUQKYNNc/yNG+1ronkh3HHPu8m4znJEcGr5pEgsBlqaDB6HGF NASnXRnEZOPDKLv/wc9e8pEQGxjV7Ct3ZWet+hk4= From: David Gibson To: aik@ozlabs.ru, alex.williamson@redhat.com Date: Tue, 8 Mar 2016 13:10:29 +1100 Message-Id: <1457403029-21322-8-git-send-email-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1457403029-21322-1-git-send-email-david@gibson.dropbear.id.au> References: <1457403029-21322-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, gwshan@au1.ibm.com, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, David Gibson Subject: [Qemu-devel] [PATCHv3 7/7] 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 Acked-by: Alex Williamson --- 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 0636bb1..fb588d8 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -1093,51 +1093,6 @@ int vfio_get_region_info(VFIODevice *vbasedev, int index, return 0; } -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);