From patchwork Tue Sep 12 12:59:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Tina" X-Patchwork-Id: 138339 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9ecd:0:b0:3f2:4152:657d with SMTP id t13csp578639vqx; Tue, 12 Sep 2023 10:51:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IES+PKlfW0OGd29c5dA0VaSCqez/yiYsv+RPEp6w22HMsCUc8Yv9w/aFGv6Vy/HtFWMjcta X-Received: by 2002:a05:6a20:3246:b0:157:877a:5f5e with SMTP id hm6-20020a056a20324600b00157877a5f5emr85497pzc.61.1694541078274; Tue, 12 Sep 2023 10:51:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694541078; cv=none; d=google.com; s=arc-20160816; b=D3Stzgrfprr2bIrx5IV1ziYZmJR2vgPu3lpeFi1ICfQZEw+XBwTPu9DYH6aRtaqW29 m2xTa8PF5zxZgGQAFBEuMKHgHy7QTRa77JsTaDUOGHXa96PqKPxJQ5Ng9QTT9XOlOQYD AE3kXyHH54JBTlSPytOz0BmShsGh3EpewV5+3jbpKyfwC8oBxlKZsjEPMMKLvg9jgTaP C+aLgd+fT0GaYdU0zRBMb40jkDxF89AdCMaNEE1DJuKsfYAanb+cLqM5z0N/hKDS18pj jEyXyez8tZ52quQcnZYYXh2RqKSYfO8WeAIf2CLxGbmjvplwcz3i/fZomVaTPVFRXVjn vKmA== 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=41gBt8KHX1wv3wQueAkK+8oubH9Zs7QDaq3ue3VSfqk=; fh=zW1GPeUL3MQGLvvmLmBmaazP2MzqJ1fOEi8He5Dzy3k=; b=SY+USq/3hlBiJBnRc3uhX6S9/NtYqa5mCTWiLpAoLE/Lr2ZPMf8AJxACSOzIcLiIAC cw/maw04dJq7HbzSAOhIJ4y0Oqbi+LeHYVcHTXoITOMiQlRsOGJt2tDWUvpebO6MLfNX FxqF13RgQK7OpygoJMsl3ORQhotDaxiRj+I9h3ywWKFURkgMxzYjNeyLCh9Kb/21gsHB EJi+jKBnTvB2AZp40QhpZSZ5jd5tRiB5/q4Y+ybD3NSs9+IVvjOcjXino8YT6n0qaSbP GygFcWUO3kZtodJsIb7wMdCWSSE+0oXU4gbEXrx74UkUAhbtujfv96uV10u4niaTfB9U tvtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bNG97GLa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id p16-20020a056a000b5000b0068e3b9aeefasi8621315pfo.138.2023.09.12.10.51.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 10:51:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bNG97GLa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id 72CE681F9661; Tue, 12 Sep 2023 06:00:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235434AbjILNAO (ORCPT + 37 others); Tue, 12 Sep 2023 09:00:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235357AbjILNAD (ORCPT ); Tue, 12 Sep 2023 09:00:03 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B02810E4 for ; Tue, 12 Sep 2023 05:59:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694523598; x=1726059598; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CH0kLtQV/Lrtt2u1C1f8cD+t2SUUqoIwKlnXYe5Qiqk=; b=bNG97GLa5Rxvbsh0RMYwtn2PdPq0HPf8cZEvGFnhBcjObM9rjqOcp0ud 1Tg99gMcAcNFfZpHA2Yo4Ey4zojRaKVQmzSAuo0bRJk5zGfgxgnS1GvYM rXpXZ/9F7lT+Vj2V4RUZ5Ycmbr4WaxTfQU953GVwWliXuB5PwO88QJivC UIFDHbsXUcAnuXXWjYTXs1zuElxckpQZsuC+hLU93bv4EnAiPoZepcGJL 5ajnx/xznG4o42x4lESlCLDyi0RZ18GX99ZYkeGnNc++LPLlbQncbG2AP xcPLR9qNDzyTW8Ocpvwdza7/9SFSQeTXTxosJfED7q6+purirndOvJoBb g==; X-IronPort-AV: E=McAfee;i="6600,9927,10831"; a="378277329" X-IronPort-AV: E=Sophos;i="6.02,139,1688454000"; d="scan'208";a="378277329" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Sep 2023 05:59:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10831"; a="858799347" X-IronPort-AV: E=Sophos;i="6.02,139,1688454000"; d="scan'208";a="858799347" Received: from tongshi-mobl.ccr.corp.intel.com (HELO tinazhan-desk1.intel.com) ([10.255.28.214]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Sep 2023 05:59:55 -0700 From: Tina Zhang To: Jason Gunthorpe , Kevin Tian , Lu Baolu Cc: Michael Shavit , Vasant Hegde , iommu@lists.linux.dev, linux-kernel@vger.kernel.org, Tina Zhang Subject: [PATCH v4 4/6] mm: Add structure to keep sva information Date: Tue, 12 Sep 2023 20:59:34 +0800 Message-Id: <20230912125936.722348-5-tina.zhang@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230912125936.722348-1-tina.zhang@intel.com> References: <20230912125936.722348-1-tina.zhang@intel.com> MIME-Version: 1.0 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 (fry.vger.email [0.0.0.0]); Tue, 12 Sep 2023 06:00:59 -0700 (PDT) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776855105592623041 X-GMAIL-MSGID: 1776855105592623041 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 Signed-off-by: Tina Zhang Reviewed-by: Lu Baolu --- 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 db2510da28c1..b9c9f14a95cc 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -670,6 +670,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 /*