[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <32e3b143-c9b1-443e-bb9d-59a0fbf51ff7@amd.com>
Date: Tue, 7 Jan 2025 10:31:48 +0530
From: "Srivastava, Dheeraj Kumar" <dheerajkumar.srivastava@....com>
To: Bjorn Helgaas <helgaas@...nel.org>
Cc: joro@...tes.org, suravee.suthikulpanit@....com, will@...nel.org,
robin.murphy@....com, linux-kernel@...r.kernel.org, iommu@...ts.linux.dev,
vasant.hegde@....com
Subject: Re: [PATCH v2 1/8] iommu/amd: Refactor AMD IOMMU debugfs initial
setup
Hi,
On 11/27/2024 12:42 AM, Bjorn Helgaas wrote:
> On Wed, Nov 06, 2024 at 01:16:32PM +0530, Dheeraj Kumar Srivastava wrote:
>> Rearrange initial setup of AMD IOMMU debugfs to segregate per IOMMU
>> setup and setup which is common for all IOMMUs. This ensures that common
>> debugfs paths (introduced in subsequent patches) are created only once
>> instead of being created for each IOMMU.
>> ...
>
>> -void amd_iommu_debugfs_setup(struct amd_iommu *iommu)
>> +void amd_iommu_debugfs_setup(void)
>> {
>> + struct amd_iommu *iommu;
>> char name[MAX_NAME_LEN + 1];
>>
>> - mutex_lock(&amd_iommu_debugfs_lock);
>> - if (!amd_iommu_debugfs)
>> - amd_iommu_debugfs = debugfs_create_dir("amd",
>> - iommu_debugfs_dir);
>> - mutex_unlock(&amd_iommu_debugfs_lock);
>> + amd_iommu_debugfs = debugfs_create_dir("amd", iommu_debugfs_dir);
>>
>> - snprintf(name, MAX_NAME_LEN, "iommu%02d", iommu->index);
>> - iommu->debugfs = debugfs_create_dir(name, amd_iommu_debugfs);
>> + for_each_iommu(iommu) {
>> + snprintf(name, MAX_NAME_LEN, "iommu%02d", iommu->index);
>> + iommu->debugfs = debugfs_create_dir(name, amd_iommu_debugfs);
>> + }
>
> Doing this setup with for_each_iommu() precludes any hot-add of
> IOMMUs, but I guess there's no indication of hotplug support anyway
> given all the uses of for_each_iommu() in init_iommu_all(),
> amd_iommu_init_pci(), amd_iommu_enable_interrupts(), etc.
>
Yeah and here i don't see any concerns with the approach for now. Please
do let me know if you have a better way to do this.
Thanks
Dheeraj
>> }
>> diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
>> index 43131c3a2172..d78dc96bbec3 100644
>> --- a/drivers/iommu/amd/init.c
>> +++ b/drivers/iommu/amd/init.c
>> @@ -3377,7 +3377,6 @@ int amd_iommu_enable_faulting(unsigned int cpu)
>> */
>> static int __init amd_iommu_init(void)
>> {
>> - struct amd_iommu *iommu;
>> int ret;
>>
>> ret = iommu_go_to_state(IOMMU_INITIALIZED);
>> @@ -3391,8 +3390,8 @@ static int __init amd_iommu_init(void)
>> }
>> #endif
>>
>> - for_each_iommu(iommu)
>> - amd_iommu_debugfs_setup(iommu);
>> + if (!ret)
>> + amd_iommu_debugfs_setup();
>>
>> return ret;
>> }
>> --
>> 2.25.1
>>
Powered by blists - more mailing lists