Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp3558220rwl; Mon, 27 Mar 2023 16:19:21 -0700 (PDT) X-Google-Smtp-Source: AK7set8xeYNCpcaAve/4EQXbOCZo/7atHvgWgKtGX14mXZfagy7kaNMDCOPxyRLZLwW0WO5ecH+6 X-Received: by 2002:a05:6a20:2a08:b0:da:5e10:799b with SMTP id e8-20020a056a202a0800b000da5e10799bmr11323710pzh.10.1679959161624; Mon, 27 Mar 2023 16:19:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679959161; cv=none; d=google.com; s=arc-20160816; b=NMv/TUcor+lUyLTTdIryZr6eeoI5xTXzDEH9U6zHoaSRP/OqwHg76+0bIR3v78AS4e tiqh3ePrqNcDiXY04MuxkSp8P0hDFPDJbBRh+PcQkpKlnfb3WP5KJTbba1kORI2efnbo /J+LQHt20CXlZVg5sHO+ADVw79IWAhW+t/FzL3CqDrUq5ykZ5EJBRPHzQiZvVt6/CC9z +W6VflLXRnahs7enzVdIqAdhvehpp5nreCe+mpTdYA5WhodYuJL9CjpbaPYo/2+F87Xe Nf3NaA9lmDxyyi98AzwdxMLCcJboxx4HCTbLZz45muUjyfhkkiLyjE/OdAA2UTBw3OJa 3Atg== 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=mNjApifTmeP6eYDkC1ZApGTFagvMaI59AleOHkGIa2U=; b=N6pd12bVTF3RJTkWwvMkpH8MaYO/EjJziantxYrteStJ3pqOPSU6RDHOxpYARGMmFH PuwChQ+CxzhT8HMlwMnmzLRBI6V/7GQq7a3fh0hnohrqiZPsiHxhlhGRgpsJ1RHlmZj1 TD2OoDKIyVejVExCye7u8ZwcaGEVbUjpKND0IoFsaJ64K0RPi1RubPq2KthfcgytPuLw 2U/YJK1H7+ALqOD8MfbCwj3Kd5ma+EyCN+yKcawRsHJkce6rau/YTKqfmzuLzZkUK8XX l18UtAZ6Uwj6arMDPHjN/IDzpvsJt9S8251dvEO/PW/2/r2fLBIA73/QOa9fDTEw1TaG dU8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=D8zgaojw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 35-20020a630f63000000b0050327dc5ff0si28512357pgp.491.2023.03.27.16.19.09; Mon, 27 Mar 2023 16:19:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=D8zgaojw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232202AbjC0XR6 (ORCPT + 99 others); Mon, 27 Mar 2023 19:17:58 -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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 */ /** -- 2.25.1