From: Lu Baolu <baolu.lu@linux.intel.com>
To: Joerg Roedel <joro@8bytes.org>, Jason Gunthorpe <jgg@nvidia.com>,
Christoph Hellwig <hch@infradead.org>,
Kevin Tian <kevin.tian@intel.com>,
Ashok Raj <ashok.raj@intel.com>, Will Deacon <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
Jean-Philippe Brucker <jean-philippe@linaro.com>
Cc: linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org,
Jacob jun Pan <jacob.jun.pan@intel.com>
Subject: [PATCH 4/5] iommu: Use blocking domain for empty domain attaching
Date: Mon, 16 May 2022 09:57:58 +0800 [thread overview]
Message-ID: <20220516015759.2952771-5-baolu.lu@linux.intel.com> (raw)
In-Reply-To: <20220516015759.2952771-1-baolu.lu@linux.intel.com>
If a NULL domain is about to set to a device, let's set the blocking
domain instead.
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
drivers/iommu/iommu.c | 35 +++--------------------------------
1 file changed, 3 insertions(+), 32 deletions(-)
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index dcbc55c9d8d7..ba0f427c2823 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -2058,16 +2058,6 @@ int iommu_deferred_attach(struct device *dev, struct iommu_domain *domain)
return 0;
}
-static void __iommu_detach_device(struct iommu_domain *domain,
- struct device *dev)
-{
- if (iommu_is_attach_deferred(dev))
- return;
-
- domain->ops->detach_dev(domain, dev);
- trace_detach_device_from_domain(dev);
-}
-
void iommu_detach_device(struct iommu_domain *domain, struct device *dev)
{
struct iommu_group *group;
@@ -2160,15 +2150,6 @@ int iommu_attach_group(struct iommu_domain *domain, struct iommu_group *group)
}
EXPORT_SYMBOL_GPL(iommu_attach_group);
-static int iommu_group_do_detach_device(struct device *dev, void *data)
-{
- struct iommu_domain *domain = data;
-
- __iommu_detach_device(domain, dev);
-
- return 0;
-}
-
static int __iommu_group_set_domain(struct iommu_group *group,
struct iommu_domain *new_domain)
{
@@ -2177,19 +2158,9 @@ static int __iommu_group_set_domain(struct iommu_group *group,
if (group->domain == new_domain)
return 0;
- /*
- * New drivers should support default domains and so the detach_dev() op
- * will never be called. Otherwise the NULL domain represents some
- * platform specific behavior.
- */
- if (!new_domain) {
- if (WARN_ON(!group->domain->ops->detach_dev))
- return -EINVAL;
- __iommu_group_for_each_dev(group, group->domain,
- iommu_group_do_detach_device);
- group->domain = NULL;
- return 0;
- }
+ /* The NULL domain represents some platform specific behavior. */
+ if (!new_domain)
+ new_domain = group->blocking_domain;
/*
* Changing the domain is done by calling set_dev() on the new
--
2.25.1
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
next prev parent reply other threads:[~2022-05-16 2:01 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-16 1:57 [PATCH 0/5] iommu: Make blocking domain static for group Lu Baolu
2022-05-16 1:57 ` [PATCH 1/5] iommu: Rename attach_dev to set_dev in domain ops Lu Baolu
2022-05-16 1:57 ` [PATCH 2/5] iommu: Add blocking_domain_ops field in iommu_ops Lu Baolu
2022-05-16 7:27 ` Christoph Hellwig
2022-05-16 13:05 ` Jason Gunthorpe via iommu
2022-05-16 11:22 ` Robin Murphy
2022-05-16 13:43 ` Baolu Lu
2022-05-16 13:57 ` Jason Gunthorpe via iommu
2022-05-17 2:37 ` Baolu Lu
2022-05-17 12:43 ` Robin Murphy
2022-05-17 13:13 ` Jason Gunthorpe via iommu
2022-05-18 6:43 ` Baolu Lu
2022-05-17 13:08 ` Jason Gunthorpe via iommu
2022-05-20 8:45 ` Joerg Roedel
2022-05-20 11:03 ` Baolu Lu
2022-05-16 1:57 ` [PATCH 3/5] iommu: Make blocking domain static for iommu group Lu Baolu
2022-05-16 1:57 ` Lu Baolu [this message]
2022-05-16 1:57 ` [PATCH 5/5] iommu: Remove .detach_dev from iommu domain ops Lu Baolu
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=20220516015759.2952771-5-baolu.lu@linux.intel.com \
--to=baolu.lu@linux.intel.com \
--cc=ashok.raj@intel.com \
--cc=hch@infradead.org \
--cc=iommu@lists.linux-foundation.org \
--cc=jacob.jun.pan@intel.com \
--cc=jean-philippe@linaro.com \
--cc=jgg@nvidia.com \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=robin.murphy@arm.com \
--cc=will@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).