Re: [PATCH v4 2/2] powerpc/pseries/iommu: Use dma_iommu_ops for Secure VMs aswell.
From: Alexey Kardashevskiy
Date: Mon Dec 02 2019 - 19:58:28 EST
On 02/12/2019 17:45, Ram Pai wrote:
> Commit edea902c1c1e ("powerpc/pseries/iommu: Don't use dma_iommu_ops on
> secure guests")
> disabled dma_iommu_ops path, for secure VMs. The rationale for disabling
> the dma_iommu_ops path, was to use the dma_direct path, since it had
> inbuilt support for bounce-buffering through SWIOTLB.
>
> However dma_iommu_ops is functionally much richer. Depending on the
> capabilities of the platform, it can handle direct DMA; with or without
> bounce buffering, and it can handle indirect DMA. Hence its better to
> leverage the richer functionality supported by dma_iommu_ops.
What exactly do we leverage after applying this patch? afaict things are
going to work in exact same old way with this applied, no? Thanks,
>
> Renable dma_iommu_ops path for pseries Secure VMs.
>
> Signed-off-by: Ram Pai <linuxram@xxxxxxxxxx>
> ---
> arch/powerpc/platforms/pseries/iommu.c | 11 +----------
> 1 file changed, 1 insertion(+), 10 deletions(-)
>
> diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
> index 0720831..6adf4d3 100644
> --- a/arch/powerpc/platforms/pseries/iommu.c
> +++ b/arch/powerpc/platforms/pseries/iommu.c
> @@ -36,7 +36,6 @@
> #include <asm/udbg.h>
> #include <asm/mmzone.h>
> #include <asm/plpar_wrappers.h>
> -#include <asm/svm.h>
> #include <asm/ultravisor.h>
>
> #include "pseries.h"
> @@ -1337,15 +1336,7 @@ void iommu_init_early_pSeries(void)
> of_reconfig_notifier_register(&iommu_reconfig_nb);
> register_memory_notifier(&iommu_mem_nb);
>
> - /*
> - * 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);
> + set_pci_dma_ops(&dma_iommu_ops);
> }
>
> static int __init disable_multitce(char *str)
>
--
Alexey