From patchwork Thu Mar 9 22:21:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacob Pan X-Patchwork-Id: 13168413 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D00AFC74A4B for ; Thu, 9 Mar 2023 22:18:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230403AbjCIWSQ (ORCPT ); Thu, 9 Mar 2023 17:18:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231166AbjCIWSM (ORCPT ); Thu, 9 Mar 2023 17:18:12 -0500 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6538A29410; Thu, 9 Mar 2023 14:18:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678400290; x=1709936290; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kuBMCkUjwmOHyTPzkVALxDPf/dAuO+xl8IQ19U3bZXw=; b=ICkXxMqmVJB77e4FP7Moe69l7L5+2cQPVX1EnQnW26a6+R9XMvHw9FN1 XD8jPsxdW6l/MTQlhoZDrBxpBomaYxNhnUr5tP47vre9ngDByc65dWUfz /sQV01PsB4mrpOq9k8PcJYYesGPDYu4ncDO1T5eu6D+q5vIUxMsGPdecA vQTkF2Qyv92MK6HCiMLdUFjhax19sM29Dv8edXpm3yzFc9ZLA3IRQI05v DyNaYRwS5Kx6b0XI1x0e0ltFImPRq3g+S3IWOtLPSvKpJ+tnKccIqx3Um j7iR5QS5XcNOoMIx7bEAkVoWX8xD+Tez/H+t2S11d7xxzMFRVd1SAn13U w==; X-IronPort-AV: E=McAfee;i="6500,9779,10644"; a="364235229" X-IronPort-AV: E=Sophos;i="5.98,247,1673942400"; d="scan'208";a="364235229" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2023 14:18:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10644"; a="707788841" X-IronPort-AV: E=Sophos;i="5.98,247,1673942400"; d="scan'208";a="707788841" Received: from srinivas-otcpl-7600.jf.intel.com (HELO jacob-builder.jf.intel.com) ([10.54.39.106]) by orsmga008.jf.intel.com with ESMTP; 09 Mar 2023 14:18:08 -0800 From: Jacob Pan To: LKML , iommu@lists.linux.dev, Jason Gunthorpe , "Lu Baolu" , Joerg Roedel , Jean-Philippe Brucker , 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: "Robin Murphy" , "Will Deacon" , David Woodhouse , Raj Ashok , "Tian, Kevin" , Yi Liu , "Yu, Fenghua" , Dave Jiang , Kirill Shutemov , Tony Luck , Jacob Pan Subject: [PATCH v5 3/7] iommu/sva: Remove PASID to mm lookup function Date: Thu, 9 Mar 2023 14:21:55 -0800 Message-Id: <20230309222159.487826-5-jacob.jun.pan@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230309222159.487826-1-jacob.jun.pan@linux.intel.com> References: <20230309222159.487826-1-jacob.jun.pan@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org 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 Reviewed-by: Lu Baolu --- 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;