All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Lendacky <thomas.lendacky-5C7GfCeVMHo@public.gmane.org>
To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Cc: Borislav Petkov <bp-l3A5Bk7waGM@public.gmane.org>
Subject: Re: [PATCH] iommu/amd: Do not disable SWIOTLB if SME is active
Date: Fri, 6 Oct 2017 16:39:07 -0500	[thread overview]
Message-ID: <800bd17c-475b-c5b2-c4d1-776c655f084a@amd.com> (raw)
In-Reply-To: <20171006213540.19038.84350.stgit-qCXWGYdRb2BnqfbPTmsdiZQ+2ll4COg0XqFh9Ls21Oc@public.gmane.org>

On 10/6/2017 4:35 PM, Tom Lendacky wrote:
> When SME memory encryption is active it will rely on SWIOTLB to handle
> DMA for devices that cannot support the addressing requirements of
> having the encryption mask set in the physical address.  The IOMMU
> currently disables SWIOTLB if it is not running in passthrough mode.
> This is not desired as non-PCI devices attempting DMA may fail. Update
> the code to check if SME is active and not disable SWIOTLB.
> 
> Signed-off-by: Tom Lendacky <thomas.lendacky-5C7GfCeVMHo@public.gmane.org>
> ---
>   drivers/iommu/amd_iommu.c |   10 ++++++----
>   1 file changed, 6 insertions(+), 4 deletions(-)
> 

Hi Joerg,

This is an SME bug fix.  Assuming this is acceptable, any chance it can be
pushed to the current 4.14 linux rc release tree?

Thanks,
Tom

> diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
> index 51f8215..822679a 100644
> --- a/drivers/iommu/amd_iommu.c
> +++ b/drivers/iommu/amd_iommu.c
> @@ -2773,14 +2773,16 @@ int __init amd_iommu_init_api(void)
>   
>   int __init amd_iommu_init_dma_ops(void)
>   {
> -	swiotlb        = iommu_pass_through ? 1 : 0;
> +	swiotlb        = (iommu_pass_through || sme_me_mask) ? 1 : 0;
>   	iommu_detected = 1;
>   
>   	/*
>   	 * In case we don't initialize SWIOTLB (actually the common case
> -	 * when AMD IOMMU is enabled), make sure there are global
> -	 * dma_ops set as a fall-back for devices not handled by this
> -	 * driver (for example non-PCI devices).
> +	 * when AMD IOMMU is enabled and SME is not active), make sure there
> +	 * are global dma_ops set as a fall-back for devices not handled by
> +	 * this driver (for example non-PCI devices). When SME is active,
> +	 * make sure that swiotlb variable remains set so the global dma_ops
> +	 * continue to be SWIOTLB.
>   	 */
>   	if (!swiotlb)
>   		dma_ops = &nommu_dma_ops;
> 

  parent reply	other threads:[~2017-10-06 21:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-06 21:35 [PATCH] iommu/amd: Do not disable SWIOTLB if SME is active Tom Lendacky
     [not found] ` <20171006213540.19038.84350.stgit-qCXWGYdRb2BnqfbPTmsdiZQ+2ll4COg0XqFh9Ls21Oc@public.gmane.org>
2017-10-06 21:39   ` Tom Lendacky [this message]
     [not found]     ` <800bd17c-475b-c5b2-c4d1-776c655f084a-5C7GfCeVMHo@public.gmane.org>
2017-10-10  9:58       ` Joerg Roedel
     [not found]         ` <20171010095814.ux7nrtsnylz573hh-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2017-10-10 15:00           ` Tom Lendacky
     [not found]             ` <3117832f-db8f-a0db-c825-f97e3e097b1b-5C7GfCeVMHo@public.gmane.org>
2017-10-10 17:50               ` Joerg Roedel
     [not found]                 ` <20171010175011.GB30803-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2017-10-10 19:24                   ` Tom Lendacky

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=800bd17c-475b-c5b2-c4d1-776c655f084a@amd.com \
    --to=thomas.lendacky-5c7gfcevmho@public.gmane.org \
    --cc=bp-l3A5Bk7waGM@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.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.