Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1855109rdb; Thu, 21 Sep 2023 01:09:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEZk34wvE8RYyK1j1MXLixzlfKZA2Y/YSV1UGQibfRIndOVRuEFp/ArCMszj5uU4G65HM1G X-Received: by 2002:a05:6830:c89:b0:6c4:7696:e89 with SMTP id bn9-20020a0568300c8900b006c476960e89mr2686950otb.6.1695283770482; Thu, 21 Sep 2023 01:09:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695283770; cv=none; d=google.com; s=arc-20160816; b=sMb3zQ0fvPAwltNB75FszdtU32w9XWp1RDC1tKMRw+iwV2h0nR5KPvkONY56+BRlLa wdwQE0GLMIf/P9z1BNrBJBA4HjWEWGwYaJ8DmeHDSwler6ZnvT/M+efrW7xQmrCyUVqI nFrcF2uWdbvsv9KbxpDV9VQoIxuIuoYZRMHrj2AUMp9IQBVWlPCuOXRc63bCvNeU/diA Q3jad6mRDyGDxD/p/AusEVJLGcPchED2RQYvj/NJMUYWJDVr7pYm7wdnHHV0BJJZ+l33 kJtUBstC85FB7YxBk/QX+qMaGrYUCd/XezvMxrxv2FrCIOXerLAJ1jrc2xhO/byOaNxg utNA== 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:to:content-language:subject:cc:user-agent:mime-version :date:message-id:dkim-signature; bh=m65pW7ULYHcvko9Twvle1Mza/j5elp+J+7KLsIQAUQc=; fh=lS179LuhqE/iMHKA0arBa+T8kh2JvKaIkKPzG0aFSZY=; b=WNzLl+Meb/nKbtxlgmJ46gyxQXZbnk/9gkRAp0LA6JGNB+eTHp9PKDY1NJwIBFy2sF 4gNuNC7aMQGZVXBQhtvGTO6Hw8M2g/yQVswKBCJoDrME5BYuGSHT4KnL7F3iqe5w7VDS pDoPFjfbgNz1QmgImLNo1KJVzEdELjm018D/O59VNOrIFJCYmdHdXCmyT8PuwwHowyjT ONP/4TEIbZEG5VOUBtdpdP6j19qqB12OtPcwMyQsIAyv3Mc5J4L8ojCkk8aN3yHSh9LX xJuGgZjNwhnqEvn0XTugYmlD8TbDYPrQHO7+frGXCtTwWUYXUUkCLPsjPD/i0yWteBjk ejJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=J8Y5lXIL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id t24-20020aa79398000000b00690228b1d45si872161pfe.342.2023.09.21.01.09.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 01:09:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=J8Y5lXIL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 00C4B8298B5B; Wed, 20 Sep 2023 18:35:01 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229716AbjIUBfA (ORCPT + 99 others); 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 X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,NICE_REPLY_A,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE, T_SPF_TEMPERROR,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Wed, 20 Sep 2023 18:35:01 -0700 (PDT) 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