From patchwork Mon Mar 27 23:21:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacob Pan X-Patchwork-Id: 13190230 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 B0F64C77B61 for ; Mon, 27 Mar 2023 23:17:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231543AbjC0XRp (ORCPT ); Mon, 27 Mar 2023 19:17:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230514AbjC0XRm (ORCPT ); Mon, 27 Mar 2023 19:17:42 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC087213F; Mon, 27 Mar 2023 16:17: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=1679959061; x=1711495061; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PlaKwgtgTDIkuR0MFbRqGUwlPRGR8ZvdcCBZ4YoMyBU=; b=D8zgaojwGl8fMz/DIo+T55LzHoJ5FXbxw4D6KemSZ49OeclImt0G0Ful luLGmKvysG3H0tlHHtddyQV9eLRo5h8IUlw3AvsgDZs/F5n2Dy/vQr9CF B8+oLsxNZvyvS2shhqb8ZtzDdRz4GPYypbhL+gQK4WPbsYhqn9aQ+vQzb OSfefr/v1BkDs9GKrC2ZWXJrrLeISqx9LfbAXtA6uVqPdyf0fr7ri2/9d ksAWMTF3o8lrtwfPB0ae0AJZESssAKDcq3JuHW+y954YOMuT3uEmREQ3p jEl2Ss68spgr9VXkKusMEFsy2u8r0QA+ngpllHcqZJgptEnceYBzCeYxU w==; X-IronPort-AV: E=McAfee;i="6600,9927,10662"; a="320817344" X-IronPort-AV: E=Sophos;i="5.98,295,1673942400"; d="scan'208";a="320817344" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2023 16:17:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10662"; a="686144744" X-IronPort-AV: E=Sophos;i="5.98,295,1673942400"; d="scan'208";a="686144744" Received: from srinivas-otcpl-7600.jf.intel.com (HELO jacob-builder.jf.intel.com) ([10.54.39.106]) by fmsmga007.fm.intel.com with ESMTP; 27 Mar 2023 16:17:41 -0700 From: Jacob Pan To: LKML , iommu@lists.linux.dev, Jason Gunthorpe , "Lu Baolu" , Joerg Roedel , dmaengine@vger.kernel.org, vkoul@kernel.org Cc: "Robin Murphy" , "Will Deacon" , David Woodhouse , Raj Ashok , "Tian, Kevin" , Yi Liu , "Yu, Fenghua" , Dave Jiang , Tony Luck , "Zanussi, Tom" , Jacob Pan Subject: [PATCH v2 7/8] iommu: Export iommu_get_dma_domain Date: Mon, 27 Mar 2023 16:21:37 -0700 Message-Id: <20230327232138.1490712-8-jacob.jun.pan@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230327232138.1490712-1-jacob.jun.pan@linux.intel.com> References: <20230327232138.1490712-1-jacob.jun.pan@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org Devices that use ENQCMDS to submit work needs to retrieve its DMA domain. It can then attach PASID to the DMA domain for shared mapping (with RID) established by DMA API. Signed-off-by: Jacob Pan --- drivers/iommu/iommu.c | 1 + include/linux/iommu.h | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 10db680acaed..c51d343a75d2 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -2118,6 +2118,7 @@ struct iommu_domain *iommu_get_dma_domain(struct device *dev) { return dev->iommu_group->default_domain; } +EXPORT_SYMBOL_GPL(iommu_get_dma_domain); /* * IOMMU groups are really the natural working unit of the IOMMU, but diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 0471089dc1d0..1ef9a1109534 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -1089,6 +1089,11 @@ iommu_get_domain_for_dev_pasid(struct device *dev, ioasid_t pasid, { return NULL; } + +static inline struct iommu_domain *iommu_get_dma_domain(struct device *dev) +{ + return NULL; +} #endif /* CONFIG_IOMMU_API */ /**