From patchwork Wed Oct 11 06:51:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Tina" X-Patchwork-Id: 151159 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp347044vqb; Tue, 10 Oct 2023 23:52:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGqQxvhzV9c6pw372mzk84HisrvTkHhLbTNNPoZOpOdhwKzAye6XQa1y964FFappfig3Ay9 X-Received: by 2002:a17:902:f54e:b0:1c2:c60:8387 with SMTP id h14-20020a170902f54e00b001c20c608387mr22823136plf.0.1697007131675; Tue, 10 Oct 2023 23:52:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697007131; cv=none; d=google.com; s=arc-20160816; b=BTIVK+/lJ2OeXtjjzYgs+crv2/0ptVqhj3Tl8G81XPgFDk8nzsaOEFUBXtWGnscXka 6C5jVA6Zg+2Tzqr4FB+llRXlLq00JbBKDVQlEsUYalwGgis/mw2LZzewUXmC3LEAJvHX uRGTRUEpYUp/oh73ryHnbMHVm5l3PPq/OqnfbqZvKXFoDekZq5S3ALRgqx2PyiE2mMqV LDKFJrwgux3odXL/DIJpdHoz5y4adPcT4W8rFmNacXxMQRt9YXi5Zp88AQ6a6prlpYv/ yLtOARa8tcRI0gzqIBXE2GDPr9Qi9lvLvGZtKsd4Cqwd3d69U5u19kDf584zLWF+oFDx Mu5Q== 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 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 p12-20020a170902e74c00b001c7345bc01csi1091939plf.450.2023.10.10.23.52.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 23:52:11 -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=nFBmh0Et; 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 D052681A336A; Tue, 10 Oct 2023 23:52:10 -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 S1343923AbjJKGwH (ORCPT + 19 others); Wed, 11 Oct 2023 02:52:07 -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 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:10 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779440950571414334 X-GMAIL-MSGID: 1779440950571414334 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 /*