Skip to content

Commit b06c076

Browse files
willdeaconjoergroedel
authored andcommitted
Revert "iommu/arm-smmu: Make arm-smmu explicitly non-modular"
This reverts commit addb672. Let's get the SMMU driver building as a module, which means putting back some dead code that we used to carry. Signed-off-by: Will Deacon <will@kernel.org> Tested-by: John Garry <john.garry@huawei.com> # smmu v3 Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 6e8fa74 commit b06c076

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

drivers/iommu/arm-smmu.c

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
#include <linux/interrupt.h>
2828
#include <linux/io.h>
2929
#include <linux/iopoll.h>
30-
#include <linux/init.h>
31-
#include <linux/moduleparam.h>
30+
#include <linux/module.h>
3231
#include <linux/of.h>
3332
#include <linux/of_address.h>
3433
#include <linux/of_device.h>
@@ -60,10 +59,6 @@
6059
#define MSI_IOVA_LENGTH 0x100000
6160

6261
static int force_stage;
63-
/*
64-
* not really modular, but the easiest way to keep compat with existing
65-
* bootargs behaviour is to continue using module_param() here.
66-
*/
6762
module_param(force_stage, int, S_IRUGO);
6863
MODULE_PARM_DESC(force_stage,
6964
"Force SMMU mappings to be installed at a particular stage of translation. A value of '1' or '2' forces the corresponding stage. All other values are ignored (i.e. no stage is forced). Note that selecting a specific stage will disable support for nested translation.");
@@ -1911,6 +1906,7 @@ static const struct of_device_id arm_smmu_of_match[] = {
19111906
{ .compatible = "qcom,smmu-v2", .data = &qcom_smmuv2 },
19121907
{ },
19131908
};
1909+
MODULE_DEVICE_TABLE(of, arm_smmu_of_match);
19141910

19151911
#ifdef CONFIG_ACPI
19161912
static int acpi_smmu_get_data(u32 model, struct arm_smmu_device *smmu)
@@ -2196,12 +2192,12 @@ static int arm_smmu_legacy_bus_init(void)
21962192
}
21972193
device_initcall_sync(arm_smmu_legacy_bus_init);
21982194

2199-
static void arm_smmu_device_shutdown(struct platform_device *pdev)
2195+
static int arm_smmu_device_remove(struct platform_device *pdev)
22002196
{
22012197
struct arm_smmu_device *smmu = platform_get_drvdata(pdev);
22022198

22032199
if (!smmu)
2204-
return;
2200+
return -ENODEV;
22052201

22062202
if (!bitmap_empty(smmu->context_map, ARM_SMMU_MAX_CBS))
22072203
dev_err(&pdev->dev, "removing device with active domains!\n");
@@ -2217,6 +2213,12 @@ static void arm_smmu_device_shutdown(struct platform_device *pdev)
22172213
clk_bulk_disable(smmu->num_clks, smmu->clks);
22182214

22192215
clk_bulk_unprepare(smmu->num_clks, smmu->clks);
2216+
return 0;
2217+
}
2218+
2219+
static void arm_smmu_device_shutdown(struct platform_device *pdev)
2220+
{
2221+
arm_smmu_device_remove(pdev);
22202222
}
22212223

22222224
static int __maybe_unused arm_smmu_runtime_resume(struct device *dev)
@@ -2266,12 +2268,16 @@ static const struct dev_pm_ops arm_smmu_pm_ops = {
22662268

22672269
static struct platform_driver arm_smmu_driver = {
22682270
.driver = {
2269-
.name = "arm-smmu",
2270-
.of_match_table = of_match_ptr(arm_smmu_of_match),
2271-
.pm = &arm_smmu_pm_ops,
2272-
.suppress_bind_attrs = true,
2271+
.name = "arm-smmu",
2272+
.of_match_table = of_match_ptr(arm_smmu_of_match),
2273+
.pm = &arm_smmu_pm_ops,
22732274
},
22742275
.probe = arm_smmu_device_probe,
2276+
.remove = arm_smmu_device_remove,
22752277
.shutdown = arm_smmu_device_shutdown,
22762278
};
2277-
builtin_platform_driver(arm_smmu_driver);
2279+
module_platform_driver(arm_smmu_driver);
2280+
2281+
MODULE_DESCRIPTION("IOMMU API for ARM architected SMMU implementations");
2282+
MODULE_AUTHOR("Will Deacon <will.deacon@arm.com>");
2283+
MODULE_LICENSE("GPL v2");

0 commit comments

Comments
 (0)