Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1817293ybv; Thu, 6 Feb 2020 10:18:44 -0800 (PST) X-Google-Smtp-Source: APXvYqxzw1wCDlbWtQhZtgDFrVxi7kPA6Zvt9Esk6GIYTOobivbG38uPWPMURzgmZPdR4gADDK32 X-Received: by 2002:a9d:6183:: with SMTP id g3mr31213859otk.304.1581013124502; Thu, 06 Feb 2020 10:18:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581013124; cv=none; d=google.com; s=arc-20160816; b=vU7KlpXIkFSunRVM8hkCu07KLfZfZxbqFv3PnRLVSXcLahwZZ9WMkpJ/3Y6h+jH4jf nuLDdGb1HR6rYNkoopNU/OJAyQTDyD8VEedIOWW5ESkDNOExmvy94dJd6ZQ3vEqAYFPo eylnRlYXxGm+JTo+unDVIcefEDSajv9BLeGg9JY7Ev2NFV4tlJi8aM4bGZ8yzSXwuJ7A notWhSiZyAEcszLgtl0s0+kzs1htGyLTXjI+OTddjxX66CByqM+OgNTCOPZq3Uo767Os hHOAtqw/J/84V28/1T6xOMHh7/DYh9yFOLxDesdT+/dc2cnnpSXZCKFoS1UWeMvyHkOc b3pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=TzSp4ZjvLAQcpyu7RSWwquhdlkdYO04T0LBJz98zlD4=; b=o8Ep/ohySTkHHXmhTiMOpzzABS8qIqJqwlXhF73VO7+c2qhJ9nyd+ugc2csM5S/JYZ dGGSCnWQXSTtW3xh8S4K48P9tvh1D4obN1ygd8gbtk/8Y9yra7PM39ZUqGh85Rp4R71a Le3GWwx/R+fZzE7gZD8yhVe6dwZJ9xfh4eitAf2Kw/xKUs9zkUv2h89uoMuQEQsJ4rPE c3JjU267VmHBoeSPN+DzMWPQToCxohMB6GvIatsZgFhVOHzleWO9zo9h+PH9FpfjGqyF aQK+WfEVaQa/XUoE9n4E5JogJy1UNgdlJkIwU3WgdeRMhTyciFu3djHdEmTr0pFsLRde EYOQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id v5si2532270oix.197.2020.02.06.10.18.32; Thu, 06 Feb 2020 10:18:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1727910AbgBFSRb (ORCPT + 99 others); Thu, 6 Feb 2020 13:17:31 -0500 Received: from mga02.intel.com ([134.134.136.20]:13351 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727358AbgBFSRa (ORCPT ); Thu, 6 Feb 2020 13:17:30 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Feb 2020 10:17:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,410,1574150400"; d="scan'208";a="226230816" Received: from jacob-builder.jf.intel.com (HELO jacob-builder) ([10.7.199.155]) by fmsmga008.fm.intel.com with ESMTP; 06 Feb 2020 10:17:29 -0800 Date: Thu, 6 Feb 2020 10:22:47 -0800 From: Jacob Pan To: Auger Eric Cc: iommu@lists.linux-foundation.org, LKML , Lu Baolu , Joerg Roedel , David Woodhouse , Yi Liu , "Tian, Kevin" , Raj Ashok , Alex Williamson , Christoph Hellwig , Jean-Philippe Brucker , Jonathan Cameron , jacob.jun.pan@linux.intel.com Subject: Re: [PATCH 1/3] iommu/uapi: Define uapi version and capabilities Message-ID: <20200206102247.4eeb5791@jacob-builder> In-Reply-To: <699faadb-e714-e36d-152a-5b650c0a403f@redhat.com> References: <1580277724-66994-1-git-send-email-jacob.jun.pan@linux.intel.com> <1580277724-66994-2-git-send-email-jacob.jun.pan@linux.intel.com> <699faadb-e714-e36d-152a-5b650c0a403f@redhat.com> Organization: OTC X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 6 Feb 2020 11:14:27 +0100 Auger Eric wrote: > Hi Jacob, > On 1/29/20 7:02 AM, Jacob Pan wrote: > > Define a unified UAPI version to be used for compatibility > > checks between user and kernel. > > > > Signed-off-by: Liu Yi L > > Signed-off-by: Jacob Pan > > --- > > include/uapi/linux/iommu.h | 48 > > ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 > > insertions(+) > > > > diff --git a/include/uapi/linux/iommu.h b/include/uapi/linux/iommu.h > > index fcafb6401430..65a26c2519ee 100644 > > --- a/include/uapi/linux/iommu.h > > +++ b/include/uapi/linux/iommu.h > > @@ -8,6 +8,54 @@ > > > > #include > > > > +/** > > + * Current version of the IOMMU user API. This is intended for > > query > > + * between user and kernel to determine compatible data structures. > > + * > > + * Having a single UAPI version to govern the user-kernel data > > structures > > + * makes compatibility check straightforward. On the contrary, > > supporting > > + * combinations of multiple versions of the data can be a > > nightmare. > I would rather put the above justification in the commit msg and not > here. make sense. > > + * > > + * UAPI version can be bumped up with the following rules: > > + * 1. All data structures passed between user and kernel space > > share > > + * the same version number. i.e. any extension to to any > > structure > s/to to/to will fix. > > + * results in version bump up. > in a version number increment? sounds good, more specific. > > + * > > + * 2. Data structures are open to extension but closed to > > modification.> + * New fields must be added at the end of each > > data structure with > > + * 64bit alignment. Flag bits can be added without size change > > but > > + * existing ones cannot be altered. > > + * > > + * 3. Versions are backward compatible. > > + * > > + * 4. Version to size lookup is supported by kernel internal API > > for each > > + * API function type. @version is mandatory for new data > > structures > > + * and must be at the beginning with type of __u32. > > + */ > > +#define IOMMU_UAPI_VERSION 1 > > +static inline int iommu_get_uapi_version(void) > > +{ > > + return IOMMU_UAPI_VERSION; > > +} > > + > > +/* > > + * Supported UAPI features that can be reported to user space. > > + * These types represent the capability available in the kernel. > > + * > > + * REVISIT: UAPI version also implies the capabilities. Should we > > + * report them explicitly? > > + */ > > +enum IOMMU_UAPI_DATA_TYPES { > > + IOMMU_UAPI_BIND_GPASID, > > + IOMMU_UAPI_CACHE_INVAL, > > + IOMMU_UAPI_PAGE_RESP, > > + NR_IOMMU_UAPI_TYPE, > > +}; > > + > > +#define IOMMU_UAPI_CAP_MASK ((1 << IOMMU_UAPI_BIND_GPASID) > > | \ > > + (1 << IOMMU_UAPI_CACHE_INVAL) > > | \ > > + (1 << IOMMU_UAPI_PAGE_RESP)) > > + > > #define IOMMU_FAULT_PERM_READ (1 << 0) /* read */ > > #define IOMMU_FAULT_PERM_WRITE (1 << 1) /* write */ > > #define IOMMU_FAULT_PERM_EXEC (1 << 2) /* exec */ > > > Thanks > > Eric >