Skip to content

Commit 1d46159

Browse files
committed
iommu/vt-d: Add attach_deferred() helper
Implement a helper function to check whether a device's attach process is deferred. Fixes: 1ee0186 ("iommu/vt-d: Refactor find_domain() helper") Cc: [email protected] # v5.5 Reviewed-by: Jerry Snitselaar <[email protected]> Acked-by: Lu Baolu <[email protected]> Signed-off-by: Joerg Roedel <[email protected]>
1 parent e7598fa commit 1d46159

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

drivers/iommu/intel-iommu.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,11 @@ static int iommu_dummy(struct device *dev)
762762
return dev->archdata.iommu == DUMMY_DEVICE_DOMAIN_INFO;
763763
}
764764

765+
static bool attach_deferred(struct device *dev)
766+
{
767+
return dev->archdata.iommu == DEFER_DEVICE_DOMAIN_INFO;
768+
}
769+
765770
/**
766771
* is_downstream_to_pci_bridge - test if a device belongs to the PCI
767772
* sub-hierarchy of a candidate PCI-PCI bridge
@@ -2510,8 +2515,7 @@ struct dmar_domain *find_domain(struct device *dev)
25102515
{
25112516
struct device_domain_info *info;
25122517

2513-
if (unlikely(dev->archdata.iommu == DEFER_DEVICE_DOMAIN_INFO ||
2514-
dev->archdata.iommu == DUMMY_DEVICE_DOMAIN_INFO))
2518+
if (unlikely(attach_deferred(dev) || iommu_dummy(dev)))
25152519
return NULL;
25162520

25172521
if (dev_is_pci(dev))
@@ -2527,7 +2531,7 @@ struct dmar_domain *find_domain(struct device *dev)
25272531

25282532
static struct dmar_domain *deferred_attach_domain(struct device *dev)
25292533
{
2530-
if (unlikely(dev->archdata.iommu == DEFER_DEVICE_DOMAIN_INFO)) {
2534+
if (unlikely(attach_deferred(dev))) {
25312535
struct iommu_domain *domain;
25322536

25332537
dev->archdata.iommu = NULL;
@@ -6133,7 +6137,7 @@ intel_iommu_aux_get_pasid(struct iommu_domain *domain, struct device *dev)
61336137
static bool intel_iommu_is_attach_deferred(struct iommu_domain *domain,
61346138
struct device *dev)
61356139
{
6136-
return dev->archdata.iommu == DEFER_DEVICE_DOMAIN_INFO;
6140+
return attach_deferred(dev);
61376141
}
61386142

61396143
static int

0 commit comments

Comments
 (0)