Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 73DC38838 for ; Mon, 13 Mar 2023 20:38:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678739888; x=1710275888; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kuBMCkUjwmOHyTPzkVALxDPf/dAuO+xl8IQ19U3bZXw=; b=I8qn41LmpXUPtGHHNDF4KyLtU3CPwu3VQahf6G1jSQmbLzNEUa4poFec MYm2ia4sSRi+x2chQ/PQ+kPuhWACAz18yeLynUU6e8zI/Guqr4JgHqNSN qMpni1YKqvZtEvm7L5M2Sime0SqgBCXREFJb6x53Pey+AIUJf0S0RY2Em JRL5U71LszfY7xKz5S6x3CfpBSMGwukIY3j9JIi/QWlUWM2Wdx59jQzfn +LG5fO5RFlxT0dkkP0WLCV/h8Q2bAEGpgZO37exP+Z9o1+ybEvc0Oi+K/ iLWuMF6fSFADCCWOsWeadmqhAicn3M1/ILdLbiPenicwdP6SXUW+/oWoQ Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10648"; a="334732057" X-IronPort-AV: E=Sophos;i="5.98,257,1673942400"; d="scan'208";a="334732057" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Mar 2023 13:38:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10648"; a="802584778" X-IronPort-AV: E=Sophos;i="5.98,257,1673942400"; d="scan'208";a="802584778" Received: from srinivas-otcpl-7600.jf.intel.com (HELO jacob-builder.jf.intel.com) ([10.54.39.106]) by orsmga004.jf.intel.com with ESMTP; 13 Mar 2023 13:38:05 -0700 From: Jacob Pan To: LKML , iommu@lists.linux.dev, Jason Gunthorpe , "Lu Baolu" , Joerg Roedel , Jean-Philippe Brucker , "Robin Murphy" , Dave Hansen , Thomas Gleixner , X86 Kernel , bp@alien8.de, "H. Peter Anvin" , Peter Zijlstra , corbet@lwn.net, vkoul@kernel.org, dmaengine@vger.kernel.org, linux-doc@vger.kernel.org Cc: "Will Deacon" , David Woodhouse , Raj Ashok , "Tian, Kevin" , Yi Liu , "Yu, Fenghua" , Dave Jiang , Kirill Shutemov , Tony Luck , Jacob Pan Subject: [PATCH v6 3/7] iommu/sva: Remove PASID to mm lookup function Date: Mon, 13 Mar 2023 13:41:54 -0700 Message-Id: <20230313204158.1495067-4-jacob.jun.pan@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230313204158.1495067-1-jacob.jun.pan@linux.intel.com> References: <20230313204158.1495067-1-jacob.jun.pan@linux.intel.com> Precedence: bulk X-Mailing-List: iommu@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit There is no user of iommu_sva_find() function, remove it so that PASID allocator can be a simple IDA. Device drivers are expected to store and keep track of their own PASID metadata. Signed-off-by: Jason Gunthorpe Signed-off-by: Jacob Pan --- drivers/iommu/iommu-sva.c | 20 -------------------- drivers/iommu/iommu-sva.h | 1 - 2 files changed, 21 deletions(-) diff --git a/drivers/iommu/iommu-sva.c b/drivers/iommu/iommu-sva.c index fcfdc80a3939..4f357ef14f04 100644 --- a/drivers/iommu/iommu-sva.c +++ b/drivers/iommu/iommu-sva.c @@ -51,26 +51,6 @@ int iommu_sva_alloc_pasid(struct mm_struct *mm, ioasid_t min, ioasid_t max) } EXPORT_SYMBOL_GPL(iommu_sva_alloc_pasid); -/* ioasid_find getter() requires a void * argument */ -static bool __mmget_not_zero(void *mm) -{ - return mmget_not_zero(mm); -} - -/** - * iommu_sva_find() - Find mm associated to the given PASID - * @pasid: Process Address Space ID assigned to the mm - * - * On success a reference to the mm is taken, and must be released with mmput(). - * - * Returns the mm corresponding to this PASID, or an error if not found. - */ -struct mm_struct *iommu_sva_find(ioasid_t pasid) -{ - return ioasid_find(&iommu_sva_pasid, pasid, __mmget_not_zero); -} -EXPORT_SYMBOL_GPL(iommu_sva_find); - /** * iommu_sva_bind_device() - Bind a process address space to a device * @dev: the device diff --git a/drivers/iommu/iommu-sva.h b/drivers/iommu/iommu-sva.h index 7215a761b962..102eae1817a2 100644 --- a/drivers/iommu/iommu-sva.h +++ b/drivers/iommu/iommu-sva.h @@ -9,7 +9,6 @@ #include int iommu_sva_alloc_pasid(struct mm_struct *mm, ioasid_t min, ioasid_t max); -struct mm_struct *iommu_sva_find(ioasid_t pasid); /* I/O Page fault */ struct device; -- 2.25.1