Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2585038rdb; Fri, 22 Sep 2023 03:04:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHh40BWg3MX3DuSwdgP7KFnczHsMD+HSe/VvCaSN0KEAX7QQvd/M05eX8x4ABpQAtUFTOI+ X-Received: by 2002:a05:6a00:d58:b0:692:6d3f:485b with SMTP id n24-20020a056a000d5800b006926d3f485bmr2457626pfv.3.1695377077512; Fri, 22 Sep 2023 03:04:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695377077; cv=none; d=google.com; s=arc-20160816; b=0KbWTt2TiY2xBnxsUWy0izGSsbPLLqfkxb/qPB5KxOfMwuoXFRmt6WkKCi2oeGn7e9 zoRLimuCkvC6WYOk74LWF1GCTLhahGFry/kK6aZf0wWu1WGm4JpyFdVGsIYHDqWcH5fd QixH2BIXXapqkSz2WjQQuQna1SUMlHSMCxcUvSnmvXvYcQD3ccyvtoQElP/YEaihEEeC qcUfiscsvevQXnpKG9HTYHmaYTp7Q/ktomwHzWMXPM8R0AHUumxwes8qxHnp3V0o2Twm WJdYuVIniX0Tg7hSoC3jECU5qwptwA244o4FAFRyvs/V9jWWpmAt7AXxm/EO9UagRIJl 7B8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=NTH1n6WWlgcpMMWXvNAHcb/Ih22tGIHzSkUN8o+3/Ns=; fh=c4i5+fNcdKQc0DGY1G4VW+3a5S+nr3kxnIOpVsGMIMs=; b=a9qSQdjRCoQ4Mk4tqTQa3YTiuUk2/BPtF8Egs7WrBuiyjqtz3UUtlJWU5sueGngyPk fxCYJuhfF+GjDAlSTABSI881QRCUwnHbbqmcB3twdNjfN6+zhRO1NvCNnkGbQ874fexQ 83gG576kgo5iBhVlCX9rjqrhxyNWeeDEur/u05Xxy/Cg/Vkv45LzPSXsMLWpOx7bozPS G17lf6ZQtE9Pkf9GOhqC94BhTJXAY4KaqP94BjpUkqlizV9dcfMiOEdIeN1mgQatDPrF UiyraPFSU/Cv1kizoaZi5IMU+U+ufUzOph4a08kWBiz3LjUvsTSMLrrvVGEUNXwgehpo hCDQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id cb3-20020a056a00430300b0068fb986fcf3si3383415pfb.377.2023.09.22.03.04.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 03:04:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 9D8F383C0EE2; Fri, 22 Sep 2023 02:48:15 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229932AbjIVJsL (ORCPT + 99 others); Fri, 22 Sep 2023 05:48:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229497AbjIVJsK (ORCPT ); Fri, 22 Sep 2023 05:48:10 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EB7F78F; Fri, 22 Sep 2023 02:48:03 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AD60DDA7; Fri, 22 Sep 2023 02:48:40 -0700 (PDT) Received: from [10.57.0.85] (unknown [10.57.0.85]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 905653F67D; Fri, 22 Sep 2023 02:47:57 -0700 (PDT) Message-ID: Date: Fri, 22 Sep 2023 10:47:32 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH v4 01/17] iommu: Add hwpt_type with user_data for domain_alloc_user op Content-Language: en-GB To: Jason Gunthorpe , Baolu Lu Cc: Yi Liu , joro@8bytes.org, alex.williamson@redhat.com, kevin.tian@intel.com, cohuck@redhat.com, eric.auger@redhat.com, nicolinc@nvidia.com, kvm@vger.kernel.org, mjrosato@linux.ibm.com, chao.p.peng@linux.intel.com, yi.y.sun@linux.intel.com, peterx@redhat.com, jasowang@redhat.com, shameerali.kolothum.thodi@huawei.com, lulu@redhat.com, suravee.suthikulpanit@amd.com, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, zhenzhong.duan@intel.com, joao.m.martins@oracle.com References: <20230921075138.124099-1-yi.l.liu@intel.com> <20230921075138.124099-2-yi.l.liu@intel.com> <0d37a1b1-e7ef-fa73-d17c-629cd254ae75@linux.intel.com> <20230921164447.GQ13733@nvidia.com> From: Robin Murphy In-Reply-To: <20230921164447.GQ13733@nvidia.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 22 Sep 2023 02:48:15 -0700 (PDT) On 2023-09-21 17:44, Jason Gunthorpe wrote: > On Thu, Sep 21, 2023 at 08:12:03PM +0800, Baolu Lu wrote: >> On 2023/9/21 15:51, Yi Liu wrote: >>> diff --git a/include/uapi/linux/iommufd.h b/include/uapi/linux/iommufd.h >>> index 4a7c5c8fdbb4..3c8660fe9bb1 100644 >>> --- a/include/uapi/linux/iommufd.h >>> +++ b/include/uapi/linux/iommufd.h >>> @@ -357,6 +357,14 @@ enum iommufd_hwpt_alloc_flags { >>> IOMMU_HWPT_ALLOC_NEST_PARENT = 1 << 0, >>> }; >>> +/** >>> + * enum iommu_hwpt_type - IOMMU HWPT Type >>> + * @IOMMU_HWPT_TYPE_DEFAULT: default >> >> How about s/default/vendor agnostic/ ? > > Please don't use the word vendor :) > > IOMMU_HWPT_TYPE_GENERIC perhaps if we don't like default Ah yes, a default domain type, not to be confused with any default domain type, including the default default domain type. Just in case anyone had forgotten how gleefully fun this is :D I particularly like the bit where we end up with this construct later: switch (hwpt_type) { case IOMMU_HWPT_TYPE_DEFAULT: /* allocate a domain */ default: /* allocate a different domain */ } But of course neither case allocates a *default* domain, because it's quite obviously the wrong place to be doing that. I could go on enjoying myself, but basically yeah, "default" can't be a type in itself (at best it would be a meta-type which could be requested, such that it resolves to some real type to actually allocate), so a good name should reflect what the type functionally *means* to the user. IIUC the important distinction is that it's an abstract kernel-owned pagetable for the user to indirectly control via the API, rather than one it owns and writes directly (and thus has to be in a specific agreed format). Thanks, Robin.