Re: [PATCH v8 2/7] iommu/arm-smmu-qcom-debug: Add support for TBUs

From: Georgi Djakov
Date: Thu May 02 2024 - 12:54:15 EST


Hi Will,

On 1.05.24 17:34, Will Deacon wrote:
Hi Georgi,

On Wed, Apr 17, 2024 at 06:37:26AM -0700, Georgi Djakov wrote:
diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom-debug.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom-debug.c
index bb89d49adf8d..eff7ca94ec8d 100644
--- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom-debug.c
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom-debug.c

...

+static const struct of_device_id qcom_tbu_of_match[] = {
+ { .compatible = "qcom,sc7280-tbu" },
+ { .compatible = "qcom,sdm845-tbu" },
+ { }
+};
+
+static struct platform_driver qcom_tbu_driver = {
+ .driver = {
+ .name = "qcom_tbu",
+ .of_match_table = qcom_tbu_of_match,
+ },
+ .probe = qcom_tbu_probe,
+};
+builtin_platform_driver(qcom_tbu_driver);

I just noticed that this breaks a modular build of the arm-smmu driver
because we now have two init functions for the module:

ld.lld: error: duplicate symbol: init_module
>>> defined at arm-smmu.c
>>> drivers/iommu/arm/arm-smmu/arm-smmu.o:(init_module)
>>> defined at arm-smmu-qcom-debug.c
>>> drivers/iommu/arm/arm-smmu/arm-smmu-qcom-debug.o:(.init.text+0x4)

I think you should initialise the TBU debug feature by calling into it
manually from qcom_smmu_impl_init().

Please can you send a patch to fix that? For now, I'll bodge it so that
the qcom debug stuff doesn't build as a module (see below).

Тhanks for sorting that out and apologies for missing it. We are at rc6 now and
i am afraid that i won't be able to validate my patch until next week (Easter
holidays here). I'll definitely send the rework when I get back.

BR,
Georgi


Cheers,

Will

--->8

diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
index 032bfd681307..66325210c8c9 100644
--- a/drivers/iommu/Kconfig
+++ b/drivers/iommu/Kconfig
@@ -376,7 +376,7 @@ config ARM_SMMU_QCOM

config ARM_SMMU_QCOM_DEBUG
bool "ARM SMMU QCOM implementation defined debug support"
- depends on ARM_SMMU_QCOM
+ depends on ARM_SMMU_QCOM=y
help
Support for implementation specific debug features in ARM SMMU
hardware found in QTI platforms. This include support for