diff mbox series

[v2] perf/smmuv3: Add MODULE_ALIAS for module auto loading

Message ID 20230814131642.65263-1-yangyicong@huawei.com (mailing list archive)
State New, archived
Headers show
Series [v2] perf/smmuv3: Add MODULE_ALIAS for module auto loading | expand

Commit Message

Yicong Yang Aug. 14, 2023, 1:16 p.m. UTC
From: Yicong Yang <yangyicong@hisilicon.com>

On my ACPI based arm64 server, if the SMMUv3 PMU is configured as
module it won't be loaded automatically after booting even if the
device has already been scanned and added. It's because the module
lacks a platform alias, the uevent mechanism and userspace tools
like udevd make use of this to find the target driver module of the
device. This patch adds the missing platform alias of the module,
then module will be loaded automatically if device exists.

Before this patch:
[root@localhost tmp]# modinfo arm_smmuv3_pmu | grep alias
alias:          of:N*T*Carm,smmu-v3-pmcgC*
alias:          of:N*T*Carm,smmu-v3-pmcg

After this patch:
[root@localhost tmp]# modinfo arm_smmuv3_pmu | grep alias
alias:          platform:arm-smmu-v3-pmcg
alias:          of:N*T*Carm,smmu-v3-pmcgC*
alias:          of:N*T*Carm,smmu-v3-pmcg

Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
---
Change since v1:
- Further illustrate the issues and how to fix this
- Use MODULE_ALIAS instead of MODULE_DEVICE_TABLE
Link: https://lore.kernel.org/all/20230807122233.28563-1-yangyicong@huawei.com/

 drivers/perf/arm_smmuv3_pmu.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Liang Li Aug. 15, 2023, 1:48 a.m. UTC | #1
On 2023-08-14 21:16, Yicong Yang <yangyicong@huawei.com> wrote:
> From: Yicong Yang <yangyicong@hisilicon.com>
> 
> On my ACPI based arm64 server, if the SMMUv3 PMU is configured as
> module it won't be loaded automatically after booting even if the
> device has already been scanned and added. It's because the module
> lacks a platform alias, the uevent mechanism and userspace tools
> like udevd make use of this to find the target driver module of the
> device. This patch adds the missing platform alias of the module,
> then module will be loaded automatically if device exists.
> 
> Before this patch:
> [root@localhost tmp]# modinfo arm_smmuv3_pmu | grep alias
> alias:          of:N*T*Carm,smmu-v3-pmcgC*
> alias:          of:N*T*Carm,smmu-v3-pmcg
> 
> After this patch:
> [root@localhost tmp]# modinfo arm_smmuv3_pmu | grep alias
> alias:          platform:arm-smmu-v3-pmcg
> alias:          of:N*T*Carm,smmu-v3-pmcgC*
> alias:          of:N*T*Carm,smmu-v3-pmcg
> 
> Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
> ---
> Change since v1:
> - Further illustrate the issues and how to fix this
> - Use MODULE_ALIAS instead of MODULE_DEVICE_TABLE
> Link: https://lore.kernel.org/all/20230807122233.28563-1-yangyicong@huawei.com/
> 
>  drivers/perf/arm_smmuv3_pmu.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/perf/arm_smmuv3_pmu.c b/drivers/perf/arm_smmuv3_pmu.c
> index 25a269d431e4..4c32b6dbfe76 100644
> --- a/drivers/perf/arm_smmuv3_pmu.c
> +++ b/drivers/perf/arm_smmuv3_pmu.c
> @@ -984,6 +984,7 @@ static void __exit arm_smmu_pmu_exit(void)
>  
>  module_exit(arm_smmu_pmu_exit);
>  
> +MODULE_ALIAS("platform:arm-smmu-v3-pmcg");
>  MODULE_DESCRIPTION("PMU driver for ARM SMMUv3 Performance Monitors Extension");
>  MODULE_AUTHOR("Neil Leeder <nleeder@codeaurora.org>");
>  MODULE_AUTHOR("Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>");
> -- 
> 2.24.0

Looks good to me. :) Thanks.

Regards.
Liang Li
Will Deacon Aug. 15, 2023, 2:10 p.m. UTC | #2
On Mon, 14 Aug 2023 21:16:42 +0800, Yicong Yang wrote:
> From: Yicong Yang <yangyicong@hisilicon.com>
> 
> On my ACPI based arm64 server, if the SMMUv3 PMU is configured as
> module it won't be loaded automatically after booting even if the
> device has already been scanned and added. It's because the module
> lacks a platform alias, the uevent mechanism and userspace tools
> like udevd make use of this to find the target driver module of the
> device. This patch adds the missing platform alias of the module,
> then module will be loaded automatically if device exists.
> 
> [...]

Applied to will (for-next/perf), thanks!

[1/1] perf/smmuv3: Add MODULE_ALIAS for module auto loading
      https://git.kernel.org/will/c/1b0e3ea9301a

Cheers,
diff mbox series

Patch

diff --git a/drivers/perf/arm_smmuv3_pmu.c b/drivers/perf/arm_smmuv3_pmu.c
index 25a269d431e4..4c32b6dbfe76 100644
--- a/drivers/perf/arm_smmuv3_pmu.c
+++ b/drivers/perf/arm_smmuv3_pmu.c
@@ -984,6 +984,7 @@  static void __exit arm_smmu_pmu_exit(void)
 
 module_exit(arm_smmu_pmu_exit);
 
+MODULE_ALIAS("platform:arm-smmu-v3-pmcg");
 MODULE_DESCRIPTION("PMU driver for ARM SMMUv3 Performance Monitors Extension");
 MODULE_AUTHOR("Neil Leeder <nleeder@codeaurora.org>");
 MODULE_AUTHOR("Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>");