Skip to content

Commit 98d5e84

Browse files
KarimAllah Ahmedgregkh
authored andcommitted
iommu/vt-d: Flush the IOTLB to get rid of the initial kdump mappings
commit f73a7eee900e95404b61408a23a1df5c5811704c upstream. Ever since commit 091d42e ("iommu/vt-d: Copy translation tables from old kernel") the kdump kernel copies the IOMMU context tables from the previous kernel. Each device mappings will be destroyed once the driver for the respective device takes over. This unfortunately breaks the workflow of mapping and unmapping a new context to the IOMMU. The mapping function assumes that either: 1) Unmapping did the proper IOMMU flushing and it only ever flush if the IOMMU unit supports caching invalid entries. 2) The system just booted and the initialization code took care of flushing all IOMMU caches. This assumption is not true for the kdump kernel since the context tables have been copied from the previous kernel and translations could have been cached ever since. So make sure to flush the IOTLB as well when we destroy these old copied mappings. Cc: Joerg Roedel <joro@8bytes.org> Cc: David Woodhouse <dwmw2@infradead.org> Cc: David Woodhouse <dwmw@amazon.co.uk> Cc: Anthony Liguori <aliguori@amazon.com> Signed-off-by: KarimAllah Ahmed <karahmed@amazon.de> Acked-by: David Woodhouse <dwmw@amazon.co.uk> Fixes: 091d42e ("iommu/vt-d: Copy translation tables from old kernel") Signed-off-by: Joerg Roedel <jroedel@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent cb89b1f commit 98d5e84

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

drivers/iommu/intel-iommu.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2005,11 +2005,14 @@ static int domain_context_mapping_one(struct dmar_domain *domain,
20052005
if (context_copied(context)) {
20062006
u16 did_old = context_domain_id(context);
20072007

2008-
if (did_old >= 0 && did_old < cap_ndoms(iommu->cap))
2008+
if (did_old >= 0 && did_old < cap_ndoms(iommu->cap)) {
20092009
iommu->flush.flush_context(iommu, did_old,
20102010
(((u16)bus) << 8) | devfn,
20112011
DMA_CCMD_MASK_NOBIT,
20122012
DMA_CCMD_DEVICE_INVL);
2013+
iommu->flush.flush_iotlb(iommu, did_old, 0, 0,
2014+
DMA_TLB_DSI_FLUSH);
2015+
}
20132016
}
20142017

20152018
pgd = domain->pgd;

0 commit comments

Comments
 (0)