LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thiago Jung Bauermann <bauerman@linux.ibm.com>
To: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: Alistair Popple <alistair@popple.id.au>,
	linuxppc-dev@lists.ozlabs.org,
	David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [PATCH kernel 2/2] powerpc/pseries/dma: Enable swiotlb
Date: Fri, 10 May 2019 19:41:50 -0300	[thread overview]
Message-ID: <87zhnu0w5t.fsf@morokweng.localdomain> (raw)
In-Reply-To: <20190507062559.20295-3-aik@ozlabs.ru>


Hello Alexey,

Thanks!

I have similar changes in my "Secure Virtual Machine Enablement"
patches, which I am currently preparing for posting again real soon now.

This is the last version:

https://lore.kernel.org/linuxppc-dev/20180824162535.22798-1-bauerman@linux.ibm.com/

Alexey Kardashevskiy <aik@ozlabs.ru> writes:

> So far the pseries platforms has always been using IOMMU making SWIOTLB
> unnecessary. Now we want secure guests which means devices can only
> access certain areas of guest physical memory; we are going to use
> SWIOTLB for this purpose.
>
> This allows SWIOTLB for pseries. By default there is no change in behavior.
>
> This enables SWIOTLB when the "swiotlb" kernel parameter is set to "force".
>
> With the SWIOTLB enabled, the kernel creates a directly mapped DMA window
> (using the usual DDW mechanism) and implements SWIOTLB on top of that.
>
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
>  arch/powerpc/platforms/pseries/setup.c | 5 +++++
>  arch/powerpc/platforms/pseries/Kconfig | 1 +
>  2 files changed, 6 insertions(+)
>
> diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
> index e4f0dfd4ae33..30d72b587ac5 100644
> --- a/arch/powerpc/platforms/pseries/setup.c
> +++ b/arch/powerpc/platforms/pseries/setup.c
> @@ -42,6 +42,7 @@
>  #include <linux/of.h>
>  #include <linux/of_pci.h>
>  #include <linux/memblock.h>
> +#include <linux/swiotlb.h>
>
>  #include <asm/mmu.h>
>  #include <asm/processor.h>
> @@ -71,6 +72,7 @@
>  #include <asm/isa-bridge.h>
>  #include <asm/security_features.h>
>  #include <asm/asm-const.h>
> +#include <asm/swiotlb.h>
>
>  #include "pseries.h"
>  #include "../../../../drivers/pci/pci.h"
> @@ -797,6 +799,9 @@ static void __init pSeries_setup_arch(void)
>  	}
>
>  	ppc_md.pcibios_root_bridge_prepare = pseries_root_bridge_prepare;
> +
> +	if (swiotlb_force == SWIOTLB_FORCE)
> +		ppc_swiotlb_enable = 1;
>  }

Yep! I have this here, enabled when booting as a secure guest:

https://lore.kernel.org/linuxppc-dev/20180824162535.22798-6-bauerman@linux.ibm.com/

And also another patch which makes it so that if booting as a secure
guest it acts as if the swiotlb kernel parameter was set to force:

https://lore.kernel.org/linuxppc-dev/20180824162535.22798-11-bauerman@linux.ibm.com/

>  static void pseries_panic(char *str)
> diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig
> index 9c6b3d860518..b9e8b608de01 100644
> --- a/arch/powerpc/platforms/pseries/Kconfig
> +++ b/arch/powerpc/platforms/pseries/Kconfig
> @@ -23,6 +23,7 @@ config PPC_PSERIES
>  	select ARCH_RANDOM
>  	select PPC_DOORBELL
>  	select FORCE_SMP
> +	select SWIOTLB
>  	default y
>
>  config PPC_SPLPAR

I put this in a PPC_SVM config option:

https://lore.kernel.org/linuxppc-dev/20180824162535.22798-3-bauerman@linux.ibm.com/

--
Thiago Jung Bauermann
IBM Linux Technology Center


  reply	other threads:[~2019-05-10 22:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-07  6:25 [PATCH kernel 0/2] pseries: Enable SWIOTLB Alexey Kardashevskiy
2019-05-07  6:25 ` [PATCH kernel 1/2] powerpc/pseries/dma: Allow swiotlb Alexey Kardashevskiy
2019-05-10 22:36   ` Thiago Jung Bauermann
2019-05-13  6:30     ` Alexey Kardashevskiy
2019-06-19  4:13       ` Thiago Jung Bauermann
2019-07-08  1:19   ` Michael Ellerman
2019-05-07  6:25 ` [PATCH kernel 2/2] powerpc/pseries/dma: Enable swiotlb Alexey Kardashevskiy
2019-05-10 22:41   ` Thiago Jung Bauermann [this message]
2019-05-13  6:32     ` Alexey Kardashevskiy
2019-05-30  7:04 ` [PATCH kernel 0/2] pseries: Enable SWIOTLB Alexey Kardashevskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zhnu0w5t.fsf@morokweng.localdomain \
    --to=bauerman@linux.ibm.com \
    --cc=aik@ozlabs.ru \
    --cc=alistair@popple.id.au \
    --cc=david@gibson.dropbear.id.au \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox