Received: by 2002:a19:651b:0:0:0:0:0 with SMTP id z27csp5081265lfb; Tue, 10 May 2022 22:08:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyz3Dbvs3HJHMEUSQAdsoY+2VZw1tBLGR4SsElX4/AgEuQe39Bt1RloVLjs0JQgcUWfRv/9 X-Received: by 2002:a17:903:1c2:b0:15e:c623:b518 with SMTP id e2-20020a17090301c200b0015ec623b518mr23265915plh.158.1652245691142; Tue, 10 May 2022 22:08:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652245691; cv=none; d=google.com; s=arc-20160816; b=FXEmny7gGYp5wywVoZkm+Jy4VfFRLOzOEqJVnuub90vlGVeXsFIXIAVfkyNFsTUgLZ eWaGnOcNp05g03dTe01pPOvO3BEDgrXHiRdaUf4VhrP6IefylNKokN8ccBZpVHslgx5y tyYC7hMmPIdB2KUhw9IM6xX0pSv7Qb4lxTdMhwxWaDawXWwkgPGjEPF3K1NCukWBi2hU 768Gid/MI2/vSDUVBHSF8HCRUlaaCgkoZT7PhUImeksUHqUe4FjNztAQQN9tuuLlLXoA R9NXhsQ/RKHv2D5G8at6/SXyGkHTvV95N8xbBW+3Kuj9lj98ZqMBtS7edgvHdLJmjXEr LYFQ== 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:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=/2faAw23pc1gT44Y6suq9Jdfg1epV2Ffia/n8z9OsSE=; b=wshmY9PJJ6Ccw4oBxIB+4MUAhNoUMrJDTC3GVf1GZsmb3lWifXsLaogfYlhkbARZCN LOa0ExNqg1LBEEfNzdJCrU1CImcMxX4cGmmrxKZyVZgNH0KpettlScqzkJhC4vTIKqbL xKQy2wPN2BnxVad1fMkZfrP9kpjNBGIuC0jTQWUW6Ae2zdEKiucSTFact1CVVj19QV9L YOKdrnXp3hjYgXZosoHm7XIxvsETEqZxRLAuAappfeTd5NUu5SCZLECY+m+ZfQkPBx5x 0D+sgDK49oNwdH+6la78KTODR0ao6PV+lVty2qlwWfEwlSbXteTj5Z44FE1WaShJTKbr Fddw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=alOC50RR; 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 n3-20020a170903110300b0015826677457si1414500plh.354.2022.05.10.22.07.58; Tue, 10 May 2022 22:08:11 -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=alOC50RR; 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 S241604AbiEKCcu (ORCPT + 99 others); Tue, 10 May 2022 22:32:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240221AbiEKCcW (ORCPT ); Tue, 10 May 2022 22:32:22 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E19B645C for ; Tue, 10 May 2022 19:32:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652236341; x=1683772341; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=GD5SNKppixG33DS3SuVjSEMLGzo8y1WE3tk191fvhtc=; b=alOC50RR4mD98r0zJdAibwsQcayOGH30NnrSqHa/wJdQZXXsLRqT5+Di FXwGZ/1bpvHPRSPkLy0z9FIfbHMIeIYLROGFV0ZoiRVckj9JQanMEawgV knMNH1SQRzU4jeLjZo11+44hOxSLa0mUsFmE+SSKVb6JeH1TQthicKYZJ UAmXjpKIg3rlzRbT5+N97311Rfr/lALP6XHksYuJ7lpIsCYOleK+LlX7K P95+4aCei0JB4xnmEth0tA3RQl7R248KLaPGcvtnR45uiYb2NrONCuw/P Xg313bJwUsVrGRakYXNWNheV3zNlCkMgHfxcHscCZ+TlfTTHIpCghyrB5 g==; X-IronPort-AV: E=McAfee;i="6400,9594,10343"; a="332596964" X-IronPort-AV: E=Sophos;i="5.91,215,1647327600"; d="scan'208";a="332596964" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2022 19:32:20 -0700 X-IronPort-AV: E=Sophos;i="5.91,215,1647327600"; d="scan'208";a="542093731" Received: from chenji3x-mobl1.ccr.corp.intel.com (HELO [10.255.30.10]) ([10.255.30.10]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2022 19:32:16 -0700 Message-ID: Date: Wed, 11 May 2022 10:32:14 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH v6 03/12] iommu: Add attach/detach_dev_pasid domain ops Content-Language: en-US To: Jason Gunthorpe Cc: Joerg Roedel , Christoph Hellwig , Kevin Tian , Ashok Raj , Will Deacon , Robin Murphy , Jean-Philippe Brucker , Dave Jiang , Vinod Koul , Eric Auger , Liu Yi L , Jacob jun Pan , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Jean-Philippe Brucker References: <20220510061738.2761430-1-baolu.lu@linux.intel.com> <20220510061738.2761430-4-baolu.lu@linux.intel.com> <20220510140238.GD49344@nvidia.com> From: Baolu Lu In-Reply-To: <20220510140238.GD49344@nvidia.com> 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,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 On 2022/5/10 22:02, Jason Gunthorpe wrote: > On Tue, May 10, 2022 at 02:17:29PM +0800, Lu Baolu wrote: > >> This adds a pair of common domain ops for this purpose and adds helpers >> to attach/detach a domain to/from a {device, PASID}. > > I wonder if this should not have a detach op - after discussing with > Robin we can see that detach_dev is not used in updated > drivers. Instead attach_dev acts as 'set_domain' > > So, it would be more symmetrical if attaching a blocking_domain to the > PASID was the way to 'detach'. > > This could be made straightforward by following the sketch I showed to > have a static, global blocing_domain and providing a pointer to it in > struct iommu_ops > > Then 'detach pasid' is: > > iommu_ops->blocking_domain->ops->attach_dev_pasid(domain, dev, pasid); > > And we move away from the notion of 'detach' and in the direction that > everything continuously has a domain set. PASID would logically > default to blocking_domain, though we wouldn't track this anywhere. I am not sure whether we still need to keep the blocking domain concept when we are entering the new PASID world. Please allow me to wait and listen to more opinions. Best regards, baolu