From nobody Thu Sep 11 22:44:33 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54FF6C001DB for ; Tue, 8 Aug 2023 16:43:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233216AbjHHQnq (ORCPT ); Tue, 8 Aug 2023 12:43:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233120AbjHHQm5 (ORCPT ); Tue, 8 Aug 2023 12:42:57 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A939516578 for ; Tue, 8 Aug 2023 08:55:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691510131; x=1723046131; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=lp2BCntolGG4mTS6F0ktq7rcph+RoXn5XygwILHKL8k=; b=gJsxNnNlVpD4h2H/u22UJdqSHBda8ZzXkCSpGsy9EvznFmfjO1BkMRIY qAsKy/OjueO38cNdAfvDDb84Wv+AzICdJ3wbaSDbUuO99YPtr5Ejf28dX hBvF0Rbcz8HjQMidX2wLUXG6iSfXmY/HvSpXYF3GFscfjQx+bGphqK7eY 7zqFmEx2unLz6kN2V31AVL7szy8jPZKapDpW5DIKFGDFcQJB/1uqHogc9 OoJaGJu+UBCOLhVMklmtTUOI3MsK28o5xOZDTECwooB8wc1m2AT6REEEo 83mkfDG/G68Md0qlEzax+h7BEwhfO18tcjJcFO3cZ/ZDG+nXeRsafmucz w==; X-IronPort-AV: E=McAfee;i="6600,9927,10795"; a="437078680" X-IronPort-AV: E=Sophos;i="6.01,263,1684825200"; d="scan'208";a="437078680" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Aug 2023 00:50:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10795"; a="681146338" X-IronPort-AV: E=Sophos;i="6.01,263,1684825200"; d="scan'208";a="681146338" Received: from kechen-optiplex-9020.bj.intel.com ([10.238.156.126]) by orsmga003.jf.intel.com with ESMTP; 08 Aug 2023 00:50:00 -0700 From: Tina Zhang To: Jason Gunthorpe , Kevin Tian , Lu Baolu , Michael Shavit Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, Tina Zhang Subject: [PATCH 3/5] mm: Add structure to keep sva information Date: Tue, 8 Aug 2023 15:49:42 +0800 Message-Id: <20230808074944.7825-4-tina.zhang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230808074944.7825-1-tina.zhang@intel.com> References: <20230808074944.7825-1-tina.zhang@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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. 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 30e4d1ca39b5..435d1c1afd23 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -670,6 +670,11 @@ struct iommu_sva { struct iommu_domain *domain; }; =20 +struct iommu_mm_data { + u32 pasid; + struct list_head sva_domains; +}; + int iommu_fwspec_init(struct device *dev, struct fwnode_handle *iommu_fwno= de, 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 5e74ce4a28cd..3fd65b7537f0 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -595,6 +595,7 @@ struct mm_cid { #endif =20 struct kioctx_table; +struct iommu_mm_data; struct mm_struct { struct { /* @@ -808,6 +809,7 @@ struct mm_struct { =20 #ifdef CONFIG_IOMMU_SVA u32 pasid; + struct iommu_mm_data *iommu_mm; #endif #ifdef CONFIG_KSM /* --=20 2.17.1