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 4F85EC61DA4 for ; Mon, 6 Mar 2023 19:01:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229681AbjCFTBf (ORCPT ); Mon, 6 Mar 2023 14:01:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229873AbjCFTBd (ORCPT ); Mon, 6 Mar 2023 14:01:33 -0500 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B1F75653E; Mon, 6 Mar 2023 11:01:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678129268; x=1709665268; h=date:from:to:cc:subject:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yrqs2zzNZs4rk995C3e1KJ/BxQPhG0SO/C+asiFrH3k=; b=gznB28YqcCJY/WMmSqn7DWDa8CUSOI7BCZ6B5E8R+UJMD9EvXNvubf56 r815l4xHaIfrSYjJzko2M00y3E3CYRTcW5uCDtO3veUse9AfxFoqbhOP4 VvuKD6fmMMXzgiskV1zUTV4iqfNnm1/9vKAeNrMEwlUx7upFV43lASX2X VhWKHDiORYgqrXm3UrC1uKh346h5+wLCO7yYzJYB/riMiVGSpYcK1Neyv pa78zUiJDi7+7edbSoEYp38OJI6Hgvk0QNRS2UVU44ZYENNnjfTRCwBk8 4AqxM7LOeMntaN5AhhPdLQy62NKv2fKOZ6sgbERlcD/RH4miY2J3yOtTK A==; X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="337969362" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="337969362" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2023 11:00:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10641"; a="708763645" X-IronPort-AV: E=Sophos;i="5.98,238,1673942400"; d="scan'208";a="708763645" Received: from jacob-builder.jf.intel.com (HELO jacob-builder) ([10.24.100.114]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2023 11:00:52 -0800 Date: Mon, 6 Mar 2023 11:04:43 -0800 From: Jacob Pan To: "Tian, Kevin" Cc: Baolu Lu , LKML , "iommu@lists.linux.dev" , Jason Gunthorpe , Joerg Roedel , "dmaengine@vger.kernel.org" , "vkoul@kernel.org" , Robin Murphy , Will Deacon , "David Woodhouse" , "Raj, Ashok" , "Liu, Yi L" , "Yu, Fenghua" , "Jiang, Dave" , "Luck, Tony" , "Zanussi, Tom" , jacob.jun.pan@linux.intel.com Subject: Re: [PATCH 1/4] iommu/vt-d: Implement set device pasid op for default domain Message-ID: <20230306110443.4ca52204@jacob-builder> In-Reply-To: References: <20230302005959.2695267-1-jacob.jun.pan@linux.intel.com> <20230302005959.2695267-2-jacob.jun.pan@linux.intel.com> <2c9115d0-f251-c284-63d6-73714edc96b4@linux.intel.com> <7f8983c8-b703-4960-67b5-97f4053329db@linux.intel.com> Organization: OTC X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org Hi Kevin, On Fri, 3 Mar 2023 05:35:58 +0000, "Tian, Kevin" wrote: > > From: Baolu Lu > > Sent: Friday, March 3, 2023 12:38 PM > > > > On 3/3/23 11:02 AM, Tian, Kevin wrote: > > >> From: Baolu Lu > > >> Sent: Friday, March 3, 2023 10:49 AM > > >> > > >> On 3/3/23 10:36 AM, Tian, Kevin wrote: > > >>>> From: Baolu Lu > > >>>> Sent: Thursday, March 2, 2023 10:07 PM > > >>>>> + > > >>>>> + if (!sm_supported(iommu) || !info) > > >>>> > > >>>> @info has been referenced. !info check makes no sense. > > >>>> > > >>>> Add pasid_supported(iommu). > > >>>> > > >>>> Do you need to check whether the domain is compatible for this rid > > >>>> pasid? > > >>> > > >>> what kind of compatibility is concerned here? In concept a pasid > > >>> can be attached to any domain if it has been successfully attached > > >>> to rid. Probably we can add a check here that RID2PASID must > > >>> point to the domain already. > > >> > > >> "...if it has been successfully attached to rid..." > > >> > > >> We should not have this assumption in iommu driver's callback. The > > iommu > > >> driver has no (and should not have) knowledge about the history of > > >> any domain. > > > > > > but this is an op for default domain which must have been attached > > > to RID2PASID and any compatibility check between this domain and > > > device should be passed. > > > > This is an op for DMA, DMA-FQ and UNMANAGED domain. The IOMMU > > driver > > doesn't need to interpret the default domain concept. :-) > > > > yes if we target a general callback for all those domain types. > > and probably this is the right thing to do as in the end DMA type will > be removed with Jason's cleanup so, let me recap. set_dev_pasid() should make no assumptions of ordering, i.e. it is equal to iommu_domain_ops.attach_dev(). It will be kind of the same as Baolu's old patch https://lore.kernel.org/linux-iommu/20220614034411.1634238-1-baolu.lu@linux.intel.com/ Thanks, Jacob