Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp619856rdg; Tue, 10 Oct 2023 23:52:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEayLsVftNuyP5ksAHnNzJfmC6CLxdHTT7wWGLpbu8Jta/YIRUT7Ef8u+nbzwGy6PB+B5SU X-Received: by 2002:a05:6a00:2d94:b0:68f:cc67:e709 with SMTP id fb20-20020a056a002d9400b0068fcc67e709mr25729777pfb.16.1697007133273; Tue, 10 Oct 2023 23:52:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697007133; cv=none; d=google.com; s=arc-20160816; b=kyq/A17wBVKVaYlhwUAdnHDWmhwOWciAax1SsC0ieFiHo9pv6/WSd5W4EZy5KwN0SI n1eVi717AP9g1Kh9yMBST3FirGVnsd6guOVb+G5zsY3qyuL/B0hcVZhgwGUe2rmX8J5S aLLFgey9QuUtzvJObJXxvkQ9+YFDrrOpNO5QxVki1pNi/qJrKheHj5Q3rtS6/spSiirt YOM3mcUNnoH3pNT8jJaSSx2JnwzIXKOqJErL8g/av+F26rUIwYjLZSb/x/UIW3lVeghm iDhSAeoZ1eho0bDYrCFEvtyQsq2EPfUU5stn5qkVu4022T3JBMfcs2nS8sn2FxG9hzvB 9sxg== 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=JZ2F8LshQhIPxgQHaUgqsOrSkEbQz+MtiBWUTwXRyWk=; fh=2Ks+q1VI5sIi6LqUZH+DJDRf7Od/7+1TAInH7Sedi5c=; b=z++FK1DXH6yP9eWCdstD2vEhNdrk9IrEEFrSRehAxmNEbPeob7Amc+EXEEx7TBA/6E /ha3aAq7rYPiXm5BCfyHFIe3gKcBzLERMfSOfsgPho/2WtQPB4OYtBc7p994FJH1qsSh lr8Gx1QDF/ZMb6IzpZpCQxZyuQnKZDF2jwxiYfjrI1tfVs67IGbjBV3fJtuuUdFW4SZ1 u/+q5REsOKzlzdDTI1/jqcgXSaxdiUNbyRm4ngX7/qTWRqvRT5TyWNqZu4gC9x8gLDzF 1+dnO2+XAYNpWoVPKooHrfxfuUDxTo1i4ds8MDGuyBT6N0MsXdZJxfpB5JvaOV6gqEn7 t6Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nFBmh0Et; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id v3-20020a056a00148300b0069347c30c78si11856809pfu.230.2023.10.10.23.52.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 23:52:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nFBmh0Et; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 18D1B81A3362; Tue, 10 Oct 2023 23:52:12 -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 S1345231AbjJKGwG (ORCPT + 99 others); Wed, 11 Oct 2023 02:52:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345289AbjJKGvq (ORCPT ); Wed, 11 Oct 2023 02:51:46 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CDE49D for ; Tue, 10 Oct 2023 23:51:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697007105; x=1728543105; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GkJWDBRQ1jsnIIVUcbi2Qvjz1LAX/o3/l8N0hK1jUv8=; b=nFBmh0EtinaWdwQkOGT901L6mDj+/A4uLfCiH6CQzi7/QqfjL6Yooeo2 qtvlesa65cDs6hFB8/z/fhefVCeerkYMgMHIxTVhHmviR7njSDzcVXB3y ZQb1OicsmNfoJwKI0MRBEUBrgMinkOgci8Mn3XdwASX3CHBDYEa9qepRh mccOyGyPOPdpoB5xwFfFQ7I+BP7PNle7F93L7G7eCI5dXOU2/casjfeL2 gGD7U5P+6PBN7cuYbHvuDkH3sjW01wiu33i6yQgq0ishDWyVaoe8lfzKf oSp3hTUN0mCU4PMxOylDdjoXBljT6nIRQccJI5SpCZO+/caAMft/h+0gI w==; X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="387436962" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="387436962" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Oct 2023 23:51:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="824050259" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="824050259" Received: from sqa-gate.sh.intel.com (HELO spr-2s5.tsp.org) ([10.239.48.212]) by fmsmga004.fm.intel.com with ESMTP; 10 Oct 2023 23:51:42 -0700 From: Tina Zhang To: Jason Gunthorpe , Kevin Tian , Lu Baolu Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, Tina Zhang , Vasant Hegde , Jason Gunthorpe Subject: [v6 PATCH 3/5] mm: Add structure to keep sva information Date: Wed, 11 Oct 2023 14:51:30 +0800 Message-Id: <20231011065132.102676-4-tina.zhang@intel.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231011065132.102676-1-tina.zhang@intel.com> References: <20231011065132.102676-1-tina.zhang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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, 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 10 Oct 2023 23:52:12 -0700 (PDT) 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 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 a4eab6697fe1..dc1f98e12f4b 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 /* -- 2.39.3