Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp5584711rwb; Wed, 9 Aug 2023 06:28:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHDne3zTUg29OM+472r/sD+vXy8V7tfDfPNXX79rRPbk/lJRUYFHjVGQUuO1kxUCXtK/y6P X-Received: by 2002:a05:6512:32d0:b0:4fd:fedc:2ce5 with SMTP id f16-20020a05651232d000b004fdfedc2ce5mr1819591lfg.36.1691587709206; Wed, 09 Aug 2023 06:28:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691587709; cv=none; d=google.com; s=arc-20160816; b=JIWUMnYvGMTUndBeNH9n2OKQIHlzwQ9R1ela5a9oUWlPfXcM+ykUb21YcZQdEqEN9i 5bZtLpezC9BknxKGv/P7Xt4MoF34XgZa8sbgZ/HCwcltKEqLdFzY+domjSNgN8YG15kH C03uczLARQ6sFsxGzhXHPByvPolc3niOzxkt7bnBpNcg6riSlMEZZfssAmSLkktoN1i/ YyxQglfEu/IKprEgROnIbaKueU1AYkSrPnS1QperUXDBWpPOl0+Ir9WWduCU2Tm/WGxv uPwSQRR47BaWpa6lUTx4H2v9A2khWmqQthfULrSe06t3pbuQi+P0S4RmlbxVTGDvTKZv CfbA== 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=D1vlk426yx9I7RvL78AONvP5VHRKVeaBopr8pvsM2ew=; fh=0Jh+9DZqN486JafHeiLZubsLsIbZMVHDlSbp6+SPBGs=; b=hMxCG/twHBOUp4oiiDm2fx51Csotoz+/xaHKSYvjMaYv0uPsHrS/IXbIgZqhmLj0hJ FYnMIsOc4JGeYiDYSIoOndMJu+8BS/qYE1uSiIhDlGWmi4m1zLZr+FGjd89isGEM4Vsk O2UMaKvUP6rs9raJNWsY+Qa3bA1gcHdI1LrQd8bZuXVZJtHTmrTOJjcPzGjsamrV6bEg A9lnxhk8gV15jXdnA8lZhaQI0+cw0CcSJcbQhazOhmQGGK+FoXSlr3fPM+3VWB35PoS6 p+CeKBgDu63zk0VPadZ7zhr2ooa/KkvFdRGLJ5g+7PX4WQ848aCUHEtq1dzDVP0oTdOS oyDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=kZqvQo7Q; 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 b23-20020a05640202d700b005233f769158si3585394edx.348.2023.08.09.06.28.02; Wed, 09 Aug 2023 06:28:29 -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=kZqvQo7Q; 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 S232511AbjHIMfG (ORCPT + 99 others); Wed, 9 Aug 2023 08:35:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231754AbjHIMfG (ORCPT ); Wed, 9 Aug 2023 08:35:06 -0400 Received: from mail-ot1-x331.google.com (mail-ot1-x331.google.com [IPv6:2607:f8b0:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A636F10F3 for ; Wed, 9 Aug 2023 05:35:05 -0700 (PDT) Received: by mail-ot1-x331.google.com with SMTP id 46e09a7af769-6bd0a0a675dso1282945a34.2 for ; Wed, 09 Aug 2023 05:35:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1691584505; x=1692189305; 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=D1vlk426yx9I7RvL78AONvP5VHRKVeaBopr8pvsM2ew=; b=kZqvQo7QPz15n/1fXXXDdFKSI0e4A/DXzZVaQfaTr7UjANpLuMN3SzY5NxH7MwzQou FsNvDyhGFtnBkr34Jr3/ehvKXZ7FKv+3efLEWkVBKZqVsxsZwHLk9+NuV9pYNSDQAttt FVreMUaoInrkupaNoigWXu7tLt8LU4K8IL8ZsX9HSuR2iM7+Wwmu1hfOsdVBFPpNh4m0 asP6tXW7QTlzIOErn16fFZ8FrcUBTYRzMThlg9BT3rb4h51TIXX98ai9eaS7lKWzJkKj eEZ7S8/BOrUG55+UoAVm1UcV993ktA0o6xFys38oDvqmcNiRisb4+X9vvSlkuobUELjn Um1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691584505; x=1692189305; 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=D1vlk426yx9I7RvL78AONvP5VHRKVeaBopr8pvsM2ew=; b=cPmlBZyMb1biCa1peU9ybDAIFU8gxXOkiA1V+JjRyHf9LZnxYAidqBJKHWnn2h2WOr PoovewjPwLLwzaRt/4GJHdwUkZH4MjZibI7+Up7R+vq30VD31hn2XNB0n40mn8R2peK0 ONNvP9bADqoJRXUX6D1IkwVZ7yq2T6GDPIgLm2DP9SFfughhJl21j1kuRIcacjnTdLjp TKDxpLePISjHzhNdkdxcSP37/O9/ccg0SWu4V9y+pQJwRwtt0joV2PMZaFFMcqo8rJLZ +YjQ+NQYDYwzFTXNdfl1Q11u5cch/fIPPkyQsFMZ7lN0Wd3/kpsW07NGvhO/D83mCIIT OAYg== X-Gm-Message-State: AOJu0YxLmH0h3jwuoEd2IKVcfKT65QIpps2V/33KOH/AXVH0acNwRZCp hE3pP9HA/UWQvi2KISr1bzrDLg== X-Received: by 2002:a05:6358:428c:b0:135:b4c:a490 with SMTP id s12-20020a056358428c00b001350b4ca490mr2799558rwc.10.1691584503427; Wed, 09 Aug 2023 05:35:03 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-68-25-194.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.25.194]) by smtp.gmail.com with ESMTPSA id b17-20020ac86bd1000000b0040ff25d8712sm4030373qtt.18.2023.08.09.05.35.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Aug 2023 05:35:02 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1qTiP0-0051O0-Ef; Wed, 09 Aug 2023 09:35:02 -0300 Date: Wed, 9 Aug 2023 09:35:02 -0300 From: Jason Gunthorpe To: "Tian, Kevin" Cc: Baolu Lu , "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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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_NONE, SPF_HELO_NONE,SPF_PASS,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 Wed, Aug 09, 2023 at 09:49:16AM +0000, Tian, Kevin wrote: > > From: Baolu Lu > > Sent: Wednesday, August 9, 2023 8:22 AM > > > > On 2023/8/8 15:49, Tina Zhang wrote: > > > Use the helper function mm_get_pasid() to get the mm assigned pasid > > > value. > > > > For internal iommu drivers, perhaps we should use another helper. > > Something like sva_domain_get_pasid()? > > > > Suppose that the iommu drivers should have no idea about the "mm". > > > > Aren't all touched functions accept a struct mm_struct pointer? It is wrong for the driver to even ask this question. Domains, regardless of what they are, get attached to PASIDs. Maybe many PASIDs, driver doesn't get to care. SVA isn't special. Stop making it special. The driver should rely on there being exactly one iommu_domain for SVA per mm so it can hang the mm_notifier off the iommu_domain But otherwise invalidation for a SVA domain should be *exactly the same flow* as invalidation for a paging domain. It iterates over the attachments and generates the correct list of PASIDs and ATCs. Jason