From patchwork Tue Jan 3 16:34:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fenghua Yu X-Patchwork-Id: 13087672 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 A7F02C54EBC for ; Tue, 3 Jan 2023 16:35:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238122AbjACQf2 (ORCPT ); Tue, 3 Jan 2023 11:35:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230431AbjACQfT (ORCPT ); Tue, 3 Jan 2023 11:35:19 -0500 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93F9BE032 for ; Tue, 3 Jan 2023 08:35:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672763718; x=1704299718; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YGmCRw23hc83hc1Hm9zD3o3OuJY1E8OGzBfqIp9cLms=; b=jYturswOSBQLxIFC+2LpH7Jg8k0MOHQwZDwxpq0Wbc6i7fn7ulEv/FVu PC8AgHVk4vIzjeNr4mfaxRJvNhSYhBnIqBs8bIF4ZVEQtF/rQW6UFKmy3 E/P4xEgTMLlaQzr8IotAhVeFAeBDZddvQRqc4L9y9tWhTiqy8f/bdLTEB e6Q1a+1uN+9z/teJGismt2BVhquE0acM7TyWziBuhfLlQr8gJRE8yRSrs CoI6YojAi4lB+ptnnHOdgmmWTNi0biIb275++N0+tmztroXTWGfCMwy9o 8EDEbSreoqPdrHS9EKy5ys16jWJnVlpBeNy/la4qXAfDV40dkOu3Ti3tO w==; X-IronPort-AV: E=McAfee;i="6500,9779,10579"; a="302072322" X-IronPort-AV: E=Sophos;i="5.96,297,1665471600"; d="scan'208";a="302072322" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jan 2023 08:35:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10579"; a="604858514" X-IronPort-AV: E=Sophos;i="5.96,297,1665471600"; d="scan'208";a="604858514" Received: from fyu1.sc.intel.com ([172.25.103.126]) by orsmga003.jf.intel.com with ESMTP; 03 Jan 2023 08:35:13 -0800 From: Fenghua Yu To: "Vinod Koul" , "Dave Jiang" Cc: "Fenghua Yu" , dmaengine@vger.kernel.org, Tony Zhu , Joerg Roedel , Will Deacon , Robin Murphy , iommu@lists.linux.dev Subject: [PATCH 08/17] iommu: expose iommu_sva_find() to common header Date: Tue, 3 Jan 2023 08:34:56 -0800 Message-Id: <20230103163505.1569356-9-fenghua.yu@intel.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20230103163505.1569356-1-fenghua.yu@intel.com> References: <20230103163505.1569356-1-fenghua.yu@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org From: Dave Jiang Move iommu_sva_find() prototype to global header from local header in order to allow drivers to call the function. Used by idxd driver to find the mm from device reported PASID. The symbol is already exported. Tested-by: Tony Zhu Signed-off-by: Dave Jiang Co-developed-by: Fenghua Yu Signed-off-by: Fenghua Yu Cc: Joerg Roedel Cc: Will Deacon Cc: Robin Murphy Cc: iommu@lists.linux.dev --- drivers/iommu/iommu-sva.h | 1 - include/linux/iommu.h | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) 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; diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 46e1347bfa22..7db16ca3f519 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -704,6 +704,8 @@ void iommu_release_device(struct device *dev); int iommu_dev_enable_feature(struct device *dev, enum iommu_dev_features f); int iommu_dev_disable_feature(struct device *dev, enum iommu_dev_features f); +struct mm_struct *iommu_sva_find(ioasid_t pasid); + int iommu_device_use_default_domain(struct device *dev); void iommu_device_unuse_default_domain(struct device *dev); @@ -1042,6 +1044,11 @@ iommu_dev_disable_feature(struct device *dev, enum iommu_dev_features feat) return -ENODEV; } +static inline struct mm_struct *iommu_sva_find(ioasid_t pasid) +{ + return ERR_PTR(-ENODEV); +} + static inline struct iommu_fwspec *dev_iommu_fwspec_get(struct device *dev) { return NULL;