提交 edea902c 编写于 作者: T Thiago Jung Bauermann 提交者: Michael Ellerman

powerpc/pseries/iommu: Don't use dma_iommu_ops on secure guests

Secure guest memory is inacessible to devices so regular DMA isn't
possible.

In that case set devices' dma_map_ops to NULL so that the generic
DMA code path will use SWIOTLB to bounce buffers for DMA.
Signed-off-by: NThiago Jung Bauermann <bauerman@linux.ibm.com>
Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20190820021326.6884-14-bauerman@linux.ibm.com
上级 4edaac51
......@@ -36,6 +36,7 @@
#include <asm/udbg.h>
#include <asm/mmzone.h>
#include <asm/plpar_wrappers.h>
#include <asm/svm.h>
#include "pseries.h"
......@@ -1319,7 +1320,15 @@ void iommu_init_early_pSeries(void)
of_reconfig_notifier_register(&iommu_reconfig_nb);
register_memory_notifier(&iommu_mem_nb);
set_pci_dma_ops(&dma_iommu_ops);
/*
* Secure guest memory is inacessible to devices so regular DMA isn't
* possible.
*
* In that case keep devices' dma_map_ops as NULL so that the generic
* DMA code path will use SWIOTLB to bounce buffers for DMA.
*/
if (!is_secure_guest())
set_pci_dma_ops(&dma_iommu_ops);
}
static int __init disable_multitce(char *str)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册