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 4CD65C25B48 for ; Fri, 27 Oct 2023 00:06:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345088AbjJ0AGY (ORCPT ); Thu, 26 Oct 2023 20:06:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234902AbjJ0AGU (ORCPT ); Thu, 26 Oct 2023 20:06:20 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B57C010C6 for ; Thu, 26 Oct 2023 17:06:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698365174; x=1729901174; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Wo2nnVnytmaVY4ED2ACAsxJBNTN+sJf6b78BSdYwC4Y=; b=Dx97GvNdFe8mSdibbYsJqtiQqXkKMZ/KdPSLX5D4E/5NYjf5HGyk3sa/ 7xM12F/3rk2p6IrJYOl3IlElIedGdPm41TnsP27iLdLD8dIMwN3zHPmeA jZX8E4yyfwJG1m1ZWXgUAOiT8ONTKAFKUghGpJgaYve2nNhMT8Na7rK0B 2QgiLsPLZS6iAPCVWVnSPrXKI2z+z02GnBAeRjfhvmHVqC1P4jJP4EJIR TYx1MXseS428/xbTKn+O2YmMkh/j3msjj0qbA71iLlL9MdS8rfyXYPfSq v18qQs/xiHuvwHHrymtT80akPwrxJ9d4cv6Szh/DfSdbTDvB/SUy1LAi3 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10875"; a="390535989" X-IronPort-AV: E=Sophos;i="6.03,255,1694761200"; d="scan'208";a="390535989" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2023 17:06:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10875"; a="883017504" X-IronPort-AV: E=Sophos;i="6.03,255,1694761200"; d="scan'208";a="883017504" Received: from sqa-gate.sh.intel.com (HELO spr-2s5.tsp.org) ([10.239.48.212]) by orsmga004.jf.intel.com with ESMTP; 26 Oct 2023 17:06:10 -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 v10 4/6] mm: Add structure to keep sva information Date: Fri, 27 Oct 2023 08:05:23 +0800 Message-Id: <20231027000525.1278806-5-tina.zhang@intel.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231027000525.1278806-1-tina.zhang@intel.com> References: <20231027000525.1278806-1-tina.zhang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Reviewed-by: Vasant Hegde Reviewed-by: Lu Baolu Reviewed-by: Jason Gunthorpe Tested-by: Nicolin Chen Signed-off-by: Tina Zhang Signed-off-by: Jason Gunthorpe --- 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 95792bf42f96..a807182c3d2e 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -679,6 +679,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 330f3cd8d5ad..2dbf18e26c5a 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -670,6 +670,7 @@ struct mm_cid { #endif =20 struct kioctx_table; +struct iommu_mm_data; struct mm_struct { struct { /* @@ -883,6 +884,7 @@ struct mm_struct { =20 #ifdef CONFIG_IOMMU_MM_DATA u32 pasid; + struct iommu_mm_data *iommu_mm; #endif #ifdef CONFIG_KSM /* --=20 2.39.3