From patchwork Thu Oct 12 03:01:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Tina" X-Patchwork-Id: 151674 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp949199vqb; Wed, 11 Oct 2023 20:02:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEDuwUdVfU5comf23T8yDUvMhHsBbI7iCLer6478B16wvNhYmLaYhnj/4fk2sKeK+pptbgY X-Received: by 2002:a17:90a:3c8f:b0:269:34a6:d4ca with SMTP id g15-20020a17090a3c8f00b0026934a6d4camr20539159pjc.0.1697079726348; Wed, 11 Oct 2023 20:02:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697079726; cv=none; d=google.com; s=arc-20160816; b=jtQYF8zNLWY1AtBxswtoktt86NkxTkC6EAHYdCb+40rU0gTtnVtm/UI6EKwjSJclcm Ciaj4mWVdyuJ+O1gQ44Sb5miH4liWvZXU5ZoSTK+rBR4bMQJddkSQbLXASR7Ms0wFQzg rnCOEJ7dWAu6yX4utwwRH/dCRudyG2esYP4VbmQc1n8KzUvAPv5Zy6cr9ISXtuW48T7D o++amfqmVeJCPRnvREpWQvjpr1oRHUfKsjEtX1KcoZFl04R608ZNprLzrv6v5aeZSybe 7GY2nVXKrxWjc+L0uCx5GWVRCMBjgui8XLddcrvPBhPesawhF2C9Gsc/cKIYAm5b+oWR D6Aw== 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=tFmNgJLrbbprZYS9qbPoRomUA/KrST8LSFRT//HpShk=; b=Af7t2Py89vlIZK0BFE+O6k/Qb78mpX8Q2mGKKW3D57JmKmkM2tQ/IG+HglogwU+KxU xs1lh3XBUSXXh7/3Ahn9U00fsACrrty/1yfFn9OvEXkjXyGGwWg4bf/SeHOIM7ZQhp5g 1xpp6FxzBVXHPe0UTs7ermaWPPXDBTkQH15NzRbxmbFvNF4gEZkYnLfC8mvq1Wlm4MIZ AfIT8xbXBUS8zW+nEHRAPfMEi4N10u9pBMaqfV1sKIUf89V2r5vrfoaYsJTSEfmRZyWa sce8MZBMKRpVt7ej1dH47zGcsk0JpyTdkt1Zc7LG00jzAJrqQB1unFD+vPH5JX6AhmFZ CJ2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nMAmFjgI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id z14-20020a17090a66ce00b002791d2ce94asi1244223pjl.81.2023.10.11.20.02.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 20:02:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nMAmFjgI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 62659801CFFA; Wed, 11 Oct 2023 20:02:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235318AbjJLDBq (ORCPT + 18 others); Wed, 11 Oct 2023 23:01:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235281AbjJLDBd (ORCPT ); Wed, 11 Oct 2023 23:01:33 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F7DAB7 for ; Wed, 11 Oct 2023 20:01:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697079692; x=1728615692; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GkJWDBRQ1jsnIIVUcbi2Qvjz1LAX/o3/l8N0hK1jUv8=; b=nMAmFjgIFrHKU8xv4F+Rh97M3pSo1SN7ADVl2vtAkwU/SpMeEqZZcfzd 0V1lSWv3/Ck7voTjETra2J7uZoUMKhSIcjKu5qOzUU/Xy9ym9HKNP3jVL N8Wky6fRvzOZPvi3nVXV4lnRLuN9VUrz1J+UWeStXx/Be2srsnoiNPF47 1gJqgo8ll/PxgUuud5ufhCSuzAB0HZ8rbj6Hv8JswQvJiYYJLqv25YJTZ GMKMFrFwL7O2JOHlqgzWpIrKFlAEDQ1M65xtaV6EaPBgoGS+W1s2qgYbz wilbURvdtqo/RkNld50+vTst52skfW3w8sBrVslzkMK0EXu2S7q8J4hm/ Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="6371502" X-IronPort-AV: E=Sophos;i="6.03,217,1694761200"; d="scan'208";a="6371502" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2023 20:01:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="730736523" X-IronPort-AV: E=Sophos;i="6.03,217,1694761200"; d="scan'208";a="730736523" Received: from sqa-gate.sh.intel.com (HELO spr-2s5.tsp.org) ([10.239.48.212]) by orsmga006.jf.intel.com with ESMTP; 11 Oct 2023 20:01:28 -0700 From: Tina Zhang To: Jason Gunthorpe , Kevin Tian , Lu Baolu Cc: Michael Shavit , Vasant Hegde , "Nicolin Chen ^C-cc=iommu @ lists . linux . dev" , linux-kernel@vger.kernel.org, Tina Zhang , Jason Gunthorpe Subject: [PATCH v7 3/5] mm: Add structure to keep sva information Date: Thu, 12 Oct 2023 11:01:10 +0800 Message-Id: <20231012030112.82270-4-tina.zhang@intel.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231012030112.82270-1-tina.zhang@intel.com> References: <20231012030112.82270-1-tina.zhang@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Wed, 11 Oct 2023 20:02:02 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779517070937531833 X-GMAIL-MSGID: 1779517070937531833 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 /*