From patchwork Fri Oct 27 00:05:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Tina" X-Patchwork-Id: 158709 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp251361vqb; Thu, 26 Oct 2023 17:06:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFF9um1mJT3EnHkummrNxy4KYLjAYq5d4Png5B3I2mh/aBdwixyupFeLoxBxNJm2os8dmll X-Received: by 2002:a05:6808:350:b0:3b2:9bd8:582c with SMTP id j16-20020a056808035000b003b29bd8582cmr1132124oie.13.1698365199761; Thu, 26 Oct 2023 17:06:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698365199; cv=none; d=google.com; s=arc-20160816; b=KWon0FQqvNQlluCmXe530LBry/W9bcKs7CSAzoylNIbhAppIifwvhkaPpec50imHxj DknA9HxaDczMSGmB+WwgTSHGz2V3rOET+SgbqdhagiLNCp2tJk2fLy/g5qSNElOioWJs 5RkVY8PpoMqy+dc9rfV94HHQ4jp/mWraZeagsMQwcydMyMH/o9LogQEYTHBcuiDgEAGW nO4qeTUgw/AbUKtOWej/of9vv0DVsaYmFMAsVQ5afn4lNPU5BtxQdn1nOYdGVROVTch+ zLxgUrZ8TmhtsrYxxCUq4CQil7irP74k6rHZUjH1dBsm/G+3sH1sAXPPTO+SVuwZGNzM IFug== 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=VahboBRVDIEyDZDNcoauMwYH4l9j028ayLr7xT9zJYw=; fh=dJBxdn+RXcUABM1aUIOqfrsndRxIHilofn8/gNUoPfs=; b=orFftyF9Z/7lYhYOKa4VlmUSpfm7Bs3vqOaiMvXCHO2tHogOQ1i8MQfUG0UVXl/gf2 tNHMzK239vN+8uLhWhDkSeGPEqUKyHP9n+PdNUTutcnunT1BM1ZomGBigjEPrSGVlDtw OsBNiL5byNBLED4T+Dz0AyR8W6mP8+7n7ojj3N0S/sf1V29Z4XkkpcfeJYSy/PslSs88 aYHbcZBNV+3d1+3xi4yaJOHtih3j6tZdHOKMNpribDsbs2NRlHpo1BqB+VszgqAOspUP s27lvHqoUWsauAqULnQ905uSlttiVqnf7eDRJhUzqePnrMc6avEB022AxaZW7r7bLJxM 3Ctg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Dx97GvNd; 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 f83-20020a25cf56000000b00da05370fdc6si800890ybg.225.2023.10.26.17.06.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 17:06:39 -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=Dx97GvNd; 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 05AA781DEEC5; Thu, 26 Oct 2023 17:06:37 -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 S1345053AbjJ0AGX (ORCPT + 26 others); Thu, 26 Oct 2023 20:06:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234902AbjJ0AGU (ORCPT ); Thu, 26 Oct 2023 20:06:20 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B57C010C6 for ; Thu, 26 Oct 2023 17:06:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698365174; x=1729901174; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Wo2nnVnytmaVY4ED2ACAsxJBNTN+sJf6b78BSdYwC4Y=; b=Dx97GvNdFe8mSdibbYsJqtiQqXkKMZ/KdPSLX5D4E/5NYjf5HGyk3sa/ 7xM12F/3rk2p6IrJYOl3IlElIedGdPm41TnsP27iLdLD8dIMwN3zHPmeA jZX8E4yyfwJG1m1ZWXgUAOiT8ONTKAFKUghGpJgaYve2nNhMT8Na7rK0B 2QgiLsPLZS6iAPCVWVnSPrXKI2z+z02GnBAeRjfhvmHVqC1P4jJP4EJIR TYx1MXseS428/xbTKn+O2YmMkh/j3msjj0qbA71iLlL9MdS8rfyXYPfSq v18qQs/xiHuvwHHrymtT80akPwrxJ9d4cv6Szh/DfSdbTDvB/SUy1LAi3 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10875"; a="390535989" X-IronPort-AV: E=Sophos;i="6.03,255,1694761200"; d="scan'208";a="390535989" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2023 17:06:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10875"; a="883017504" X-IronPort-AV: E=Sophos;i="6.03,255,1694761200"; d="scan'208";a="883017504" Received: from sqa-gate.sh.intel.com (HELO spr-2s5.tsp.org) ([10.239.48.212]) by orsmga004.jf.intel.com with ESMTP; 26 Oct 2023 17:06:10 -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 v10 4/6] mm: Add structure to keep sva information Date: Fri, 27 Oct 2023 08:05:23 +0800 Message-Id: <20231027000525.1278806-5-tina.zhang@intel.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231027000525.1278806-1-tina.zhang@intel.com> References: <20231027000525.1278806-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]); Thu, 26 Oct 2023 17:06:37 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780864987787092142 X-GMAIL-MSGID: 1780864987787092142 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 Signed-off-by: Jason Gunthorpe --- 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 95792bf42f96..a807182c3d2e 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -679,6 +679,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 330f3cd8d5ad..2dbf18e26c5a 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_MM_DATA u32 pasid; + struct iommu_mm_data *iommu_mm; #endif #ifdef CONFIG_KSM /*