Received: by 2002:ac8:5491:0:b0:40f:fb00:664b with SMTP id h17csp638013qtq; Thu, 10 Aug 2023 11:15:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFEHYKe39J5FemROxSI/tkTFqZTj+1URLFKW1Hvl3tXknpbX7rLB71lVKfe7Oo7dhXSn9oW X-Received: by 2002:a05:6512:2351:b0:4fe:e8f:e216 with SMTP id p17-20020a056512235100b004fe0e8fe216mr3281525lfu.39.1691691358501; Thu, 10 Aug 2023 11:15:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691691358; cv=none; d=google.com; s=arc-20160816; b=tMYS8Y98OUEim4Gb9+8yHLwNsexQRwu6MMZ4jXpgI6qMUX0+DiXiLl1CiQD/1cANEa sXghsSmFBJcqax2JWowkOSjB5HibUQ7mwHUqy1rGUyQ16EekWyl7VNcIoCGO3tyonuqb OLT6wCBm4EOaFGB/18AVNpQjzwOunRn8nyKYUxUlqHs1qPEWI3G7TRKEg7m4ClqkugjI NwcZz4IzkU1HbO4+e6MCYMt2rZWeRTRGlF1zjRUUV19D1SMirapOI6Pj4N5nbGkRQB0O XV1FOuWFcdWczdrjzpAmd/WpZqIbT1n2BpNiaDmoX1KTUkrlm9HcVJutyefr/mOaZjAi Zm+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=BwRQL+AWUvKim0GQsGEOotK3a8TzoberHriHLEkkia4=; fh=nTYPeqy2DFkr2QDks3SiJip/4EOM6Ovzp/F19Yb3i+g=; b=PDAfoH9SQKpRuynwR5ixa+AAZW0IKzWCgfOiobhzO1qJAmWgNRsDZfFwZQ353CNhov rvzL0RO6ak8E4BNXwitAQ/e2BKLYaVXJDYubTA+n4AGg0Aw91xEfU6Al5NERrC2ftPWr g0YHT9COtkGZDxEsnNdoi6h2DEaiu/E4vC/p3ixx9XcCJSnUzL/7xNru8fiiP7RsM6e8 UHl65fe3CX9+6v75YCR+ajUEW0sC379XU1vfPIUqK73Q24TpBfwVb/v0tMdu+MH4ek3d oAxQ6mwU1Lmii+Bg/k/tgVY2YNgZzvr5xBOS7ygfLcorLmpTAfLvBiqdEenpAE9Q3v4X xYyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=mzJNdH7j; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m17-20020a50ef11000000b005236b763595si1894299eds.458.2023.08.10.11.15.33; Thu, 10 Aug 2023 11:15:58 -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=@ziepe.ca header.s=google header.b=mzJNdH7j; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233180AbjHJQav (ORCPT + 99 others); Thu, 10 Aug 2023 12:30:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231358AbjHJQau (ORCPT ); Thu, 10 Aug 2023 12:30:50 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF63FC5 for ; Thu, 10 Aug 2023 09:30:49 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1bc6535027aso9710745ad.2 for ; Thu, 10 Aug 2023 09:30:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1691685049; x=1692289849; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=BwRQL+AWUvKim0GQsGEOotK3a8TzoberHriHLEkkia4=; b=mzJNdH7j3KXWCdbERyami1eWUZrwE1hCaBSAo2i2Oto6L8ZP39PhBlRnCfAsbbulgv eWCxmIW+10HSi6CFKRHF3Zs2BZo7EHHSnVqypjjcyFCCaEyu64D9xJ8wpGX/uEH8Ma6O y8LsxBXxMvGK/y1/PHiUlqtc/WXJFgih0Q1E9W43g/xd5E51ZDLkuveYyZZNgVqpBL2t a4IJ/+dyfJkqZAiec1G/jo9wG4imwZCXdQn/yDJVlhdzVL83GMHz0pId5BEMkLS6qEEj ZeTFSEhHNiApWuGK31f60wQ3Fjjct7i8IniyRZOSpLnmyRyeQe9X5tZZtt6RYeJiWbZP +4Zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691685049; x=1692289849; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=BwRQL+AWUvKim0GQsGEOotK3a8TzoberHriHLEkkia4=; b=gPyWPaE+aRA8uERNuE/87tM20EMVfNlsoBMwFJoBjF/szDrvAuL9OAvWyxpttKTNFE 1l++Q8GpLnWw4D/rLBDz75OXUwJwuFjmioPqbGlniqOSIfBTH1gWjynKzSNsLGjEE35R qwvVPgR91Uh3FtZZ180knA0QnNkgp6EXqIDIPgz5lSsyMKGQLyF+Hd9+cx+oTEMNbyoD fg5eTc4k3IGL/YyvQdZStIJ8+tm8IxNatNlrvSY4OOkSwZJe7M/8J7K+tyz5bsquzs2q BN9GKsDoDCfRFsspLq0EIfF0BRHhf+Pt20T5200UFvxb/6GzlUGg3MJ98MESARnvisdl 4bxg== X-Gm-Message-State: AOJu0YzkuOrbmArd8hjUq5TDRIsGbK8iEfc1X/iLFY72wH7ZKClR1zeH jrwYoKGN2Eq0EIC0G1oKgp8mE+f8TtYZdTew1eE= X-Received: by 2002:a17:903:32c8:b0:1bb:9b29:20d9 with SMTP id i8-20020a17090332c800b001bb9b2920d9mr3723397plr.20.1691685049135; Thu, 10 Aug 2023 09:30:49 -0700 (PDT) Received: from ziepe.ca ([206.223.160.26]) by smtp.gmail.com with ESMTPSA id q3-20020a170902788300b001bbd8cf6b57sm1980870pll.230.2023.08.10.09.30.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Aug 2023 09:30:48 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1qU8Yh-005Gyn-01; Thu, 10 Aug 2023 13:30:47 -0300 Date: Thu, 10 Aug 2023 13:30:46 -0300 From: Jason Gunthorpe To: Baolu Lu Cc: "Tian, Kevin" , "Zhang, Tina" , Michael Shavit , "iommu@lists.linux.dev" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 2/5] iommu: Call helper function to get assigned pasid value Message-ID: References: <20230808074944.7825-1-tina.zhang@intel.com> <20230808074944.7825-3-tina.zhang@intel.com> <84494c88-66eb-a731-fbf0-4a83fb9102f1@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <84494c88-66eb-a731-fbf0-4a83fb9102f1@linux.intel.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS 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 Thu, Aug 10, 2023 at 09:37:09AM +0800, Baolu Lu wrote: > > The core could put the mm_notifier in a common iommu_domain_sva struct > > and it could stick in the driver's invalidate ops, that would be a > > nice simplification (and discourage drivers from doing the crazy > > things they are currently doing) > > Yes. So the iommu driver can retrieve the sva domain from struct > mmu_notifier. The callback implementation will still be domain centric. > Hence, there will be no need to use mm. Remember the driver always needs the mm as it has to extract the page table address from it. At the end of the day installing the notifier is a single call in the SVA alloc op, so it may not be worth optimizing beyond allowing drivers to do it in their SVA alloc op. Jason