x86/iommu: add common page-table allocator
authorPaul Durrant <pdurrant@amazon.com>
Tue, 4 Aug 2020 13:41:57 +0000 (14:41 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 14 Aug 2020 15:14:21 +0000 (16:14 +0100)
commit15bc9a1ef51c4e0f9786eb143e9d43a657e7d239
tree1aac78ee11f1e0cf311b746770858668e81cac77
parente0f25d134c85f4ee0e7c1602fa8016e50937e468
x86/iommu: add common page-table allocator

Instead of having separate page table allocation functions in VT-d and AMD
IOMMU code, we could use a common allocation function in the general x86 code.

This patch adds a new allocation function, iommu_alloc_pgtable(), for this
purpose. The function adds the page table pages to a list. The pages in this
list are then freed by iommu_free_pgtables(), which is called by
domain_relinquish_resources() after PCI devices have been de-assigned.

Signed-off-by: Paul Durrant <pdurrant@amazon.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/domain.c
xen/drivers/passthrough/x86/iommu.c
xen/include/asm-x86/iommu.h