Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2212984rdh; Tue, 26 Sep 2023 16:48:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEuo/a6MJdFj2GwWfoD22BVYbTCqPNf9bcIt713H5lPKkfGGZD7Am65BvkZXkzzketmfJZD X-Received: by 2002:a17:90a:dc0b:b0:277:61d7:78be with SMTP id i11-20020a17090adc0b00b0027761d778bemr6188510pjv.14.1695772105579; Tue, 26 Sep 2023 16:48:25 -0700 (PDT) Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id k191-20020a633dc8000000b00578e4e6131dsi6657312pga.436.2023.09.26.16.48.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 16:48:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=oA++gC6f; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 8A96E80292A3; Sun, 24 Sep 2023 23:16:01 -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 S231954AbjIYGPq (ORCPT + 99 others); Mon, 25 Sep 2023 02:15:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229511AbjIYGPo (ORCPT ); Mon, 25 Sep 2023 02:15:44 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 450B1C5; Sun, 24 Sep 2023 23:15:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695622537; x=1727158537; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=1RFs13/2evvW0GEUFrpNdg22op40mOaiWlGjnlygTZI=; b=oA++gC6fTElzfzelXZ1aLsOhtbdjWXK2ocZeXvomy+KBuoc3F10JOaED /LVEah0ud/5VON/+ZHdLmy64F+WWYspDyZiGEVq0nZzOOZ9uO3p5d3tAB O31+8S/6VqljtM10Vvg4sh++c+xeSBxAsoCl6Lw8JNKtnu4xMXplIrOpf mMzpNAlyDEozGPDD31OdnOk44U5ZmrQ+807PRy/Za2ZVa3B22g87ohasb 8fm4l2aC7HGlG3pv4JpHnEhOeYafnIUMSoTvqofSSZGEQSDdxQBb/Tn+l wWTywgFzdM00h5Yk8NOHHcGBwYt81POLrL1ufRajy6gcsuRhO9vK4GItA g==; X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="383934501" X-IronPort-AV: E=Sophos;i="6.03,174,1694761200"; d="scan'208";a="383934501" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Sep 2023 23:15:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="783350457" X-IronPort-AV: E=Sophos;i="6.03,174,1694761200"; d="scan'208";a="783350457" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga001.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 24 Sep 2023 23:15:27 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Sun, 24 Sep 2023 23:15:26 -0700 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Sun, 24 Sep 2023 23:15:25 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32 via Frontend Transport; Sun, 24 Sep 2023 23:15:25 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.103) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.32; Sun, 24 Sep 2023 23:15:25 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iYktEagej6vHhae6RBDVolUptrDi2Myq7tfR6YbhBWPOT7QYBWEYnuTQnwkwZE5+C2Tx7YPSLATTruTqu1bauiVIbYzSvoLtmnMdglpK0mrozSBZQRDVCl5AVbsc21SX/yHeEijcMX46gQKRiSWu9lSXaYS/Ypwyg39GbwbAvxe4hB3CnZAB348cdTv4pZ6OOVf3fTktY2kTlN0xXaGKJDgslRXk7r9CfCRQM45w3ijBPUbWJSejvs1QvIDu3x6F0JvpQjhItTE1kGBSTORVEI+EbgIrXUU0pKu/SVFghGHjBVSyow+hdeUIZYP90ZXyPEwVlkmOtLpR31VRNHSDZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BXXmybq6dYQ/Q3KypcNhar7qEhw5HU5VN3NZgCBpquk=; b=TX8JbREMa1n+q/UKnlCBfU55bHF5QpqAVkqEacnh0bDh8ShiWyOSmTtBVft78MXk3/iRcJIa8ojiGH19WBN6Plf6ttcLNqAwJfgr6EzdGPqX2a0shkDbjB2WJUr4nMogLj8IH/WBFWGQQCQFPx0p4tghgtYFYXiutQw5hDo/KjpOZeEiq9AhhYjKpu6MrRN4aM+2wJUOm0HQJRaxfTvgn3/PO50opG53hsakZCgUdxuIJoEOc5zbGoNMeDpi060emqbO9teDRqG4OqrAQCf5mzsWNeBVz9YbGyxTNAyhx/Y5PEJrx+r6McfMtC/6DrfR5uTLPMxvcqAvt+NAjuUtPA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DS0PR11MB7529.namprd11.prod.outlook.com (2603:10b6:8:141::20) by CH3PR11MB8441.namprd11.prod.outlook.com (2603:10b6:610:1bc::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.23; Mon, 25 Sep 2023 06:15:23 +0000 Received: from DS0PR11MB7529.namprd11.prod.outlook.com ([fe80::f8f4:bed2:b2f8:cb6b]) by DS0PR11MB7529.namprd11.prod.outlook.com ([fe80::f8f4:bed2:b2f8:cb6b%3]) with mapi id 15.20.6813.027; Mon, 25 Sep 2023 06:15:23 +0000 Message-ID: <94004987-3cab-9fde-a231-7c63ac88a866@intel.com> Date: Mon, 25 Sep 2023 14:17:37 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0 Thunderbird/102.13.0 Subject: Re: [PATCH v4 01/17] iommu: Add hwpt_type with user_data for domain_alloc_user op To: Robin Murphy , Jason Gunthorpe , Baolu Lu CC: , , , , , , , , , , , , , , , , , , , 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> Content-Language: en-US From: Yi Liu In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SG2PR02CA0118.apcprd02.prod.outlook.com (2603:1096:4:92::34) To DS0PR11MB7529.namprd11.prod.outlook.com (2603:10b6:8:141::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7529:EE_|CH3PR11MB8441:EE_ X-MS-Office365-Filtering-Correlation-Id: 6262718a-fb85-4c31-2c14-08dbbd8ecd12 X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BywFCGd/33qLlHA0DMaHzRtD10msPb0YJU9+x6ANwba5sqZYz+7o3XxzKfeLIV03Xi/FWinzW62nJJ5d2o/X46/w8O3TXWWY3utls3Hqp6UH8D6I52oX7A+dYCUR+Wtu4gc30li2Rz32HDc7g5yjWJ8kmXqFCbJWe5yk0xuELRSxDnQau4JUPdt9vU7z/SBrbnBbm/pTlNz50NQuD/rmeEOc1t5wpm++vaDrXBgDS2HKRkM4dNWs1QE5GYG1tEVqdNuhXyTRqnX2SvLpAhGwGAYRQmqrt+eMrRAz7vhcFvRUymhNXNXFXYs1MSK5h2LBjKoGjfkHGJDOYGB6A19WiFN/aQeapiQvIR0TxTrjul9DOpoMgj/StXOldCIXyHklSQopmryjKgWsiGsDrd/J6Rxi9ubEZEwFjCEhXhPJu3ungZ95iGIjC31IyqaWNp/RnUEwQo2q40xngJoRu1jnUEdfE/9RdTQjpXpNOr8T4S201iIKQX8cPnmwA3b6M7Iv0oc/P/Q49/W+54lkhtF7MBA6DvR8rfre+F+NmX49ZVWI6BiKYNlw1v1Xhu6xX6o4XhPR1QzQSmu6fwR7GK4B+uHlljbAwwMidR6kTNtbK66yvy33bqXRXNpr1q9/AHxnaZDQ6Ob2oYXHXmNmKG+eWw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS0PR11MB7529.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(376002)(346002)(396003)(366004)(136003)(230922051799003)(1800799009)(186009)(451199024)(31686004)(6666004)(6486002)(53546011)(6506007)(4326008)(66556008)(7416002)(82960400001)(86362001)(38100700002)(2906002)(41300700001)(2616005)(31696002)(66476007)(6512007)(26005)(36756003)(83380400001)(316002)(5660300002)(478600001)(8936002)(8676002)(110136005)(66946007)(45980500001)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?QWJRbWdXalBUbU12VkhOL3dtUlNwdjFseFBmb1FCN2RGVXBScEo4amZ5Q3NM?= =?utf-8?B?ODJWdWJOL3NYd1ByMlg1RWJFSU5xVzhYdkVJbmwwZlJKREJ6VmlKYmNycnVZ?= =?utf-8?B?NUpPMDBIWnJZM1pLT29hVjZWczhVM0JIT3h0TWhnZHVIWFZuOVZSWFdDMDlG?= =?utf-8?B?Q0JqNFZiL1ZjM0pNUVI0TmZmd2hzMVo1TEJwdlkxM2Zwd3llTEw3SnozZ0JO?= =?utf-8?B?ZUZpUC85OW5SSmcxVHJBZWtiblo1N3E2dE9xQVRhWEhMc0lSeE9KdEF2K0RS?= =?utf-8?B?V2tqTGhRMjRrRVVQTXlyMWlsQnRtNFYwRGlpeTljTVlGQjN2MjZXSnRzYmp2?= =?utf-8?B?aVE5TTZ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-Message-Id: 6262718a-fb85-4c31-2c14-08dbbd8ecd12 X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7529.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2023 06:15:22.9984 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: e8YXp5cpcNTyje9SKd/MAC5lQ7RCu7E993I3E8bHIGHhHQX17YVIzv+j+er46EiNDsaHzg1V5tOmBpdb5NXlzg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR11MB8441 X-OriginatorOrg: intel.com X-Spam-Status: No, score=-2.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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]); Sun, 24 Sep 2023 23:16:01 -0700 (PDT) On 2023/9/22 17:47, Robin Murphy wrote: > 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). yes. It is just what the existing domain_alloc_user op does. Here we add a hwpt_type as the type can be given by user, so we need to define a specific type for it. Perhaps we can also name it as IOMMU_HWPT_TYPE_UNMANAGED to be aligned with the domain type naming. IOMMU_HWPT_TYPE_GENERIC is also a good choice. Please feel free let me know your preference. -- Regards, Yi Liu