forked from Minki/linux
iommu/vt-d: Add attach_deferred() helper
Implement a helper function to check whether a device's attach process
is deferred.
Fixes: 1ee0186b9a
("iommu/vt-d: Refactor find_domain() helper")
Cc: stable@vger.kernel.org # v5.5
Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>
Acked-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
This commit is contained in:
parent
e7598fac32
commit
1d4615978f
@ -762,6 +762,11 @@ static int iommu_dummy(struct device *dev)
|
|||||||
return dev->archdata.iommu == DUMMY_DEVICE_DOMAIN_INFO;
|
return dev->archdata.iommu == DUMMY_DEVICE_DOMAIN_INFO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool attach_deferred(struct device *dev)
|
||||||
|
{
|
||||||
|
return dev->archdata.iommu == DEFER_DEVICE_DOMAIN_INFO;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* is_downstream_to_pci_bridge - test if a device belongs to the PCI
|
* is_downstream_to_pci_bridge - test if a device belongs to the PCI
|
||||||
* sub-hierarchy of a candidate PCI-PCI bridge
|
* sub-hierarchy of a candidate PCI-PCI bridge
|
||||||
@ -2510,8 +2515,7 @@ struct dmar_domain *find_domain(struct device *dev)
|
|||||||
{
|
{
|
||||||
struct device_domain_info *info;
|
struct device_domain_info *info;
|
||||||
|
|
||||||
if (unlikely(dev->archdata.iommu == DEFER_DEVICE_DOMAIN_INFO ||
|
if (unlikely(attach_deferred(dev) || iommu_dummy(dev)))
|
||||||
dev->archdata.iommu == DUMMY_DEVICE_DOMAIN_INFO))
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (dev_is_pci(dev))
|
if (dev_is_pci(dev))
|
||||||
@ -2527,7 +2531,7 @@ struct dmar_domain *find_domain(struct device *dev)
|
|||||||
|
|
||||||
static struct dmar_domain *deferred_attach_domain(struct device *dev)
|
static struct dmar_domain *deferred_attach_domain(struct device *dev)
|
||||||
{
|
{
|
||||||
if (unlikely(dev->archdata.iommu == DEFER_DEVICE_DOMAIN_INFO)) {
|
if (unlikely(attach_deferred(dev))) {
|
||||||
struct iommu_domain *domain;
|
struct iommu_domain *domain;
|
||||||
|
|
||||||
dev->archdata.iommu = NULL;
|
dev->archdata.iommu = NULL;
|
||||||
@ -6133,7 +6137,7 @@ intel_iommu_aux_get_pasid(struct iommu_domain *domain, struct device *dev)
|
|||||||
static bool intel_iommu_is_attach_deferred(struct iommu_domain *domain,
|
static bool intel_iommu_is_attach_deferred(struct iommu_domain *domain,
|
||||||
struct device *dev)
|
struct device *dev)
|
||||||
{
|
{
|
||||||
return dev->archdata.iommu == DEFER_DEVICE_DOMAIN_INFO;
|
return attach_deferred(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
Loading…
Reference in New Issue
Block a user