From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B32ECD493B for ; Thu, 21 Sep 2023 01:34:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229718AbjIUBfA (ORCPT ); Wed, 20 Sep 2023 21:35:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229473AbjIUBe6 (ORCPT ); Wed, 20 Sep 2023 21:34:58 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3B59AB; Wed, 20 Sep 2023 18:34:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695260088; x=1726796088; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=+bidcrUQSX3/sahN7fs73gHIxO3mCixzrWi3NOAA3ag=; b=J8Y5lXIL9O/ipF0BseqodRfvaM7ZmRftXqt4jQjXFiozycfRmd2TXnw9 aw2VzKQvDSGqUpW/dXYdZF0yA5R1IB6dSU/mr7N54TaEU/aQVcsqgFgXO VqpT/e1IteeUDj4z8Bk4OUA1q589UEdFXB7lYv1eEjxjf4Sj5Phop6LJM 6SyPtkoD80eq2S3istwQwQiYvxXqVI06LZ+TbIABsmoKFElygwGC5e9zi Gq7q8aH44qS66Bb3Kow976W7kDntdRmTFLjrVlKGrgWBQkqa7OZoWhq3l tkY68Jp5aLkWJa192inWsg/lkjjsBdT0zsn1S7uJoAIRTVx5CHR9qOkiv Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="359773166" X-IronPort-AV: E=Sophos;i="6.03,162,1694761200"; d="scan'208";a="359773166" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2023 18:34:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="723540733" X-IronPort-AV: E=Sophos;i="6.03,162,1694761200"; d="scan'208";a="723540733" Received: from allen-box.sh.intel.com (HELO [10.239.159.127]) ([10.239.159.127]) by orsmga006.jf.intel.com with ESMTP; 20 Sep 2023 18:34:35 -0700 Message-ID: Date: Thu, 21 Sep 2023 09:31:27 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Cc: baolu.lu@linux.intel.com, "joro@8bytes.org" , "alex.williamson@redhat.com" , "Tian, Kevin" , "robin.murphy@arm.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" , "Duan, Zhenzhong" , "Martins, Joao" Subject: Re: [PATCH 6/6] iommu/vt-d: Add domain_alloc_user op Content-Language: en-US To: "Liu, Yi L" , Jason Gunthorpe References: <20230919092523.39286-1-yi.l.liu@intel.com> <20230919092523.39286-7-yi.l.liu@intel.com> <7aa8fd9e-e43d-db68-bdb6-fe4f891255ca@linux.intel.com> <20230920130522.GV13733@nvidia.com> From: Baolu Lu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On 9/20/23 9:10 PM, Liu, Yi L wrote: >>>> + >>>> + domain = iommu_domain_alloc(dev->bus); >>> No need to bounce between core and driver. Just, >>> >>> intel_iommu_domain_alloc(IOMMU_DOMAIN_UNMANAGED); >>> >>> and fully initialize it before return. >> If you are going to do that then intel_iommu_domain_alloc() should >> fully initialize the domain, not here. > I've also considered what Baolu described, but it requires to do some > extra initialization which is duplicated with iommu_domain_alloc(). > So I chose this simple way. Okay, got you. Once Jason's paging domain and Robin's bus->iommu_ops retirement series have landed, the VT-d driver will need some refactoring. Therefore, I'm fine with you using a simpler approach here. I'll refactor everything later. Best regards, baolu