Skip to content

Commit 5702ee2

Browse files
Jean-Philippe Bruckerwildea01
authored andcommitted
ACPI/IORT: Check ATS capability in root complex nodes
Root complex node in IORT has a bit telling whether it supports ATS or not. Store this bit in the IOMMU fwspec when setting up a device, so it can be accessed later by an IOMMU driver. In the future we'll probably want to store this bit at the host bridge or SMMU rather than in each endpoint. Acked-by: Lorenzo Pieralisi <[email protected]> Signed-off-by: Jean-Philippe Brucker <[email protected]> Signed-off-by: Will Deacon <[email protected]>
1 parent b9ae16d commit 5702ee2

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

drivers/acpi/arm64/iort.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,6 +1028,14 @@ void iort_dma_setup(struct device *dev, u64 *dma_addr, u64 *dma_size)
10281028
dev_dbg(dev, "dma_pfn_offset(%#08llx)\n", offset);
10291029
}
10301030

1031+
static bool iort_pci_rc_supports_ats(struct acpi_iort_node *node)
1032+
{
1033+
struct acpi_iort_root_complex *pci_rc;
1034+
1035+
pci_rc = (struct acpi_iort_root_complex *)node->node_data;
1036+
return pci_rc->ats_attribute & ACPI_IORT_ATS_SUPPORTED;
1037+
}
1038+
10311039
/**
10321040
* iort_iommu_configure - Set-up IOMMU configuration for a device.
10331041
*
@@ -1063,6 +1071,9 @@ const struct iommu_ops *iort_iommu_configure(struct device *dev)
10631071
info.node = node;
10641072
err = pci_for_each_dma_alias(to_pci_dev(dev),
10651073
iort_pci_iommu_init, &info);
1074+
1075+
if (!err && iort_pci_rc_supports_ats(node))
1076+
dev->iommu_fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
10661077
} else {
10671078
int i = 0;
10681079

include/linux/iommu.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,10 +392,14 @@ struct iommu_fwspec {
392392
const struct iommu_ops *ops;
393393
struct fwnode_handle *iommu_fwnode;
394394
void *iommu_priv;
395+
u32 flags;
395396
unsigned int num_ids;
396397
u32 ids[1];
397398
};
398399

400+
/* ATS is supported */
401+
#define IOMMU_FWSPEC_PCI_RC_ATS (1 << 0)
402+
399403
int iommu_fwspec_init(struct device *dev, struct fwnode_handle *iommu_fwnode,
400404
const struct iommu_ops *ops);
401405
void iommu_fwspec_free(struct device *dev);

0 commit comments

Comments
 (0)