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 A6AB0C433FE for ; Fri, 18 Mar 2022 12:01:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236018AbiCRMCd (ORCPT ); Fri, 18 Mar 2022 08:02:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232957AbiCRMCb (ORCPT ); Fri, 18 Mar 2022 08:02:31 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42A982D4D4F for ; Fri, 18 Mar 2022 05:01:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1647604871; x=1679140871; h=message-id:date:mime-version:cc:to:references:from: subject:in-reply-to:content-transfer-encoding; bh=pBffoB48lXGmhcQ4bn5CKS0U9vBbO6aigybptR2nzow=; b=TuRdTD+9U1TK32wJgGzkaqBHciLNBmxpEOq7JzqOasM+TZ3VnkCytSvw t/KPKX9SQZhh7IshhzsQiVpOBP0eEqfDav5EoFIokxRtaLE9CoastDzNb QtprtiNprGT3K8d0DC/228kQN9PPCBkZOej37siBbdd2GZKoBx35U3gZ7 JzazhzCiD+ZRuBuMKT3rr8bEq85fdnI/SEvAGBpy68J21rNVmTEgv0i3r OdRCuEvK/Iz0ODYSfzbhMjfRiy3d8nUyQ4jfaMnzCI7Rbj0ARXvb8bXzm DnCy0R6fvuniq4jUjSmeNGHwSKn6BSxunpvw+CmwDOejUaQDkmE64L/tT g==; X-IronPort-AV: E=McAfee;i="6200,9189,10289"; a="255948136" X-IronPort-AV: E=Sophos;i="5.90,192,1643702400"; d="scan'208";a="255948136" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2022 05:01:10 -0700 X-IronPort-AV: E=Sophos;i="5.90,192,1643702400"; d="scan'208";a="558405336" Received: from blu2-mobl3.ccr.corp.intel.com (HELO [10.254.215.248]) ([10.254.215.248]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2022 05:01:06 -0700 Message-ID: Date: Fri, 18 Mar 2022 20:01:04 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Cc: baolu.lu@linux.intel.com, "iommu@lists.linux-foundation.org" , LKML , Joerg Roedel , Jason Gunthorpe , Christoph Hellwig , Jean-Philippe Brucker , "Pan, Jacob jun" , "Raj, Ashok" , "Kumar, Sanjay K" , "Jiang, Dave" , "Luck, Tony" , "Zanussi, Tom" , "Williams, Dan J" , "Liu, Yi L" Content-Language: en-US To: "Tian, Kevin" , Jean-Philippe Brucker , Jacob Pan References: <20220315050713.2000518-1-jacob.jun.pan@linux.intel.com> <20220315050713.2000518-3-jacob.jun.pan@linux.intel.com> From: Lu Baolu Subject: Re: [PATCH v2 2/8] iommu: Add attach/detach_dev_pasid domain ops In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022/3/15 19:49, Tian, Kevin wrote: >> From: Jean-Philippe Brucker >> Sent: Tuesday, March 15, 2022 7:27 PM >> >> On Mon, Mar 14, 2022 at 10:07:06PM -0700, Jacob Pan wrote: >>> From: Lu Baolu >>> >>> An IOMMU domain represents an address space which can be attached by >>> devices that perform DMA within a domain. However, for platforms with >>> PASID capability the domain attachment needs be handled at device+PASID >>> level. There can be multiple PASIDs within a device and multiple devices >>> attached to a given domain. >>> This patch introduces a new IOMMU op which support device, PASID, and >>> IOMMU domain attachment. The immediate use case is for PASID capable >>> devices to perform DMA under DMA APIs. >>> >>> Signed-off-by: Lu Baolu >>> Signed-off-by: Jacob Pan >>> --- >>> include/linux/iommu.h | 6 ++++++ >>> 1 file changed, 6 insertions(+) >>> >>> diff --git a/include/linux/iommu.h b/include/linux/iommu.h >>> index 369f05c2a4e2..fde5b933dbe3 100644 >>> --- a/include/linux/iommu.h >>> +++ b/include/linux/iommu.h >>> @@ -227,6 +227,8 @@ struct iommu_iotlb_gather { >>> * @aux_get_pasid: get the pasid given an aux-domain >>> * @sva_bind: Bind process address space to device >>> * @sva_unbind: Unbind process address space from device >>> + * @attach_dev_pasid: attach an iommu domain to a pasid of device >>> + * @detach_dev_pasid: detach an iommu domain from a pasid of device >> Isn't that operation "assign a PASID to a domain" instead? In patch 5, >> the domain is already attached to the device, so set_domain_pasid() might >> be clearer and to the point. If the IOMMU driver did the allocation we >> could also avoid patch 1. > iiuc this API can also work for future SIOV usage where each mdev attached > to the domain has its own pasid. "assigning a PASID to a domain" sounds > like going back to the previous aux domain approach which has one PASID > per domain and that PASID is used on all devices attached to the aux domain... > This also works for SVA as far as I can see. The sva_bind essentially is to attach an SVA domain to the PASID of a device. The sva_bind/unbind ops could be removed with these two new callbacks. Best regards, baolu 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 smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E1AF6C433EF for ; Fri, 18 Mar 2022 12:01:16 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 7BABF419BD; Fri, 18 Mar 2022 12:01:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WGzoFt4XiVl1; Fri, 18 Mar 2022 12:01:15 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id 416DC4154D; Fri, 18 Mar 2022 12:01:15 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0DD93C0033; Fri, 18 Mar 2022 12:01:15 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 4C850C0012 for ; Fri, 18 Mar 2022 12:01:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 28D9C40545 for ; Fri, 18 Mar 2022 12:01:13 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp2.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=intel.com Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id K4M-eTkaM--V for ; Fri, 18 Mar 2022 12:01:11 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by smtp2.osuosl.org (Postfix) with ESMTPS id ADED840474 for ; Fri, 18 Mar 2022 12:01:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1647604871; x=1679140871; h=message-id:date:mime-version:cc:to:references:from: subject:in-reply-to:content-transfer-encoding; bh=pBffoB48lXGmhcQ4bn5CKS0U9vBbO6aigybptR2nzow=; b=TuRdTD+9U1TK32wJgGzkaqBHciLNBmxpEOq7JzqOasM+TZ3VnkCytSvw t/KPKX9SQZhh7IshhzsQiVpOBP0eEqfDav5EoFIokxRtaLE9CoastDzNb QtprtiNprGT3K8d0DC/228kQN9PPCBkZOej37siBbdd2GZKoBx35U3gZ7 JzazhzCiD+ZRuBuMKT3rr8bEq85fdnI/SEvAGBpy68J21rNVmTEgv0i3r OdRCuEvK/Iz0ODYSfzbhMjfRiy3d8nUyQ4jfaMnzCI7Rbj0ARXvb8bXzm DnCy0R6fvuniq4jUjSmeNGHwSKn6BSxunpvw+CmwDOejUaQDkmE64L/tT g==; X-IronPort-AV: E=McAfee;i="6200,9189,10289"; a="254676596" X-IronPort-AV: E=Sophos;i="5.90,192,1643702400"; d="scan'208";a="254676596" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2022 05:01:11 -0700 X-IronPort-AV: E=Sophos;i="5.90,192,1643702400"; d="scan'208";a="558405336" Received: from blu2-mobl3.ccr.corp.intel.com (HELO [10.254.215.248]) ([10.254.215.248]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2022 05:01:06 -0700 Message-ID: Date: Fri, 18 Mar 2022 20:01:04 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Content-Language: en-US To: "Tian, Kevin" , Jean-Philippe Brucker , Jacob Pan References: <20220315050713.2000518-1-jacob.jun.pan@linux.intel.com> <20220315050713.2000518-3-jacob.jun.pan@linux.intel.com> From: Lu Baolu Subject: Re: [PATCH v2 2/8] iommu: Add attach/detach_dev_pasid domain ops In-Reply-To: Cc: "Luck, Tony" , "Jiang, Dave" , "Raj, Ashok" , "Zanussi, Tom" , "Kumar, Sanjay K" , LKML , Christoph Hellwig , "iommu@lists.linux-foundation.org" , "Pan, Jacob jun" , Jason Gunthorpe , "Williams, Dan J" , Jean-Philippe Brucker X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On 2022/3/15 19:49, Tian, Kevin wrote: >> From: Jean-Philippe Brucker >> Sent: Tuesday, March 15, 2022 7:27 PM >> >> On Mon, Mar 14, 2022 at 10:07:06PM -0700, Jacob Pan wrote: >>> From: Lu Baolu >>> >>> An IOMMU domain represents an address space which can be attached by >>> devices that perform DMA within a domain. However, for platforms with >>> PASID capability the domain attachment needs be handled at device+PASID >>> level. There can be multiple PASIDs within a device and multiple devices >>> attached to a given domain. >>> This patch introduces a new IOMMU op which support device, PASID, and >>> IOMMU domain attachment. The immediate use case is for PASID capable >>> devices to perform DMA under DMA APIs. >>> >>> Signed-off-by: Lu Baolu >>> Signed-off-by: Jacob Pan >>> --- >>> include/linux/iommu.h | 6 ++++++ >>> 1 file changed, 6 insertions(+) >>> >>> diff --git a/include/linux/iommu.h b/include/linux/iommu.h >>> index 369f05c2a4e2..fde5b933dbe3 100644 >>> --- a/include/linux/iommu.h >>> +++ b/include/linux/iommu.h >>> @@ -227,6 +227,8 @@ struct iommu_iotlb_gather { >>> * @aux_get_pasid: get the pasid given an aux-domain >>> * @sva_bind: Bind process address space to device >>> * @sva_unbind: Unbind process address space from device >>> + * @attach_dev_pasid: attach an iommu domain to a pasid of device >>> + * @detach_dev_pasid: detach an iommu domain from a pasid of device >> Isn't that operation "assign a PASID to a domain" instead? In patch 5, >> the domain is already attached to the device, so set_domain_pasid() might >> be clearer and to the point. If the IOMMU driver did the allocation we >> could also avoid patch 1. > iiuc this API can also work for future SIOV usage where each mdev attached > to the domain has its own pasid. "assigning a PASID to a domain" sounds > like going back to the previous aux domain approach which has one PASID > per domain and that PASID is used on all devices attached to the aux domain... > This also works for SVA as far as I can see. The sva_bind essentially is to attach an SVA domain to the PASID of a device. The sva_bind/unbind ops could be removed with these two new callbacks. Best regards, baolu _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu