* [PATCH 0/9] iommu: clean up/remove modular stuff from non-modules.
@ 2018-11-26 22:31 Paul Gortmaker
[not found] ` <1543271498-28966-1-git-send-email-paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
2018-11-27 10:11 ` [PATCH 0/9] iommu: clean up/remove modular stuff from non-modules Joerg Roedel
0 siblings, 2 replies; 4+ messages in thread
From: Paul Gortmaker @ 2018-11-26 22:31 UTC (permalink / raw)
To: Joerg Roedel
Cc: Heiko Stuebner, Will Deacon, Daniel Kurtz, Paul Gortmaker,
Thierry Reding, Laurent Pinchart, Alexandre Courbot, Simon Xue,
Rob Clark, linux-rockchip, linux-tegra, Stephen Warren,
linux-arm-msm, Jeffy Chen, linux-mediatek, Stepan Moskovchenko,
Honghui Zhang, Matthias Brugger, linux-arm-kernel, linux-kernel,
iommu, Robin Murphy, Nate Watterson, Hi
The work here represents a scan over the iommu dir, looking for files/drivers
that have nothing to do with a modular use case, but are using modular
infrastructure regardless.
We are trying to make driver code consistent with the Makefiles/Kconfigs that
control them. This means not using modular functions/macros for drivers that
can never be built as a module. I've done this in other subsystem dirs
already, and some of this has already happened in drivers/iommu by others;
such as 98b72b94def9 ("iommu/rockchip: Prohibit unbind and remove").
Using modular infrastructure in non-modules might seem harmless, but some
of the downfalls this leads to are:
(1) it is easy to accidentally write unused module_exit and remove code
(2) it can be misleading when reading the source, thinking it can be
modular when the Makefile and/or Kconfig prohibit it
(3) it requires the include of the module.h header file which in turn
includes nearly everything else, thus adding to CPP overhead.
(4) it gets copied/replicated into other drivers and spreads quickly.
The last two commits (arm-smmu related ones) deserve an extra mention,
and I put them at the end in case they want to be deferred for later or
altered. Normally a "module-ectomy" allows us to delete the ".remove"
function, as per the rockchip commit above, but ...
A kexec commit (7aa8619a66ae) tried to improve reliability by trying to
shutdown the iommu in the compromised/crashing kernel, but of course the
better solution is to have the recovery kernel be able to handle all of
the possible initial conditions. It appears this was done later in the
commit b63b3439b856 - but I don't know if that means relying on an
orderly shutdown is no longer required - I don't have the platform and
am only going on what is in git history.
So, as the kexec commit recycled the ".remove" handle to also be the
".shutdown" handle, in this series the remove function was renamed to
shutdown, and the ".remove" handle was deleted. This was IMHO the most
back compatible way to make this update. If the reliance on the
compromised kernel to run ".shutdown" is no longer necessary, then it
can be removed in a future change.
Patches were build tested on top of next-20181122 for ARM, ARM64, x86-64
on an allyesconfig.
Paul.
---
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: Daniel Kurtz <djkurtz@chromium.org>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: Hiroshi Doyu <hdoyu@nvidia.com>
Cc: Honghui Zhang <honghui.zhang@mediatek.com>
Cc: Jeffy Chen <jeffy.chen@rock-chips.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: Nate Watterson <nwatters@codeaurora.org>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: Simon Xue <xxm@rock-chips.com>
Cc: Stepan Moskovchenko <stepanm@codeaurora.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: iommu@lists.linux-foundation.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-arm-msm@vger.kernel.org
Cc: linux-mediatek@lists.infradead.org
Cc: linux-rockchip@lists.infradead.org
Cc: linux-tegra@vger.kernel.org
Paul Gortmaker (9):
iommu: audit and remove any unnecessary uses of module.h
iommu: rockchip: make it explicitly non-modular
iommu: msm_iommu: make it explicitly non-modular
iommu: mtk_iommu: make it explicitly non-modular
iommu: ipmmu-vmsa: make it explicitly non-modular
iommu: qcom_iommu: make it explicitly non-modular
iommu: tegra-gart: make it explicitly non-modular
iommu: arm-smmu: make it explicitly non-modular
iommu: arm-smmu-v3: make it explicitly non-modular
drivers/iommu/arm-smmu-v3.c | 25 +++++++++----------------
drivers/iommu/arm-smmu.c | 32 +++++++++++++-------------------
drivers/iommu/iommu-sysfs.c | 2 +-
drivers/iommu/iommu.c | 3 ++-
drivers/iommu/ipmmu-vmsa.c | 16 +++-------------
drivers/iommu/msm_iommu.c | 13 +++----------
drivers/iommu/mtk_iommu_v1.c | 15 +++------------
drivers/iommu/qcom_iommu.c | 16 ++--------------
drivers/iommu/rockchip-iommu.c | 13 ++++++-------
drivers/iommu/tegra-gart.c | 37 +++++++------------------------------
10 files changed, 49 insertions(+), 123 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 4+ messages in thread[parent not found: <1543271498-28966-1-git-send-email-paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>]
* [PATCH 6/9] iommu: qcom_iommu: make it explicitly non-modular
[not found] ` <1543271498-28966-1-git-send-email-paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
@ 2018-11-26 22:31 ` Paul Gortmaker
0 siblings, 0 replies; 4+ messages in thread
From: Paul Gortmaker @ 2018-11-26 22:31 UTC (permalink / raw)
To: Joerg Roedel
Cc: Paul Gortmaker, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-arm-msm-u79uwXL29TY76Z2rM5mHXA
The Kconfig currently controlling compilation of this code is:
drivers/iommu/Kconfig:config MTK_IOMMU_V1
drivers/iommu/Kconfig: bool "MTK IOMMU Version 1 (M4U gen1) Support"
...meaning that it currently is not being built as a module by anyone.
Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.
Since module_init just becomes device_initcall for non-modules, the
init ordering remains unchanged with this commit.
Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.
We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.
Cc: Rob Clark <robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Paul Gortmaker <paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
---
drivers/iommu/qcom_iommu.c | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)
diff --git a/drivers/iommu/qcom_iommu.c b/drivers/iommu/qcom_iommu.c
index ee70e9921cf1..4c8f4fc54106 100644
--- a/drivers/iommu/qcom_iommu.c
+++ b/drivers/iommu/qcom_iommu.c
@@ -29,7 +29,7 @@
#include <linux/iommu.h>
#include <linux/iopoll.h>
#include <linux/kconfig.h>
-#include <linux/module.h>
+#include <linux/init.h>
#include <linux/mutex.h>
#include <linux/of.h>
#include <linux/of_address.h>
@@ -908,7 +908,6 @@ static const struct of_device_id qcom_iommu_of_match[] = {
{ .compatible = "qcom,msm-iommu-v1" },
{ /* sentinel */ }
};
-MODULE_DEVICE_TABLE(of, qcom_iommu_of_match);
static struct platform_driver qcom_iommu_driver = {
.driver = {
@@ -934,15 +933,4 @@ static int __init qcom_iommu_init(void)
return ret;
}
-
-static void __exit qcom_iommu_exit(void)
-{
- platform_driver_unregister(&qcom_iommu_driver);
- platform_driver_unregister(&qcom_iommu_ctx_driver);
-}
-
-module_init(qcom_iommu_init);
-module_exit(qcom_iommu_exit);
-
-MODULE_DESCRIPTION("IOMMU API for QCOM IOMMU v1 implementations");
-MODULE_LICENSE("GPL v2");
+device_initcall(qcom_iommu_init);
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/9] iommu: clean up/remove modular stuff from non-modules.
2018-11-26 22:31 [PATCH 0/9] iommu: clean up/remove modular stuff from non-modules Paul Gortmaker
[not found] ` <1543271498-28966-1-git-send-email-paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
@ 2018-11-27 10:11 ` Joerg Roedel
[not found] ` <20181127101156.GA12298-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
1 sibling, 1 reply; 4+ messages in thread
From: Joerg Roedel @ 2018-11-27 10:11 UTC (permalink / raw)
To: Paul Gortmaker
Cc: iommu, linux-kernel, Alexandre Courbot, Daniel Kurtz,
Heiko Stuebner, Hiroshi Doyu, Honghui Zhang, Jeffy Chen,
Laurent Pinchart, Matthias Brugger, Nate Watterson, Rob Clark,
Robin Murphy, Simon Xue, Stepan Moskovchenko, Stephen Warren,
Thierry Reding, Will Deacon, linux-arm-kernel, linux-arm-msm
Hi Paul,
thanks for your cleanup!
The iommu-tree uses another rule for the subject line of patches. Can
you please resend with correct subject lines? See below for what is
used.
The general format is:
iommu/<driver>: _C_apital letter starting subject
Please also collect the Acks you get and add them to the patches before
the resend.
On Mon, Nov 26, 2018 at 05:31:29PM -0500, Paul Gortmaker wrote:
> Paul Gortmaker (9):
> iommu: audit and remove any unnecessary uses of module.h
Fine.
> iommu: rockchip: make it explicitly non-modular
iommu/rockchip: Make it explicitly non-modular
> iommu: msm_iommu: make it explicitly non-modular
iommu/msm: Make it explicitly non-modular
> iommu: mtk_iommu: make it explicitly non-modular
iommu/mediatek: Make it explicitly non-modular
> iommu: ipmmu-vmsa: make it explicitly non-modular
iommu/ipmmu-vmsa: Make it explicitly non-modular
> iommu: qcom_iommu: make it explicitly non-modular
iommu/qcom: Make it explicitly non-modular
> iommu: tegra-gart: make it explicitly non-modular
iommu/tegra: Make it explicitly non-modular
> iommu: arm-smmu: make it explicitly non-modular
iommu/arm-smmu: Make arm-smmu explicitly non-modular
> iommu: arm-smmu-v3: make it explicitly non-modular
iommu/arm-smmu: Make arm-smmu-v3 explicitly non-modular
Thanks a lot,
Joerg
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-11-27 14:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-26 22:31 [PATCH 0/9] iommu: clean up/remove modular stuff from non-modules Paul Gortmaker
[not found] ` <1543271498-28966-1-git-send-email-paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
2018-11-26 22:31 ` [PATCH 6/9] iommu: qcom_iommu: make it explicitly non-modular Paul Gortmaker
2018-11-27 10:11 ` [PATCH 0/9] iommu: clean up/remove modular stuff from non-modules Joerg Roedel
[not found] ` <20181127101156.GA12298-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2018-11-27 14:39 ` Paul Gortmaker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).