From patchwork Wed Mar 4 16:07:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baptiste Reynal X-Patchwork-Id: 5937521 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 BF82EBF440 for ; Wed, 4 Mar 2015 16:09:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0ED4B20272 for ; Wed, 4 Mar 2015 16:09:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EDD7D202B4 for ; Wed, 4 Mar 2015 16:09:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758902AbbCDQIh (ORCPT ); Wed, 4 Mar 2015 11:08:37 -0500 Received: from mail-wi0-f169.google.com ([209.85.212.169]:33777 "EHLO mail-wi0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758789AbbCDQIf (ORCPT ); Wed, 4 Mar 2015 11:08:35 -0500 Received: by widem10 with SMTP id em10so29948095wid.0 for ; Wed, 04 Mar 2015 08:08:34 -0800 (PST) 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=Ansucs4HtsHGSOhInhBXrh7Jb16CovUnlnVkr845/8c=; b=Mdakxvwlfv+FkU9AGeW3W6GiWLQ7QRZHQpCJIc+1vs9DDmeyG84ufupXfdjH3MQXGS o7EaejSQrUW+AhJBpF5tvCkwe0qb7bEtrOUCZkRNp/m3ZrVLyqREUHW5GrHJqp+RqPo8 8OfBy+wYsejs1RwklIuS1bMLMJhZvzaFaJwwmNQzeH9Slq3O80crNFnJ+M3pqT7y4S29 NzoxZtMIq43tgDQXS6qQJ+coES6k6qP/7VlXHnbkHCiwiTfzgbVwU/IybNnpKkQZu7Fw knTzYtjYpkr1Aal/2J9yTuNXXop0rP3tVtQ1nH26/tR57Pm9o0ieddM157REkxGV3Xls Dsag== X-Gm-Message-State: ALoCoQkdMotmEXa7pjPq4dDBihoWrEgfybnBb5g6ah1au2w8/E/wHKQc2kqqsnOgvUibJCpr7m8t X-Received: by 10.180.24.65 with SMTP id s1mr14114519wif.30.1425485314734; Wed, 04 Mar 2015 08:08:34 -0800 (PST) Received: from localhost (LPuteaux-656-1-278-113.w80-15.abo.wanadoo.fr. [80.15.154.113]) by mx.google.com with ESMTPSA id gz3sm7725504wib.1.2015.03.04.08.08.33 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Mar 2015 08:08:33 -0800 (PST) From: Baptiste Reynal To: iommu@lists.linux-foundation.org, kvmarm@lists.cs.columbia.edu Cc: eric.auger@linaro.org, alex.williamson@redhat.com, tech@virtualopensystems.com, Antonios Motakis , Baptiste Reynal , kvm@vger.kernel.org (open list:VFIO DRIVER), linux-api@vger.kernel.org (open list:ABI/API), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v5 1/4] vfio: implement iommu driver capabilities with an enum Date: Wed, 4 Mar 2015 17:07:51 +0100 Message-Id: <1425485274-5709-2-git-send-email-b.reynal@virtualopensystems.com> X-Mailer: git-send-email 2.3.1 In-Reply-To: <1425485274-5709-1-git-send-email-b.reynal@virtualopensystems.com> References: <1425485274-5709-1-git-send-email-b.reynal@virtualopensystems.com> 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=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 From: Antonios Motakis Currently a VFIO driver's IOMMU capabilities are encoded as a series of numerical defines. Replace this with an enum for future maintainability. Signed-off-by: Antonios Motakis Signed-off-by: Baptiste Reynal --- include/uapi/linux/vfio.h | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h index 82889c3..5fb3d46 100644 --- a/include/uapi/linux/vfio.h +++ b/include/uapi/linux/vfio.h @@ -19,22 +19,20 @@ /* Kernel & User level defines for VFIO IOCTLs. */ -/* Extensions */ - -#define VFIO_TYPE1_IOMMU 1 -#define VFIO_SPAPR_TCE_IOMMU 2 -#define VFIO_TYPE1v2_IOMMU 3 /* - * IOMMU enforces DMA cache coherence (ex. PCIe NoSnoop stripping). This - * capability is subject to change as groups are added or removed. + * Capabilities exposed by the VFIO IOMMU driver. Some capabilities are subject + * to change as groups are added or removed. */ -#define VFIO_DMA_CC_IOMMU 4 - -/* Check if EEH is supported */ -#define VFIO_EEH 5 +enum vfio_iommu_cap { + VFIO_TYPE1_IOMMU = 1, + VFIO_SPAPR_TCE_IOMMU = 2, + VFIO_TYPE1v2_IOMMU = 3, + VFIO_DMA_CC_IOMMU = 4, /* IOMMU enforces DMA cache coherence + (ex. PCIe NoSnoop stripping) */ + VFIO_EEH = 5, /* Check if EEH is supported */ + VFIO_TYPE1_NESTING_IOMMU = 6, /* Two-stage IOMMU, implies v2 */ +}; -/* Two-stage IOMMU */ -#define VFIO_TYPE1_NESTING_IOMMU 6 /* Implies v2 */ /* * The IOCTL interface is designed for extensibility by embedding the