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 951D5C636D3 for ; Fri, 3 Feb 2023 02:35:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231624AbjBCCfM (ORCPT ); Thu, 2 Feb 2023 21:35:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229575AbjBCCfL (ORCPT ); Thu, 2 Feb 2023 21:35:11 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9187C1A945; Thu, 2 Feb 2023 18:35:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675391710; x=1706927710; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=iod8J9etbm7Ci1/s59zXc4sCIyKrpNgCrTwFA48/dcw=; b=JkTsig6koV+IJeBtG3CdfRk9qjCV0Hwcw0N5H9Jqx9cYO4Jq64SviyEd WUG3Sp/Bd74e3QrwyiRusD3gFOPOOvS1uFqo2oWiWPv60KnggH+J3l+dM IRcsGXvaS9iJAqUDgRPWKdvlQKNqBMD2IuGdfcD13/i+9EGa+pRt0gsta OL9+TLwWQCXUEmdGercaK3IbA+AAmNlM0o4EFWz8mLr5ov9v2ii7flFy3 WT6zzq6xtPdnQ682cD18wLPLG/6qCljU70NVH4oWAU18kUWsG2Sgv6RPf UoHPPN6Gjq6HysboW3z9fSZPGWn4n4ZYRrcoDfSoqurjdyLjswoYTiGOK w==; X-IronPort-AV: E=McAfee;i="6500,9779,10609"; a="329924203" X-IronPort-AV: E=Sophos;i="5.97,269,1669104000"; d="scan'208";a="329924203" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2023 18:35:09 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10609"; a="774139664" X-IronPort-AV: E=Sophos;i="5.97,269,1669104000"; d="scan'208";a="774139664" Received: from blu2-mobl.ccr.corp.intel.com (HELO [10.254.208.253]) ([10.254.208.253]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2023 18:35:06 -0800 Message-ID: Date: Fri, 3 Feb 2023 10:35:04 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Cc: baolu.lu@linux.intel.com, jgg@nvidia.com, kevin.tian@intel.com, joro@8bytes.org, will@kernel.org, robin.murphy@arm.com, alex.williamson@redhat.com, shuah@kernel.org, yi.l.liu@intel.com, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH v1 2/8] iommu: Introduce a new iommu_group_replace_domain() API Content-Language: en-US To: Nicolin Chen References: <58837041-c0ea-2c65-4ed5-6b2d2189415e@linux.intel.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 2023/2/3 9:41, Nicolin Chen wrote: > On Fri, Feb 03, 2023 at 09:33:44AM +0800, Baolu Lu wrote: >> External email: Use caution opening links or attachments >> >> >> On 2023/2/3 3:14, Nicolin Chen wrote: >>> On Thu, Feb 02, 2023 at 06:21:20PM +0800, Baolu Lu wrote: >>>> External email: Use caution opening links or attachments >>>> >>>> >>>> On 2023/2/2 15:05, Nicolin Chen wrote: >>>>> +/** >>>>> + * iommu_group_replace_domain - replace the domain that a group is attached to >>>>> + * @new_domain: new IOMMU domain to replace with >>>>> + * @group: IOMMU group that will be attached to the new domain >>>>> + * >>>>> + * This API allows the group to switch domains without being forced to go to >>>>> + * the blocking domain in-between. >>>>> + * >>>>> + * If the attached domain is a core domain (e.g. a default_domain), it will act >>>>> + * just like the iommu_attach_group(). >>>> I am not following above two lines. Why and how could iommufd set a >>>> core domain to an iommu_group? >>> Perhaps this isn't the best narrative. What it's supposed to say >>> is that this function acts as an iommu_attach_group() call if the >>> device is "detached", yet we have changed the semantics about the >>> word "detach". So, what should the correct way to write such a >>> note? >> How could this interface be used as detaching a domain from a group? >> Even it could be used, doesn't it act as an iommu_detach_group()? > No. I didn't say that. It doesn't act as detach(), but attach() > when a device is already "detached". > > The original statement is saying, "if the attached domain is a > core domain", i.e. the device is detach()-ed, "it will act just > like the iommu_attach_group()". Oh! My bad. I misunderstood it. Sorry for the noise. :-) Best regards, baolu