Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp978868pxf; Thu, 25 Mar 2021 20:25:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOY+HKZPsrHyMDySHTDXLFeInbW19Kb0nyzMqwOd60wxzMvvcuUJU2Zu88hdbxUCsMB1ZX X-Received: by 2002:a17:906:3488:: with SMTP id g8mr12681235ejb.282.1616729120872; Thu, 25 Mar 2021 20:25:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616729120; cv=none; d=google.com; s=arc-20160816; b=Fsd2i3rQnmN5NF7h9K1Q5In4rwxM6ymdh9DsGCk2pwoD9OIxq/7jaXp2sPecVTibDi W7zQeOnrIgl9UBefkuPPEB1+nGktpma3JXdKhbcQFQMbDTxme3rMGk37dF28qIfT6qhq EJda3Xb86Guh55d7ssLd70nRw3NQNU5vsqRpn8rmdtpsy35XoA/dDiYJrpyjhxUgYzo2 Skpy28LXW0vQCaqc8aT1TU+N2nmGOUPZM8N9Bjhm3mwVtzLKLiBT//OfNkWZF7euc9Mc HAc25q2FqumDQXhFlc9ndYhmbMarh+NUtu0DUT1f05RFspDBQpJ/Lr0kfASDuz/dayqR WGKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=YVl+gKzH0fwDQkMu1u9sXWgm596hh4uCCtSj4fj/28I=; b=UXfG9jbFl3zFdSuq9wMV+Z8UtfON7nuz7YaXUdYTp332NPPhn8W638l3DOkB2jBat9 DMwzzUZycooUmAvcZt5NpHsxYU+HoEsoi/5Si/1riYD4HXJ97sOYyY2WEgqLmL9hP2k0 wi5bzSoInDp7mNJn3nX3R9NDF5i0mxk+vNgkU78p1tWDz0kkEzv+OEKgScb4vc0wdazw 1qFm/pr9MWpKcu6djXiWNC3ZgKzd7/2EyHm3VI7tw8ope1EjTeB/FODZwS8x+YKh0WuG BFHV2BCgF8k//2IsybZKzytVelIbk9/6wgSq2RS6BUcoF4lc/8FzCe7dmzPF1Y4NlN3l xZEQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bn9si5950448ejb.23.2021.03.25.20.24.57; Thu, 25 Mar 2021 20:25:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230324AbhCZDYN (ORCPT + 99 others); Thu, 25 Mar 2021 23:24:13 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:48733 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S230222AbhCZDXt (ORCPT ); Thu, 25 Mar 2021 23:23:49 -0400 X-UUID: e8e2e366388342db8bebe07cf6d2f5b0-20210326 X-UUID: e8e2e366388342db8bebe07cf6d2f5b0-20210326 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1594774408; Fri, 26 Mar 2021 11:23:46 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 26 Mar 2021 11:23:45 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 26 Mar 2021 11:23:44 +0800 From: Yong Wu To: Joerg Roedel , Matthias Brugger , Will Deacon CC: Robin Murphy , Tomasz Figa , , , , , , Krzysztof Kozlowski , , , Nicolas Boichat , , Subject: [PATCH v2 1/2] iommu/mediatek-v1: Allow building as module Date: Fri, 26 Mar 2021 11:23:36 +0800 Message-ID: <20210326032337.24578-1-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch only adds support for building the IOMMU-v1 driver as module. Correspondingly switch the config to tristate and update the iommu_ops's owner to THIS_MODULE. Signed-off-by: Yong Wu --- v2: change note: a) Update iommu_ops's owner to THIS_MODULE b) Fix typo in the title from "Alloc" to "Allow" v1: rebase on v5.12-rc2 --- drivers/iommu/Kconfig | 2 +- drivers/iommu/mtk_iommu_v1.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig index 192ef8f61310..bc93da48bed0 100644 --- a/drivers/iommu/Kconfig +++ b/drivers/iommu/Kconfig @@ -364,7 +364,7 @@ config MTK_IOMMU If unsure, say N here. config MTK_IOMMU_V1 - bool "MTK IOMMU Version 1 (M4U gen1) Support" + tristate "MediaTek IOMMU Version 1 (M4U gen1) Support" depends on ARM depends on ARCH_MEDIATEK || COMPILE_TEST select ARM_DMA_USE_IOMMU diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c index 82ddfe9170d4..be1b20e3f20e 100644 --- a/drivers/iommu/mtk_iommu_v1.c +++ b/drivers/iommu/mtk_iommu_v1.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -529,6 +530,7 @@ static const struct iommu_ops mtk_iommu_ops = { .def_domain_type = mtk_iommu_def_domain_type, .device_group = generic_device_group, .pgsize_bitmap = ~0UL << MT2701_IOMMU_PAGE_SHIFT, + .owner = THIS_MODULE, }; static const struct of_device_id mtk_iommu_of_ids[] = { @@ -691,9 +693,7 @@ static struct platform_driver mtk_iommu_driver = { .pm = &mtk_iommu_pm_ops, } }; +module_platform_driver(mtk_iommu_driver); -static int __init m4u_init(void) -{ - return platform_driver_register(&mtk_iommu_driver); -} -subsys_initcall(m4u_init); +MODULE_DESCRIPTION("IOMMU API for MediaTek M4U v1 implementations"); +MODULE_LICENSE("GPL v2"); -- 2.18.0