All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Lendacky, Thomas" <Thomas.Lendacky@amd.com>
To: Joerg Roedel <joro@8bytes.org>
Cc: "iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	Joerg Roedel <jroedel@suse.de>, "bp@alien8.de" <bp@alien8.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/3] iommu: Disable passthrough mode when SME is active
Date: Fri, 9 Aug 2019 16:50:48 +0000	[thread overview]
Message-ID: <7f383631-ce2c-e7c2-ceff-e7418bf8ff29@amd.com> (raw)
In-Reply-To: <20190809152233.2829-4-joro@8bytes.org>

On 8/9/19 10:22 AM, Joerg Roedel wrote:
> From: Joerg Roedel <jroedel@suse.de>
> 
> Using Passthrough mode when SME is active causes certain
> devices to use the SWIOTLB bounce buffer. The bounce buffer
> code has an upper limit of 256kb for the size of DMA
> allocations, which is too small for certain devices and
> causes them to fail.
> 
> With this patch we enable IOMMU by default when SME is
> active in the system, making the default configuration work
> for more systems than it does now.
> 
> Users that don't want IOMMUs to be enabled still can disable
> them with kernel parameters.
> 
> Signed-off-by: Joerg Roedel <jroedel@suse.de>
> ---
>   drivers/iommu/iommu.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index 62cae6db0970..fbe1aa51bce9 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -104,6 +104,12 @@ static int __init iommu_subsys_init(void)
>   	else
>   		iommu_def_domain_type = IOMMU_DOMAIN_DMA;
>   
> +	if ((iommu_def_domain_type == IOMMU_DOMAIN_IDENTITY) &&
> +	    sme_active()) {
> +		pr_info("SME detected - Disabling default IOMMU passthrough\n");
> +		iommu_def_domain_type = IOMMU_DOMAIN_DMA;

Should this also clear the iommu_pass_through variable (the one set by the
iommu kernel parameter in arch/x86/kernel/pci-dma.c)?

I guess this is more applicable to the original patchset that created the
CONFIG_IOMMU_DEFAULT_PASSTHROUGH option, but should the default
passthrough support be modified so that you don't have to specify multiple
kernel parameters to change it?

Right now, if CONFIG_IOMMU_DEFAULT_PASSTHROUGH is set to yes, you can't
just specify iommu=nopt to enable the IOMMU. You have to also specify
iommu.passthrough=0. Do we want to fix that so that just specifying
iommu=nopt or iommu.passthrough=0 does what is needed?

Thanks,
Tom

> +	}
> +
>   	pr_info("Default domain type: %s\n",
>   		iommu_domain_type_str(iommu_def_domain_type));
>   
> 
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

WARNING: multiple messages have this Message-ID (diff)
From: "Lendacky, Thomas" <Thomas.Lendacky@amd.com>
To: Joerg Roedel <joro@8bytes.org>
Cc: "iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Suthikulpanit, Suravee" <Suravee.Suthikulpanit@amd.com>,
	"bp@alien8.de" <bp@alien8.de>, Joerg Roedel <jroedel@suse.de>
Subject: Re: [PATCH 3/3] iommu: Disable passthrough mode when SME is active
Date: Fri, 9 Aug 2019 16:50:48 +0000	[thread overview]
Message-ID: <7f383631-ce2c-e7c2-ceff-e7418bf8ff29@amd.com> (raw)
In-Reply-To: <20190809152233.2829-4-joro@8bytes.org>

On 8/9/19 10:22 AM, Joerg Roedel wrote:
> From: Joerg Roedel <jroedel@suse.de>
> 
> Using Passthrough mode when SME is active causes certain
> devices to use the SWIOTLB bounce buffer. The bounce buffer
> code has an upper limit of 256kb for the size of DMA
> allocations, which is too small for certain devices and
> causes them to fail.
> 
> With this patch we enable IOMMU by default when SME is
> active in the system, making the default configuration work
> for more systems than it does now.
> 
> Users that don't want IOMMUs to be enabled still can disable
> them with kernel parameters.
> 
> Signed-off-by: Joerg Roedel <jroedel@suse.de>
> ---
>   drivers/iommu/iommu.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index 62cae6db0970..fbe1aa51bce9 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -104,6 +104,12 @@ static int __init iommu_subsys_init(void)
>   	else
>   		iommu_def_domain_type = IOMMU_DOMAIN_DMA;
>   
> +	if ((iommu_def_domain_type == IOMMU_DOMAIN_IDENTITY) &&
> +	    sme_active()) {
> +		pr_info("SME detected - Disabling default IOMMU passthrough\n");
> +		iommu_def_domain_type = IOMMU_DOMAIN_DMA;

Should this also clear the iommu_pass_through variable (the one set by the
iommu kernel parameter in arch/x86/kernel/pci-dma.c)?

I guess this is more applicable to the original patchset that created the
CONFIG_IOMMU_DEFAULT_PASSTHROUGH option, but should the default
passthrough support be modified so that you don't have to specify multiple
kernel parameters to change it?

Right now, if CONFIG_IOMMU_DEFAULT_PASSTHROUGH is set to yes, you can't
just specify iommu=nopt to enable the IOMMU. You have to also specify
iommu.passthrough=0. Do we want to fix that so that just specifying
iommu=nopt or iommu.passthrough=0 does what is needed?

Thanks,
Tom

> +	}
> +
>   	pr_info("Default domain type: %s\n",
>   		iommu_domain_type_str(iommu_def_domain_type));
>   
> 

  reply	other threads:[~2019-08-09 16:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-09 15:22 [PATCH 0/3] Disable IOMMU Passthrough when SME is active Joerg Roedel
2019-08-09 15:22 ` Joerg Roedel
2019-08-09 15:22 ` [PATCH 1/3] iommu: Print default domain type on boot Joerg Roedel
2019-08-09 15:22   ` Joerg Roedel
2019-08-09 15:22 ` [PATCH 2/3] iommu: Set default domain type at runtime Joerg Roedel
2019-08-09 15:22   ` Joerg Roedel
2019-08-09 15:22 ` [PATCH 3/3] iommu: Disable passthrough mode when SME is active Joerg Roedel
2019-08-09 15:22   ` Joerg Roedel
2019-08-09 16:50   ` Lendacky, Thomas [this message]
2019-08-09 16:50     ` Lendacky, Thomas
2019-08-09 20:32     ` Joerg Roedel
2019-08-09 20:32       ` Joerg Roedel

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=7f383631-ce2c-e7c2-ceff-e7418bf8ff29@amd.com \
    --to=thomas.lendacky@amd.com \
    --cc=bp@alien8.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=jroedel@suse.de \
    --cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.