From patchwork Wed Oct 18 05:06:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Tina" X-Patchwork-Id: 154656 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4570744vqb; Tue, 17 Oct 2023 22:07:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEihCZs9ZYx8FXfzFNBlObgukchtQxSdDxzhm7jHDN3s1e37X9XEXb8SoYcUAEpdH9g7E5O X-Received: by 2002:a05:6a20:54a6:b0:163:d382:ba99 with SMTP id i38-20020a056a2054a600b00163d382ba99mr4604326pzk.5.1697605648407; Tue, 17 Oct 2023 22:07:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697605648; cv=none; d=google.com; s=arc-20160816; b=Lfjl7osbItUMczsSEUGia1jTyWZNYCOFCO6VI4obxdNhLSylR3bATfD1i3nenpLyW5 VPn6WPqtpxJSAE/KCLUIVzgAau5J70nVMolM/WXg1bTwquYb7fP/qXRAd1aGGl1qWJv7 9r2873QkwJ2NlU38PT6CNcO/tIW56Ygf+zl/NIscvc0+Ut31PYHCzB/ksDcknsUjik41 S3D6/LPk8lBYm+yla+3Ru48D3EX3qU30gpU40wJb3RzLNoBlaiOERPvQZ7t4rRclkfTT gQBhpYauTPGTtt1wCinGl97yqW9GBVadlf8FDpUpLpMVyUVgozUkXeb2oiX5j4T3yAhc MiQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LWzAq8dO2HlJgZLVrB+cyby5SgSL9mWjK4hC7xSl0sQ=; fh=dJBxdn+RXcUABM1aUIOqfrsndRxIHilofn8/gNUoPfs=; b=DMLYHCMY553UzSywYhf2v4Hxz3QZpXjdeRQF/PCuQ+3+QO/2J2INOTDP5CkXZNO/FK 35NtNcceE5rwKmBoZymvGVyQSpuSYd1VN1lN+OOBsrnfOofj6KJl3qth8v8hyaGnSLJ8 SVRLQB0RHXmpCyo9EStyeIRk/TqiZ5mmuk4hQJ5hol1RE1bQiywj7DSQTdOcTLRMU0g2 DLwAgTzZz9oLoRVCI5XsHCFRzPtLObRFKPY7ok2KmHgCZmAQoi6aftuMWSgWnhf9p18Q fHHDNNjoWUurCXYjJTczguSMAjvIss2Zj99JhXj18cpwG8+sqRjpqE8XTiUg+R++JUtH JA7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LFP1f7H4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id w6-20020a656946000000b00589336ba9f7si1327947pgq.822.2023.10.17.22.07.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 22:07:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LFP1f7H4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id C4AE9811F114; Tue, 17 Oct 2023 22:07:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229628AbjJRFHU (ORCPT + 23 others); Wed, 18 Oct 2023 01:07:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229595AbjJRFHQ (ORCPT ); Wed, 18 Oct 2023 01:07:16 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAC1A103 for ; Tue, 17 Oct 2023 22:07: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=1697605631; x=1729141631; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=D8FloSWnsd/4uIpu7aqdGVx2PMFIFcWQFmckzLsY9KE=; b=LFP1f7H44A0P80fp/CcDugVTyNpo2wkD6Ap99VovTLRLQjKzfEnu6nb1 5IhhomA7KHjZ5KkDqp+3NBQ7gNoxjxep4+r8JNYhZHVldafIuCpmZW1oP 1xHf52newRZHeMiJU/NbWHmhkcM1EqRd9909o5yS5bsJNh+goeLA8Tinr U6R+hgse4BeLEqGlPmZCuHKJGk3bWRXFKj6ZB1JMwvcuhUkPKlQk6f3zZ /aNh6RI0qy02GU/rlkH/6kJSXAkOCab/sgDa0GOnjzRQ5gMbFBuULfDhE XahOnpcd+y6FEooh+AqPFMnI1Zie47m+NlCPFJ0MnHI1j5ZOa74nVt/Td w==; X-IronPort-AV: E=McAfee;i="6600,9927,10866"; a="388802436" X-IronPort-AV: E=Sophos;i="6.03,234,1694761200"; d="scan'208";a="388802436" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2023 22:07:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10866"; a="822288653" X-IronPort-AV: E=Sophos;i="6.03,234,1694761200"; d="scan'208";a="822288653" Received: from sqa-gate.sh.intel.com (HELO spr-2s5.tsp.org) ([10.239.48.212]) by fmsmga008.fm.intel.com with ESMTP; 17 Oct 2023 22:07:07 -0700 From: Tina Zhang To: iommu@lists.linux.dev, linux-kernel@vger.kernel.org Cc: David Woodhouse , Lu Baolu , Joerg Roedel , Will Deacon , Robin Murphy , Jason Gunthorpe , Kevin Tian , Nicolin Chen , Michael Shavit , Vasant Hegde , Tina Zhang , Jason Gunthorpe Subject: [PATCH v9 3/5] mm: Add structure to keep sva information Date: Wed, 18 Oct 2023 13:06:38 +0800 Message-Id: <20231018050640.24936-4-tina.zhang@intel.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231018050640.24936-1-tina.zhang@intel.com> References: <20231018050640.24936-1-tina.zhang@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 17 Oct 2023 22:07:27 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780068540683018134 X-GMAIL-MSGID: 1780068540683018134 Introduce iommu_mm_data structure to keep sva information (pasid and the related sva domains). Add iommu_mm pointer, pointing to an instance of iommu_mm_data structure, to mm. Reviewed-by: Vasant Hegde Reviewed-by: Lu Baolu Reviewed-by: Jason Gunthorpe Tested-by: Nicolin Chen Signed-off-by: Tina Zhang --- include/linux/iommu.h | 5 +++++ include/linux/mm_types.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 8aa5910190d1..b581d8d02afe 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -679,6 +679,11 @@ struct iommu_sva { struct iommu_domain *domain; }; +struct iommu_mm_data { + u32 pasid; + struct list_head sva_domains; +}; + int iommu_fwspec_init(struct device *dev, struct fwnode_handle *iommu_fwnode, const struct iommu_ops *ops); void iommu_fwspec_free(struct device *dev); diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 36c5b43999e6..9f4efed85f74 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -670,6 +670,7 @@ struct mm_cid { #endif struct kioctx_table; +struct iommu_mm_data; struct mm_struct { struct { /* @@ -883,6 +884,7 @@ struct mm_struct { #ifdef CONFIG_IOMMU_SVA u32 pasid; + struct iommu_mm_data *iommu_mm; #endif #ifdef CONFIG_KSM /*