From patchwork Mon Nov 26 22:31:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Gortmaker X-Patchwork-Id: 10699235 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 99A0B14D6 for ; Mon, 26 Nov 2018 22:35:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 87FF42A6E0 for ; Mon, 26 Nov 2018 22:35:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7B5D02A74E; Mon, 26 Nov 2018 22:35:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4AC072A6E0 for ; Mon, 26 Nov 2018 22:35:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=LsT/5X2+pEtovDyf8xfY26V9TUbcnFAG5DJmrAvzK+w=; b=VJVf4JEsRo6QCF veWYxRnavuMmdpPtfzszuwUfGNKVVkKPQ25+BGhxrkcFVo6rPOLXS8Z68PRbP0UH8pb1T70P/QSyY DiMk1FrqJJkBMWmwwKM6pC+bmLsLxhQum9h6Z7kzn41So20+/m+QXJHj/I+pd/JncvHddN+LuzcWN tZjyW4UANVeDvlyNLWGa06wNLslQxNLo9FluBYiWQahNykfDRQLEAxx0NTYQfIrfKz7/8rRamqPE9 bVK8l7Wic3a3PzEPycJdvkE09mEsDidlk9DtvOZ11o/S9afKhPg1BLi9+3Q70no/7O2uNrfSxmRW/ 6Wefm0tisUAymCeD5RCw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gRPTm-000844-LM; Mon, 26 Nov 2018 22:35:46 +0000 Received: from casper.infradead.org ([85.118.1.10]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gRPTj-00083A-IC; Mon, 26 Nov 2018 22:35:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:Message-ID: Date:Subject:CC:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=x86V4v3jMutNqSp60Q7Rwi/ortJ/HllH/EjM/MGs3ZQ=; b=KLcGOph3TRPk6alRknum0l9f8A dA/pxmYzEgV7I7+jI3TPKCMXcqY2uN869/WH9KhnZpBIZlEn0osupklIv1LFGbDTEHozgAOTzjFeV qGi+IuUce6RABmrp1nsrJ7xmlD0OraZGAI/+qbQdYB6/L1y/wozhXsKkmQtDBijBQC41neyOXgytU MTa5bqkKYWiTYUutupY9CHaRIOAqjIjGts2LGYHckZehYHj3Eyk5L1qbwg1Oy2M2DehzJVeD5ka5S EXkI3N3t3N10PazI/rV6+XLXIVQDK3u15SlV2Gjc7UiW/FBWz0nepa7WrygFQOdry9QRjQxsN7kJH p2+W2WIw==; Received: from mail5.windriver.com ([192.103.53.11] helo=mail5.wrs.com) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gRPTa-0008C7-Gt; Mon, 26 Nov 2018 22:35:42 +0000 Received: from ALA-HCA.corp.ad.wrs.com (ala-hca.corp.ad.wrs.com [147.11.189.40]) by mail5.wrs.com (8.15.2/8.15.2) with ESMTPS id wAQMVvpu002166 (version=TLSv1 cipher=AES128-SHA bits=128 verify=FAIL); Mon, 26 Nov 2018 14:32:07 -0800 Received: from yow-cube1.wrs.com (128.224.56.98) by ALA-HCA.corp.ad.wrs.com (147.11.189.40) with Microsoft SMTP Server id 14.3.408.0; Mon, 26 Nov 2018 14:31:46 -0800 From: Paul Gortmaker To: Joerg Roedel Subject: [PATCH 0/9] iommu: clean up/remove modular stuff from non-modules. Date: Mon, 26 Nov 2018 17:31:29 -0500 Message-ID: <1543271498-28966-1-git-send-email-paul.gortmaker@windriver.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181126_223540_018718_31F7E616 X-CRM114-Status: GOOD ( 19.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heiko Stuebner , Will Deacon , Daniel Kurtz , Paul Gortmaker , Thierry Reding , Laurent Pinchart , Alexandre Courbot , Simon Xue , Rob Clark , linux-rockchip@lists.infradead.org, linux-tegra@vger.kernel.org, Stephen Warren , linux-arm-msm@vger.kernel.org, Jeffy Chen , linux-mediatek@lists.infradead.org, Stepan Moskovchenko , Honghui Zhang , Matthias Brugger , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, Robin Murphy , Nate Watterson , Hiroshi Doyu Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Cc: Daniel Kurtz Cc: Heiko Stuebner Cc: Hiroshi Doyu Cc: Honghui Zhang Cc: Jeffy Chen Cc: Joerg Roedel Cc: Laurent Pinchart Cc: Matthias Brugger Cc: Nate Watterson Cc: Rob Clark Cc: Robin Murphy Cc: Simon Xue Cc: Stepan Moskovchenko Cc: Stephen Warren Cc: Thierry Reding Cc: Will Deacon 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(-)