aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Jung Bauermann <bauerman@linux.ibm.com>2019-08-19 22:13:23 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2019-08-29 19:55:41 -0400
commitedea902c1c1efb855f77e041f9daf1abe7a9768a (patch)
tree5b36c86623d7cd9128ecff8bac88ccb68557e020
parent4edaac512c8a31b0aa715b58ee00ee06df642fa2 (diff)
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: Thiago Jung Bauermann <bauerman@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20190820021326.6884-14-bauerman@linux.ibm.com
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index df7db33ca93b..6ba081dd61c9 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -36,6 +36,7 @@
36#include <asm/udbg.h> 36#include <asm/udbg.h>
37#include <asm/mmzone.h> 37#include <asm/mmzone.h>
38#include <asm/plpar_wrappers.h> 38#include <asm/plpar_wrappers.h>
39#include <asm/svm.h>
39 40
40#include "pseries.h" 41#include "pseries.h"
41 42
@@ -1319,7 +1320,15 @@ void iommu_init_early_pSeries(void)
1319 of_reconfig_notifier_register(&iommu_reconfig_nb); 1320 of_reconfig_notifier_register(&iommu_reconfig_nb);
1320 register_memory_notifier(&iommu_mem_nb); 1321 register_memory_notifier(&iommu_mem_nb);
1321 1322
1322 set_pci_dma_ops(&dma_iommu_ops); 1323 /*
1324 * Secure guest memory is inacessible to devices so regular DMA isn't
1325 * possible.
1326 *
1327 * In that case keep devices' dma_map_ops as NULL so that the generic
1328 * DMA code path will use SWIOTLB to bounce buffers for DMA.
1329 */
1330 if (!is_secure_guest())
1331 set_pci_dma_ops(&dma_iommu_ops);
1323} 1332}
1324 1333
1325static int __init disable_multitce(char *str) 1334static int __init disable_multitce(char *str)