Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2365904pxp; Fri, 18 Mar 2022 09:05:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5e+wz30G+93NKy0TplaruSXMkeW2S2ABhTSo0dRId69/f1gDX8bZyOGeN+O+QznHoPfQN X-Received: by 2002:a05:6a00:1824:b0:4f6:dc69:227e with SMTP id y36-20020a056a00182400b004f6dc69227emr10998470pfa.58.1647619504791; Fri, 18 Mar 2022 09:05:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647619504; cv=none; d=google.com; s=arc-20160816; b=IFkY7ian1RVwGVrZ2zl+G0aes1HdOWMD9sqMyyTIeJetwWG+3vwwpnKSAqfPH9mugV eKUteAnFKlEuEymVvNVXnDfwa2Flkaqa6c8iq3GspEZop7BtcUsq/eOUUN2JCTPgGl0p aT3wgQ4416QGls9L5S4wXf61RDpX4n9yAh/0q4xQhBxV/Z3ypRrYCzp10bt46G5knHG/ A+J9T2pvcX12e5woYxXyH0TPNgcufUNdteC5h/pH9RY52SR53Z+pMBU9mN6Tt4xwhiMv gQlyhBVwY0xqPKERTl9mUzdpXAHZVWnMuqSovZ5TwU9TGPl3HTCX8QPH+A3/ojn9uAkj ZwjQ== 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:subject :from:references:to:content-language:cc:user-agent:mime-version:date :message-id:dkim-signature; bh=Oz0vBId6UoN9lLH+nInq7HpfVFxCnP0yvQX+Cfarvys=; b=yxBlrHLx7grzX24vpyT4sR3N+UH2ezYtVFgOVkYt/rbwLeuLKGYkTqEt/bkqKwxnSy eAoUd72FSMIWoLLpFIMEIMoM6i1ExcJs07HTjixoV09+v64ifZrD53hcvAOwpvyx4G4o T5dhQyu22ljVOszoBlHtNoIj0GS7ELp5Mnz3FstHQt4zirIjAJHfdq77lu0vfET2lROi t7wgKDHSCpC+m2gjQvhji/HjEgVhfBVODTU119oRwgMHekeIWg+2PNZn1JvCqo/1igEB 3+4Y1hee1Z7N0LfLRAlMzkhGNsqOlT1qV4YUl7d+Rtwpw5mXqJKLRKBcfuCfVSt/wEsW PYNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=TuRdTD+9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k16-20020a170902761000b00153b2d165f8si2270486pll.512.2022.03.18.09.04.50; Fri, 18 Mar 2022 09:05:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=TuRdTD+9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235716AbiCRMCc (ORCPT + 99 others); Fri, 18 Mar 2022 08:02:32 -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 X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 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