Skip to content

iommu: clean up/remove modular stuff from non-modules.

Paul Gortmaker linux-arm-kernel linux-arm-msm linux-iommu linux-mediatek linux-rockchip linux-tegra lkml 2 versions – Applied

Status from this message: Applied all, thanks Paul.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest9 patches 1 replyApplied
  2. v19 patches 13 repliesSuperseded

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/9iommu: audit and remove any unnecessary uses of module.hdrivers/iommu/iommu-sysfs.c drivers/iommu/iommu.c+3 -20 replies
2/9iommu/rockchip: Make it explicitly non-modulardrivers/iommu/rockchip-iommu.c+6 -70 replies
3/9iommu/msm: Make it explicitly non-modulardrivers/iommu/msm_iommu.c+3 -100 replies
4/9iommu/mediatek: Make it explicitly non-modulardrivers/iommu/mtk_iommu_v1.c+3 -120 replies
5/9iommu/ipmmu-vmsa: Make it explicitly non-modulardrivers/iommu/ipmmu-vmsa.c+3 -150 replies
6/9iommu/qcom: Make it explicitly non-modulardrivers/iommu/qcom_iommu.c+2 -140 replies
7/9iommu/tegra: Make it explicitly non-modulardrivers/iommu/tegra-gart.c+7 -300 replies
8/9iommu/arm-smmu: Make arm-smmu explicitly non-modulardrivers/iommu/arm-smmu.c+13 -190 replies
9/9iommu/arm-smmu: Make arm-smmu-v3 explicitly non-modulardrivers/iommu/arm-smmu-v3.c+9 -160 replies

Reviews trailers per patch

6 of 9 patches have a Reviewed-by or Acked-by.

PatchHeiko StuebnerHonghui ZhangLaurent PinchartThierry RedingRobin Murphy
1/9
2/9A-b
3/9
4/9A-b
5/9R-b
6/9
7/9A-b
8/9A-b
9/9A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 5 reviewers.

Read the v2 thread

Cover letter [PATCH v2 0/9] iommu: clean up/remove modular stuff from non-modules.

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-20181128 for ARM, ARM64, x86-64 on an allyesconfig.

Paul.

---

[ v2: use recommended iommu subject format, add Acks, trivial tweaks. ]

Cc Alexandre Courbot <[email protected]>
Cc Daniel Kurtz <[email protected]>
Cc Heiko Stuebner <[email protected]>
Cc Hiroshi Doyu <[email protected]>
Cc Honghui Zhang <honghui.zhang-NuS5LvNUpcJWk0Htik3J/[email protected]>
Cc Jeffy Chen <[email protected]>
Cc Joerg Roedel <[email protected]>
Cc Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/[email protected]>
Cc Matthias Brugger <[email protected]>
Cc Nate Watterson <[email protected]>
Cc Rob Clark <[email protected]>
Cc Robin Murphy <[email protected]>
Cc Simon Xue <[email protected]>
Cc Stepan Moskovchenko <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Thierry Reding <[email protected]>
Cc Will Deacon <[email protected]>
Cc iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Cc linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org

Paul Gortmaker (9):
iommu: audit and remove any unnecessary uses of module.h iommu/rockchip: Make it explicitly non-modular iommu/msm: Make it explicitly non-modular iommu/mediatek: Make it explicitly non-modular iommu/ipmmu-vmsa: Make it explicitly non-modular iommu/qcom: Make it explicitly non-modular iommu/tegra: Make it explicitly non-modular iommu/arm-smmu: Make arm-smmu explicitly non-modular iommu/arm-smmu: Make arm-smmu-v3 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     | 18 +++---------------
 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(+), 125 deletions(-)
Signature · 1 line
2.7.4