From patchwork Mon Mar 2 16:58:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baptiste Reynal X-Patchwork-Id: 5915891 Return-Path: X-Original-To: patchwork-kvm@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 7DDAD9F380 for ; Mon, 2 Mar 2015 17:12:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A6B15201F2 for ; Mon, 2 Mar 2015 17:12:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C691520211 for ; Mon, 2 Mar 2015 17:12:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754723AbbCBQ7T (ORCPT ); Mon, 2 Mar 2015 11:59:19 -0500 Received: from mail-wg0-f50.google.com ([74.125.82.50]:45731 "EHLO mail-wg0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754615AbbCBQ7P (ORCPT ); Mon, 2 Mar 2015 11:59:15 -0500 Received: by wgha1 with SMTP id a1so34715454wgh.12 for ; Mon, 02 Mar 2015 08:59:14 -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=Ma/vDqReYZ9Jj858AM1aUJgrHlrR8ruwFL3/gZNPXnH1j382bljMyJhnlkhMpIlkrx oWUJEvWeIwSxOg4GLJt1DT4GMS/2j159AbrOjHhTEowpU7e4AQr3i1F1tC5QPiY4NTG3 xAsHWt6njpbn6Vq6T0w+kGi7U5xvXqNATUsdfgXC73w9K+rjGBi+gdO5FtYZBOiXRBQy BYyw8mdXV4xNRnJS7BtIschxH6Cyfp2VoyyFz0xXFhBqzSrF03qHvS/fCt1yE3qXvlma Dw5Qt9nEne3vI/Gzx+Ai+9rvWeJX3NhokjGkWYPuPJH+TLys03fZs0oYDWnURAS2P4dq EDfA== X-Gm-Message-State: ALoCoQnFgVy1mQEaT1sxlxfPninyimLgm1z4G5xsdkyz1ycSuQtm1ZENOQ4bAMxwTh5mB3tdyzKe X-Received: by 10.194.158.39 with SMTP id wr7mr61561167wjb.118.1425315554324; Mon, 02 Mar 2015 08:59:14 -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 e2sm5833697wjy.46.2015.03.02.08.59.13 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Mar 2015 08:59:13 -0800 (PST) From: Baptiste Reynal To: iommu@lists.linux-foundation.org, kvmarm@lists.cs.columbia.edu Cc: tech@virtualopensystems.com, Antonios Motakis , Baptiste Reynal , Alex Williamson , 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 v4 1/5] vfio: implement iommu driver capabilities with an enum Date: Mon, 2 Mar 2015 17:58:23 +0100 Message-Id: <1425315507-29661-2-git-send-email-b.reynal@virtualopensystems.com> X-Mailer: git-send-email 2.3.1 In-Reply-To: <1425315507-29661-1-git-send-email-b.reynal@virtualopensystems.com> References: <1425315507-29661-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