From patchwork Tue Aug 8 07:49:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Tina" X-Patchwork-Id: 132629 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp2291466vqr; Tue, 8 Aug 2023 10:50:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEZqOjWizptjMH2GRCCy4ld+qfOfhWxzB3IpGSTtS9sV4fXv4Wug2LQRotgP5lgu8nr+4p2 X-Received: by 2002:a05:6a21:3b46:b0:137:8ddf:464b with SMTP id zy6-20020a056a213b4600b001378ddf464bmr166649pzb.36.1691517009660; Tue, 08 Aug 2023 10:50:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691517009; cv=none; d=google.com; s=arc-20160816; b=BGCTgd+5nxz7yY1NlNNiWvUv/yZKCiCPQSRjPR8inmeWig3s+JfKPy42zrnTazopQ7 DJ0xBgXS6yQUr6y2ToaLt95Higc8iwO5MiOjSsy/hcjU1qTd7gWbKeNI3pgsxxQZskYv zi3fyWboptfWZmlBju7EQ6oQvtxOJ1v9vljgYkXaiGZT20Eh1AF3aC5MkllDWWFe6wk5 kpjIckH9svyQItFUHBhXBR+yX4wQE7X1oghlrETgtVQ+wh0vvbJuLG22EriTeL4/da5a esFKXHupb0D9LhZNCyRxJ4mXHvgusZnD4Zy9pcjJR2BWEUzZiVZI46GJQvVlhugxJVcn XrTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=DZW1mbxT0iFwJnNs0K13zoKD84DxDa15fA2yBWLZhGY=; fh=/lTHmTEAhz5c6hgBRAPnmJsxw5vDTKZT1TYa5ynR+LA=; b=rsQ8SWO6fWV8wCNPFoEX4zoKdGIuoKi2OCUi0f5aqhvfzaR4VqOiYVFDlUQg7gvoeF 3iov4eP4fXaNOhWx5UU8NNMgELyMBWvI8mgylypUn0Qsc4LZMcGmAIr1PiSyQYXW/5Mb 3bxbkt/ySVe92bUStureEmuYa9nVjuuk43S0fl95qXrzytOFlb7tEpLnFDsN8TjXfwyO be/8EqdSy9EB0lNlO0ceAJsgZs+Rni0lxqqBlJ8Jfc4k/TXBiQVTdjmvXzufQl0pPXWu SEywoW7rWZdh24BNyinuMtBUKEK6pKRhLNNNYwo3ZzUMfoOqE8ATcbiLE1xsR3vlZu9w T+Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gJsxNnNl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w23-20020a639357000000b00564b8e55214si5925190pgm.385.2023.08.08.10.49.55; Tue, 08 Aug 2023 10:50:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gJsxNnNl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233318AbjHHQnq (ORCPT + 99 others); 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> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773684140147658046 X-GMAIL-MSGID: 1773684140147658046 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; }; +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 5e74ce4a28cd..3fd65b7537f0 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -595,6 +595,7 @@ struct mm_cid { #endif struct kioctx_table; +struct iommu_mm_data; struct mm_struct { struct { /* @@ -808,6 +809,7 @@ struct mm_struct { #ifdef CONFIG_IOMMU_SVA u32 pasid; + struct iommu_mm_data *iommu_mm; #endif #ifdef CONFIG_KSM /*