Re: [PATCH 07/11] x86: remove the IOMMU table infrastructure

Konrad Rzeszutek Wilk
2022-03-01T18:20:22Z

> -#include <asm/swiotlb.h>
> -
> -/*
> - * History lesson:
> - * The execution chain of IOMMUs in 2.6.36 looks as so:
> - *
> - * [xen-swiotlb]
> - * |
> - * +----[swiotlb *]--+
> - * / | \
> - * / | \
> - * [GART] [Calgary] [Intel VT-d]
> - * /
> - * /
> - * [AMD-Vi]

.. snip..
> - *
> void __init pci_iommu_alloc(void)
> {
> - struct iommu_table_entry *p;
> -
> - sort_iommu_table(__iommu_table, __iommu_table_end);
> - check_iommu_entries(__iommu_table, __iommu_table_end);
> -
> - for (p = __iommu_table; p < __iommu_table_end; p++) {
> - if (p && p->detect && p->detect() > 0) {
> - p->flags |= IOMMU_DETECTED;
> - if (p->early_init)
> - p->early_init();
> - if (p->flags & IOMMU_FINISH_IF_DETECTED)
> - break;
> - }
> + if (xen_pv_domain()) {
> + pci_xen_swiotlb_init();
> + return;
> }
> + pci_swiotlb_detect_4gb();

I think you also need to check for IBM Calgary?

> + gart_iommu_hole_init();
> + amd_iommu_detect();
> + detect_intel_iommu();
> + if (x86_swiotlb_enable)
> + swiotlb_init(0);