Skip to contentSkip to conversation

iommu/amd: Do not allocate io_pgtable_ops for passthrough domain

PATCH Applied Vasant Hegde 2 participants 2 messages Jan 5, 2023 – Jan 13, 2023

Subsystems (2)
lore
Share & tools
lore

Vasant Hegde

author maintainer
#0 lore raw

PATCH 1/1 iommu/amd: Do not allocate io_pgtable_ops for passthrough domain

In passthrough mode we do not use IOMMU page table. Hence we don't need to allocate io_pgtable_ops.

---
 drivers/iommu/amd/iommu.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/iommu/amd/iommu.c +4 -0
index acc5e5e4f9e2..5aa54249387e 100644
@@ -2079,6 +2079,10 @@ static struct protection_domain *protection_domain_alloc(unsigned int type)
 	if (ret)
 		goto out_err;
 
+	/* No need to allocate io pgtable ops in passthrough mode */
+	if (type == IOMMU_DOMAIN_IDENTITY)
+		return domain;
+
 	pgtbl_ops = alloc_io_pgtable_ops(pgtable, &domain->iop.pgtbl_cfg, domain);
 	if (!pgtbl_ops) {
 		domain_id_free(domain->id);
Signature · 1 line
2.31.1
maintainer Applied
#1 lore raw
Quoted 2 lines · Vasant Hegde
 drivers/iommu/amd/iommu.c | 4 ++++
 1 file changed, 4 insertions(+)

Applied, thanks.