From: Zhen Lei <thunder.leizhen@huawei•com>
To: Jean-Philippe Brucker <jean-philippe@linaro•org>,
John Garry <john.garry@huawei•com>,
Robin Murphy <robin.murphy@arm•com>,
Will Deacon <will@kernel•org>, Joerg Roedel <joro@8bytes•org>,
iommu <iommu@lists•linux-foundation.org>,
linux-arm-kernel <linux-arm-kernel@lists•infradead.org>
Cc: Zhen Lei <thunder.leizhen@huawei•com>
Subject: [PATCH v3 1/2] iommu/arm-smmu-v3: don't add a master into smmu_domain before it's ready
Date: Fri, 23 Aug 2019 10:45:50 +0800 [thread overview]
Message-ID: <20190823024551.24448-2-thunder.leizhen@huawei.com> (raw)
In-Reply-To: <20190823024551.24448-1-thunder.leizhen@huawei.com>
Once a master has been added into smmu_domain->devices, it may immediately
be scaned in arm_smmu_unmap()-->arm_smmu_atc_inv_domain(). From a logical
point of view, the master should be added into smmu_domain after it has
completely initialized.
Signed-off-by: Zhen Lei <thunder.leizhen@huawei•com>
---
drivers/iommu/arm-smmu-v3.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
index c5c93e48b4dbdf7..e0dcc5d27291f8b 100644
--- a/drivers/iommu/arm-smmu-v3.c
+++ b/drivers/iommu/arm-smmu-v3.c
@@ -1958,10 +1958,6 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
master->domain = smmu_domain;
- spin_lock_irqsave(&smmu_domain->devices_lock, flags);
- list_add(&master->domain_head, &smmu_domain->devices);
- spin_unlock_irqrestore(&smmu_domain->devices_lock, flags);
-
if (smmu_domain->stage != ARM_SMMU_DOMAIN_BYPASS)
arm_smmu_enable_ats(master);
@@ -1969,6 +1965,10 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
arm_smmu_write_ctx_desc(smmu, &smmu_domain->s1_cfg);
arm_smmu_install_ste_for_dev(master);
+
+ spin_lock_irqsave(&smmu_domain->devices_lock, flags);
+ list_add(&master->domain_head, &smmu_domain->devices);
+ spin_unlock_irqrestore(&smmu_domain->devices_lock, flags);
out_unlock:
mutex_unlock(&smmu_domain->init_mutex);
return ret;
--
1.8.3
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists•infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-08-23 2:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-23 2:45 [PATCH v3 0/2] improve the concurrency of arm_smmu_atc_inv_domain() Zhen Lei
2019-08-23 2:45 ` Zhen Lei [this message]
2019-08-23 2:45 ` [PATCH v3 2/2] iommu/arm-smmu-v3: change the lock type of arm_smmu_domain.devices_lock Zhen Lei
2019-08-23 7:50 ` [PATCH v3 0/2] improve the concurrency of arm_smmu_atc_inv_domain() Will Deacon
2019-08-23 8:06 ` Leizhen (ThunderTown)
2019-08-23 8:37 ` Will Deacon
2019-08-23 9:05 ` Leizhen (ThunderTown)
2019-09-17 14:35 ` Leizhen (ThunderTown)
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=20190823024551.24448-2-thunder.leizhen@huawei.com \
--to=thunder.leizhen@huawei$(echo .)com \
--cc=iommu@lists$(echo .)linux-foundation.org \
--cc=jean-philippe@linaro$(echo .)org \
--cc=john.garry@huawei$(echo .)com \
--cc=joro@8bytes$(echo .)org \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
--cc=robin.murphy@arm$(echo .)com \
--cc=will@kernel$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox