From patchwork Tue Oct 17 00:48:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Tina" X-Patchwork-Id: 153839 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3818186vqb; Mon, 16 Oct 2023 17:49:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGp2J8OlV0VnQ9lZK1UgGIiitBlTJdXsTEd1+p7/BUV+FWSN2akZa862IPZv9sRDnjmgTJC X-Received: by 2002:a05:6359:3118:b0:166:d9b6:1db3 with SMTP id rh24-20020a056359311800b00166d9b61db3mr695835rwb.2.1697503739968; Mon, 16 Oct 2023 17:48:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697503739; cv=none; d=google.com; s=arc-20160816; b=SkEOAMocgAzv/O2JOzqjaOihg/L9NzY/16PpLU2hkLp8gra5jT7nXGIUWsEib8pWaI 2xvfV80RLE4ohUbpGHuPFwEB9gPjUXxTAAjINdE/1kGBKlJ8rix/TwIDL4lCXL3+GYqx +5Qeg1DuHyt5b/t6IhlOn5ylxKTxM7PR9OUrZrjHUj0L5jw2egZ4oj1qe8TRSvDuxf3E U4L1O9evkPzqsePrA1qvw7aMhjHqOFayjrveN/h5VWKm43u5ktX9GJAKwpGriMa8dKX+ DUSPizR/tUc0gXp/3arHOxdopms17kpWVd8m3l4XhuL9o3LqPbrA3ddWsul65POnaFy1 JfSA== 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=B0+sfBNtt8Gk1Af29JHInJiQvk8pFQPSdFHge8Silb4=; fh=dJBxdn+RXcUABM1aUIOqfrsndRxIHilofn8/gNUoPfs=; b=RN7QAyJ+KBKER9ABx5k6FREbXlprqJqfZKfqg606RO5VjbDYIjV9oomj1kTJgSTtWF ipWB3vdjrP5su5SEfz9HSteOIxehvgnWrQv8di4BDC2RXmMcfPiAF+kVBFey83fiOjVX vvwJdB0mcZYXh2R909cwx5qg6EPifO33GAUiihN/0kppN0HeFkVxJzpw7A3zDvSbUePx Hhq7/zD7M4u4Y7F4fjwn/1IKfXi+vSFL0LWtOlEcfoD5ltDxQnNU0l9z5k7TSum+vZYb myaR92He25iKkDKa6ifgQ9OGGHQhWdX7EnKOfj68Nj8W4hQHVYzlMLvMXtFGTA4NwyvQ 5klg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=XDx0ZyM0; 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id x4-20020a056a00188400b006be30cdc3d8si446461pfh.163.2023.10.16.17.48.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 17:48:59 -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=XDx0ZyM0; 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 58DFC80236F1; Mon, 16 Oct 2023 17:48:59 -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 S234291AbjJQAst (ORCPT + 18 others); Mon, 16 Oct 2023 20:48:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234350AbjJQAsp (ORCPT ); Mon, 16 Oct 2023 20:48:45 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35518115 for ; Mon, 16 Oct 2023 17:48:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697503722; x=1729039722; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0DTtg53Mry+bx0RWv8c9JmmtiJF5A7k4iMPvgpVkaoA=; b=XDx0ZyM09D5cAU7IFhQon+D2/rpP2/wtAsqnwTn4E288KRWmkL5cRGI9 rAUh8rSjPkPd44Xds5H73EMAKv/IqHh0tqD+bwJWLaiPMaXPiQq8wGIjT e7PK/RsxljI9DgS9l7XdwJmWWOFf+rv//p8jbTlbidNDRF21gK1x+aPfR 66OeUCE8FxoxAElAKzTpBletalaC3L20dBrGAMWhJwRwk/SYItzwUS8PZ KsMrqiAjmgPCut9U91HRmAye5YBOFulyhoeXWQEv1xEI2HooVudzcus1x VLUxWw5y+qRJVtd0W1GAQiIARKPfu8+WDVTZFFlW9R1xNDwdefMRFpAGP Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="382893318" X-IronPort-AV: E=Sophos;i="6.03,230,1694761200"; d="scan'208";a="382893318" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2023 17:48:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="705793755" X-IronPort-AV: E=Sophos;i="6.03,230,1694761200"; d="scan'208";a="705793755" Received: from sqa-gate.sh.intel.com (HELO spr-2s5.tsp.org) ([10.239.48.212]) by orsmga003.jf.intel.com with ESMTP; 16 Oct 2023 17:48:37 -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 v8 3/5] mm: Add structure to keep sva information Date: Tue, 17 Oct 2023 08:48:00 +0800 Message-Id: <20231017004802.109618-4-tina.zhang@intel.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231017004802.109618-1-tina.zhang@intel.com> References: <20231017004802.109618-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, SPF_HELO_NONE,SPF_NONE 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]); Mon, 16 Oct 2023 17:48:59 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779961681605950886 X-GMAIL-MSGID: 1779961681605950886 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 --- 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 074b98f9e5dc..e350520e3a35 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 /*