Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1529915ybg; Wed, 29 Jul 2020 17:14:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFV3HXKorYdL93vOzvXEfaVsJGvyx/A9Jr0qxp68lmgBmeR2Cfh1OwMHceok8yRfMn0zV4 X-Received: by 2002:a50:ccc7:: with SMTP id b7mr290705edj.9.1596068094150; Wed, 29 Jul 2020 17:14:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596068094; cv=none; d=google.com; s=arc-20160816; b=qBoDf8ZLzl5xj4hH719g7FQfkSyc3gZXzARpzY6ow9Z9UUGWMJ5ybaDWZSRa/vQRGD lbjBDQR4blcw6osgNxU3z0V9YHpiZZZGB8rOLzrmGZzJ+lXtHBq5vtAFCdhkPXxa1mF7 h/WFNdqDUMtXIEsRNmBsN9rjdoih0yxyuHjGxhoB3ejmOIZF1Du9UF33lqB8bPwlIFKd FNkWx94R9Ha8SnjL+IKxPC7ohPY4RRbGg7Ak1x5As9ezbR0c1S3qWK2uy7bwXxu4ah/h lGGc7AMTliyJlQsE9QAYsWLMMbgXhaKy7Vcqc7Jn9eV66EcX8WjTVqgOau0Hi+f5YY4z w5Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:ironport-sdr:ironport-sdr; bh=PXw3IXSnKlAfme+AQJmmd6YTT3HQJB0Q1+8UZZC9KfE=; b=pJbMPJIqKFSSG0QYOYUOtdehcXJODgHt+8nTJaEMuSKsDX4s2yJWgetdsseTvoOYCf oxBKljVWLq2oC7yQ5TeKHFY0aKrqvTk0uAIaOmeBbijmMEzmX13YudgLI0lYKDgk7PCj NJmiocw7C60Ye2evds9K5FElxfgPSZMobDdbvzcyFauoz+UbpLdIdK/uRhbAQKkwxTsE 7bdYLKGrwwAo9Zq9FbvN/ZG5p9/Xr3dO9D7P2mXk3VZBAKJdRdclngQSXt5ZnaVPReJm TazU2Hf4zByqT9jOOHWpVlo4qEUHCm5bxXCjer8IACdne9qlAGRfTma04TPuL4muzBe/ 9/Dg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l8si1333690ejq.668.2020.07.29.17.14.31; Wed, 29 Jul 2020 17:14:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728202AbgG3AOV (ORCPT + 99 others); Wed, 29 Jul 2020 20:14:21 -0400 Received: from mga09.intel.com ([134.134.136.24]:33261 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728053AbgG3AOV (ORCPT ); Wed, 29 Jul 2020 20:14:21 -0400 IronPort-SDR: AR6C2klgbQbRP70EKznPW7FHof4PjZAk9Wc3K5tK1WoJP+vi+vu6h8evZNdgnNlan2Bqpf+290 2YFjEy1amQ/A== X-IronPort-AV: E=McAfee;i="6000,8403,9697"; a="152748855" X-IronPort-AV: E=Sophos;i="5.75,412,1589266800"; d="scan'208";a="152748855" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jul 2020 17:14:20 -0700 IronPort-SDR: ELSDTWerbdEmwYsfEhZqtnKxjOm0aXHhl0sMpuKAijHvb+QVR65MSCd6QWckfNt5rLG6x18ZGB 5kG3KczUTgZg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,412,1589266800"; d="scan'208";a="286680250" Received: from jacob-builder.jf.intel.com ([10.7.199.155]) by orsmga003.jf.intel.com with ESMTP; 29 Jul 2020 17:14:19 -0700 From: Jacob Pan To: iommu@lists.linux-foundation.org, LKML , Joerg Roedel , Alex Williamson Cc: "Lu Baolu" , David Woodhouse , Yi Liu , "Tian, Kevin" , Raj Ashok , "Christoph Hellwig" , Jean-Philippe Brucker , Eric Auger , Jonathan Corbet , Jacob Pan Subject: [PATCH v7 3/7] iommu/uapi: Introduce enum type for PASID data format Date: Wed, 29 Jul 2020 17:21:03 -0700 Message-Id: <1596068467-49322-4-git-send-email-jacob.jun.pan@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1596068467-49322-1-git-send-email-jacob.jun.pan@linux.intel.com> References: <1596068467-49322-1-git-send-email-jacob.jun.pan@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There can be multiple vendor-specific PASID data formats used in UAPI structures. This patch adds enum type with a last entry which makes range checking much easier. Suggested-by: Alex Williamson Signed-off-by: Jacob Pan --- include/uapi/linux/iommu.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/uapi/linux/iommu.h b/include/uapi/linux/iommu.h index d5e9014f690e..abf4455a3495 100644 --- a/include/uapi/linux/iommu.h +++ b/include/uapi/linux/iommu.h @@ -294,11 +294,16 @@ struct iommu_gpasid_bind_data_vtd { IOMMU_SVA_VTD_GPASID_PCD | \ IOMMU_SVA_VTD_GPASID_PWT) +enum iommu_pasid_data_format { + IOMMU_PASID_FORMAT_INTEL_VTD = 1, + IOMMU_PASID_FORMAT_LAST, +}; + /** * struct iommu_gpasid_bind_data - Information about device and guest PASID binding * @argsz: User filled size of this data * @version: Version of this data structure - * @format: PASID table entry format + * @format: PASID table entry format of enum iommu_pasid_data_format type * @flags: Additional information on guest bind request * @gpgd: Guest page directory base of the guest mm to bind * @hpasid: Process address space ID used for the guest mm in host IOMMU @@ -317,7 +322,6 @@ struct iommu_gpasid_bind_data { __u32 argsz; #define IOMMU_GPASID_BIND_VERSION_1 1 __u32 version; -#define IOMMU_PASID_FORMAT_INTEL_VTD 1 __u32 format; __u32 addr_width; #define IOMMU_SVA_GPASID_VAL (1 << 0) /* guest PASID valid */ -- 2.7.4