diff mbox series

[v4,2/2] powerpc/pseries/iommu: Use dma_iommu_ops for Secure VMs aswell.

Message ID 1575269124-17885-3-git-send-email-linuxram@us.ibm.com (mailing list archive)
State Superseded
Headers show
Series Enable IOMMU support for pseries Secure VMs | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch powerpc/merge (2e6c4d7e1c5990fa2ccca6db0868a05640ac1df1)
snowpatch_ozlabs/build-ppc64le success Build succeeded
snowpatch_ozlabs/build-ppc64be success Build succeeded
snowpatch_ozlabs/build-ppc64e success Build succeeded
snowpatch_ozlabs/build-pmac32 success Build succeeded
snowpatch_ozlabs/checkpatch success total: 0 errors, 0 warnings, 0 checks, 23 lines checked
snowpatch_ozlabs/needsstable success Patch has no Fixes tags

Commit Message

Ram Pai Dec. 2, 2019, 6:45 a.m. UTC
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.

Renable dma_iommu_ops path for pseries Secure VMs.

Signed-off-by: Ram Pai <linuxram@us.ibm.com>
---
 arch/powerpc/platforms/pseries/iommu.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

Comments

Alexey Kardashevskiy Dec. 3, 2019, 12:58 a.m. UTC | #1
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@us.ibm.com>
> ---
>  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)
>
Ram Pai Dec. 3, 2019, 4:07 a.m. UTC | #2
On Tue, Dec 03, 2019 at 11:58:18AM +1100, Alexey Kardashevskiy wrote:
> 
> 
> 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,

Yes. You got it right. Another way of saying this is, it reverts the changes.

RP
diff mbox series

Patch

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)