[<prev] [next>] [day] [month] [year] [list]
Date: Thu, 7 Jul 2022 17:18:04 +0800
From: Baolu Lu <baolu.lu@...ux.intel.com>
To: Ethan Zhao <haifeng.zhao@...ux.intel.com>,
iommu@...ts.linux-foundation.org, iommu@...ts.linux.dev
Cc: baolu.lu@...ux.intel.com, Kevin Tian <kevin.tian@...el.com>,
Ashok Raj <ashok.raj@...el.com>, Liu Yi L <yi.l.liu@...el.com>,
Jacob jun Pan <jacob.jun.pan@...el.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 01/11] iommu/vt-d: debugfs: Remove device_domain_lock
usage
On 2022/7/7 16:30, Ethan Zhao wrote:
>> -static int show_device_domain_translation(struct device *dev, void *data)
>> +static int __show_device_domain_translation(struct device *dev, void *data)
>> {
>> - struct device_domain_info *info = dev_iommu_priv_get(dev);
>> - struct dmar_domain *domain = info->domain;
>> + struct dmar_domain *domain;
>> struct seq_file *m = data;
>> u64 path[6] = { 0 };
>>
>> + domain = to_dmar_domain(iommu_get_domain_for_dev(dev));
>> if (!domain)
>> return 0;
>>
>> @@ -359,20 +359,39 @@ static int show_device_domain_translation(struct device *dev, void *data)
>> pgtable_walk_level(m, domain->pgd, domain->agaw + 2, 0, path);
>> seq_putc(m, '\n');
>>
>> - return 0;
>> + /* Don't iterate */
>> + return 1;
>> }
>
> Using this return value trick to change the caller behaviour, seems not
> saving
>
> anything, but really cost me a few seconds more to know the
> *incantation* --
>
> 'Don't iterate' :) .
This is defined by iommu_group_for_each_dev(). Return value 0 means
continuing to next one, while non-zero means stopping iteration.
Best regards,
baolu
Powered by blists - more mailing lists