From: leizhen <thunder.leizhen-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
To: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>
Cc: Will Deacon <Will.Deacon-5wv7dgnIgG8@public.gmane.org>,
"huxinwei-hv44wF8Li93QT0dZR+AlfA@public.gmane.org"
<huxinwei-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>,
iommu
<iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
Zefan Li <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>,
Tianhong Ding
<dingtianhong-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>,
linux-arm-kernel
<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
Subject: Re: [PATCH v2 7/9] iommu/arm-smmu: remove arm_smmu_devices
Date: Thu, 9 Jul 2015 10:43:29 +0800 [thread overview]
Message-ID: <559DDFD1.9010000@huawei.com> (raw)
In-Reply-To: <559D2210.50202-5wv7dgnIgG8@public.gmane.org>
On 2015/7/8 21:13, Robin Murphy wrote:
> On 07/07/15 04:30, Zhen Lei wrote:
>> It can be replaced by of_iommu_list(in of_iommu.c).
>>
>> Signed-off-by: Zhen Lei <thunder.leizhen-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
>> ---
>> drivers/iommu/arm-smmu-v3.c | 22 ++--------------------
>> 1 file changed, 2 insertions(+), 20 deletions(-)
>>
>> diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
>> index c569539..39c55f6 100644
>> --- a/drivers/iommu/arm-smmu-v3.c
>> +++ b/drivers/iommu/arm-smmu-v3.c
>> @@ -604,10 +604,6 @@ struct arm_smmu_domain {
>> struct iommu_domain domain;
>> };
>>
>> -/* Our list of SMMU instances */
>> -static DEFINE_SPINLOCK(arm_smmu_devices_lock);
>> -static LIST_HEAD(arm_smmu_devices);
>> -
>> struct arm_smmu_option_prop {
>> u32 opt;
>> const char *prop;
>> @@ -2675,11 +2671,6 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev)
>> if (ret)
>> goto out_free_structures;
>>
>> - /* Record our private device structure */
>> - INIT_LIST_HEAD(&smmu->list);
>> - spin_lock(&arm_smmu_devices_lock);
>> - list_add(&smmu->list, &arm_smmu_devices);
>> - spin_unlock(&arm_smmu_devices_lock);
>> platform_set_drvdata(pdev, smmu);
>> of_iommu_set_ops(smmu->dev->of_node, &arm_smmu_ops);
>>
>> @@ -2692,19 +2683,10 @@ out_free_structures:
>>
>> static int arm_smmu_device_remove(struct platform_device *pdev)
>> {
>> - struct arm_smmu_device *curr, *smmu = NULL;
>> + struct arm_smmu_device *smmu;
>> struct device *dev = &pdev->dev;
>>
>> - spin_lock(&arm_smmu_devices_lock);
>> - list_for_each_entry(curr, &arm_smmu_devices, list) {
>> - if (curr->dev == dev) {
>> - smmu = curr;
>> - list_del(&smmu->list);
>> - break;
>> - }
>> - }
>> - spin_unlock(&arm_smmu_devices_lock);
>> -
>> + smmu = find_smmu_by_node(dev->of_node);
>
> Isn't that just a really long round-trip to platform_get_drvdata(pdev)?
But we should first check that pdev is a real smmu device, not others. So we can not omit:
if (!of_iommu_get_ops(np))
I think arm_smmu_device_remove will rarely be called, so it will not impact performance.
>
>> if (!smmu)
>> return -ENODEV;
>>
>> --
>> 1.8.0
>>
>>
>> _______________________________________________
>> iommu mailing list
>> iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
>> https://lists.linuxfoundation.org/mailman/listinfo/iommu
>>
>
>
> .
>
WARNING: multiple messages have this Message-ID (diff)
From: thunder.leizhen@huawei.com (leizhen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 7/9] iommu/arm-smmu: remove arm_smmu_devices
Date: Thu, 9 Jul 2015 10:43:29 +0800 [thread overview]
Message-ID: <559DDFD1.9010000@huawei.com> (raw)
In-Reply-To: <559D2210.50202@arm.com>
On 2015/7/8 21:13, Robin Murphy wrote:
> On 07/07/15 04:30, Zhen Lei wrote:
>> It can be replaced by of_iommu_list(in of_iommu.c).
>>
>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
>> ---
>> drivers/iommu/arm-smmu-v3.c | 22 ++--------------------
>> 1 file changed, 2 insertions(+), 20 deletions(-)
>>
>> diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
>> index c569539..39c55f6 100644
>> --- a/drivers/iommu/arm-smmu-v3.c
>> +++ b/drivers/iommu/arm-smmu-v3.c
>> @@ -604,10 +604,6 @@ struct arm_smmu_domain {
>> struct iommu_domain domain;
>> };
>>
>> -/* Our list of SMMU instances */
>> -static DEFINE_SPINLOCK(arm_smmu_devices_lock);
>> -static LIST_HEAD(arm_smmu_devices);
>> -
>> struct arm_smmu_option_prop {
>> u32 opt;
>> const char *prop;
>> @@ -2675,11 +2671,6 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev)
>> if (ret)
>> goto out_free_structures;
>>
>> - /* Record our private device structure */
>> - INIT_LIST_HEAD(&smmu->list);
>> - spin_lock(&arm_smmu_devices_lock);
>> - list_add(&smmu->list, &arm_smmu_devices);
>> - spin_unlock(&arm_smmu_devices_lock);
>> platform_set_drvdata(pdev, smmu);
>> of_iommu_set_ops(smmu->dev->of_node, &arm_smmu_ops);
>>
>> @@ -2692,19 +2683,10 @@ out_free_structures:
>>
>> static int arm_smmu_device_remove(struct platform_device *pdev)
>> {
>> - struct arm_smmu_device *curr, *smmu = NULL;
>> + struct arm_smmu_device *smmu;
>> struct device *dev = &pdev->dev;
>>
>> - spin_lock(&arm_smmu_devices_lock);
>> - list_for_each_entry(curr, &arm_smmu_devices, list) {
>> - if (curr->dev == dev) {
>> - smmu = curr;
>> - list_del(&smmu->list);
>> - break;
>> - }
>> - }
>> - spin_unlock(&arm_smmu_devices_lock);
>> -
>> + smmu = find_smmu_by_node(dev->of_node);
>
> Isn't that just a really long round-trip to platform_get_drvdata(pdev)?
But we should first check that pdev is a real smmu device, not others. So we can not omit:
if (!of_iommu_get_ops(np))
I think arm_smmu_device_remove will rarely be called, so it will not impact performance.
>
>> if (!smmu)
>> return -ENODEV;
>>
>> --
>> 1.8.0
>>
>>
>> _______________________________________________
>> iommu mailing list
>> iommu at lists.linux-foundation.org
>> https://lists.linuxfoundation.org/mailman/listinfo/iommu
>>
>
>
> .
>
next prev parent reply other threads:[~2015-07-09 2:43 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-07 3:30 [PATCH v2 0/9] bugfixs and add support for non-pci devices Zhen Lei
2015-07-07 3:30 ` Zhen Lei
[not found] ` <1436239822-14132-1-git-send-email-thunder.leizhen-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2015-07-07 3:30 ` [PATCH v2 1/9] iommu/arm-smmu: fix the assignment of L1 table log2entries Zhen Lei
2015-07-07 3:30 ` Zhen Lei
2015-07-07 3:30 ` [PATCH v2 2/9] iommu/arm-smmu: fix the index calculation of strtab Zhen Lei
2015-07-07 3:30 ` Zhen Lei
2015-07-07 3:30 ` [PATCH v2 3/9] iommu/arm-smmu: fix the values of ARM64_TCR_IRGN0_SHIFT and ARM64_TCR_ORGN0_SHIFT Zhen Lei
2015-07-07 3:30 ` Zhen Lei
2015-07-07 3:30 ` [PATCH v2 4/9] iommu/arm-smmu: enlarge STRTAB_L1_SZ_SHIFT to support larger sidsize Zhen Lei
2015-07-07 3:30 ` Zhen Lei
2015-07-07 3:30 ` [PATCH v2 5/9] iommu/arm-smmu: skip the execution of CMD_PREFETCH_CONFIG Zhen Lei
2015-07-07 3:30 ` Zhen Lei
[not found] ` <1436239822-14132-6-git-send-email-thunder.leizhen-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2015-07-08 13:03 ` Robin Murphy
2015-07-08 13:03 ` Robin Murphy
2015-07-08 17:11 ` Will Deacon
2015-07-08 17:11 ` Will Deacon
[not found] ` <20150708171107.GC6348-5wv7dgnIgG8@public.gmane.org>
2015-07-09 1:30 ` leizhen
2015-07-09 1:30 ` leizhen
2015-07-07 3:30 ` [PATCH v2 6/9] iommu/arm-smmu: to support probe deferral Zhen Lei
2015-07-07 3:30 ` Zhen Lei
[not found] ` <1436239822-14132-7-git-send-email-thunder.leizhen-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2015-07-08 13:13 ` Robin Murphy
2015-07-08 13:13 ` Robin Murphy
[not found] ` <559D21F0.3080202-5wv7dgnIgG8@public.gmane.org>
2015-07-09 11:10 ` leizhen
2015-07-09 11:10 ` leizhen
[not found] ` <559E5693.9060709-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2015-07-09 11:27 ` Will Deacon
2015-07-09 11:27 ` Will Deacon
2015-07-07 3:30 ` [PATCH v2 7/9] iommu/arm-smmu: remove arm_smmu_devices Zhen Lei
2015-07-07 3:30 ` Zhen Lei
[not found] ` <1436239822-14132-8-git-send-email-thunder.leizhen-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2015-07-08 13:13 ` Robin Murphy
2015-07-08 13:13 ` Robin Murphy
[not found] ` <559D2210.50202-5wv7dgnIgG8@public.gmane.org>
2015-07-09 2:43 ` leizhen [this message]
2015-07-09 2:43 ` leizhen
2015-07-07 3:30 ` [PATCH v2 8/9] iommu/arm-smmu: rename __arm_smmu_get_pci_sid Zhen Lei
2015-07-07 3:30 ` Zhen Lei
2015-07-07 3:30 ` [PATCH v2 9/9] iommu/arm-smmu: add support for non-pci devices Zhen Lei
2015-07-07 3:30 ` Zhen Lei
[not found] ` <1436239822-14132-10-git-send-email-thunder.leizhen-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2015-07-08 13:22 ` Robin Murphy
2015-07-08 13:22 ` Robin Murphy
2015-07-09 1:56 ` leizhen
2015-07-09 1:56 ` leizhen
[not found] ` <559DD4B6.9000403-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2015-07-09 12:01 ` Robin Murphy
2015-07-09 12:01 ` Robin Murphy
[not found] ` <559E6289.6060802-5wv7dgnIgG8@public.gmane.org>
2015-07-10 0:34 ` leizhen
2015-07-10 0:34 ` leizhen
2015-07-07 9:22 ` [PATCH v2 0/9] bugfixs and " Will Deacon
2015-07-07 9:22 ` Will Deacon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=559DDFD1.9010000@huawei.com \
--to=thunder.leizhen-hv44wf8li93qt0dzr+alfa@public.gmane.org \
--cc=Will.Deacon-5wv7dgnIgG8@public.gmane.org \
--cc=dingtianhong-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
--cc=huxinwei-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
--cc=robin.murphy-5wv7dgnIgG8@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.