Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1176588pxa; Thu, 13 Aug 2020 02:30:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydoAPpSr9PuEXcf1F1bjJZVuaMhDGVjiEvpcixmGZ3aYeClTUDSF27L79yotppnvN7DuKh X-Received: by 2002:a17:906:dbd8:: with SMTP id yc24mr3827880ejb.176.1597311016645; Thu, 13 Aug 2020 02:30:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597311016; cv=none; d=google.com; s=arc-20160816; b=ryjvH+ZDeDgEC2EmJxS5IGBYzAPCZgQTfQzRB2yMxZ+NQHw0mt6ijhTZ0fqV26hrjI 53BLKfVRCxHvxGZzkFUj5WvY+h+tAaHSB/51zE9Fzym5acqAm/sb8l2hGRNWkvHLS9zN 1Jik+QS1GJHvT6iWX5xPfwuNdeUUM44fHijwQZ431aNaoVpMB3U+zbh/umVgmUMRjm+M w3iA/xpdET/6v3XyYlM+FocqP7Fq3Z5/C8mHhG6t4R9CnsQHcPyw8CaUjx7x0d0R6OYO KBRlBkKV3LoXj0bOAqGBNqIrzNqrILLcOAfZePGWtrFmKNRNrLji0wmGPEJp3kt3qf6R nUaA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=DuW+niP5miqE6IU1aSrvItfHXK36bjH0nUEUiC5ZcoE=; b=XhZIaLCxsCDfoAoyr3fw5+X21iCjjItn46svt4effvOl9z+yu1gsR9o+396I8sabd5 fW8/9/Y2flU1gYaOcAn3/Q55YgvbsGeMSQpDUTBCJCXR2mcgnjUg10vobvSExF4fT2sg TWbYQua49MLrgfdF1xnjCTFgxPm/B9hy8v9CZdW4NUm9EHRJw0v9Nv2xmYmGsVL7u7Nn 42ksaKWVH/zaNuPSnkEkHoAnhgkfT/HvnjSVAMBCmOeuK6ebhBz2q3UoRTyE7mBt1+tv V67zsKh9oGXOCWW+KVU84AppUU7aGcR39Zq+hodUnrVydiKT9ZZGE84pqFd7J43ayU/p s65A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DK5yRnBY; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j19si2737562eja.495.2020.08.13.02.29.53; Thu, 13 Aug 2020 02:30:16 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DK5yRnBY; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726533AbgHMJ3X (ORCPT + 99 others); Thu, 13 Aug 2020 05:29:23 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:28958 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726048AbgHMJ3W (ORCPT ); Thu, 13 Aug 2020 05:29:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597310961; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DuW+niP5miqE6IU1aSrvItfHXK36bjH0nUEUiC5ZcoE=; b=DK5yRnBY3gAauOSTThQ6cK88P8P/YVeOPb4gwmH6xXDN3uO2YUgwu2rm3lhHQTv2DqWtp9 8YbGkcaarMiucS6+wM+Y/5mjUp8P170eUFqOpDppwKM7o7xA0FQbSc6c4LT09CMVsNUGzt lrhevViaa9npEnvNlxtgEvcItOEIA3k= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-130-xxSP7HqAMUiNawIogS2kFQ-1; Thu, 13 Aug 2020 05:29:17 -0400 X-MC-Unique: xxSP7HqAMUiNawIogS2kFQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 511711854FC7; Thu, 13 Aug 2020 09:29:15 +0000 (UTC) Received: from [10.36.113.93] (ovpn-113-93.ams2.redhat.com [10.36.113.93]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8E3F7600C5; Thu, 13 Aug 2020 09:29:06 +0000 (UTC) Subject: Re: [PATCH v7 3/7] iommu/uapi: Introduce enum type for PASID data format To: Jacob Pan , 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 , Jonathan Corbet References: <1596068467-49322-1-git-send-email-jacob.jun.pan@linux.intel.com> <1596068467-49322-4-git-send-email-jacob.jun.pan@linux.intel.com> From: Auger Eric Message-ID: <98781b4e-fe8e-fa65-4b77-c5221d241821@redhat.com> Date: Thu, 13 Aug 2020 11:29:04 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <1596068467-49322-4-git-send-email-jacob.jun.pan@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jacob, On 7/30/20 2:21 AM, Jacob Pan wrote: > 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 */ > Reviewed-by: Eric Auger Eric