public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joerg Roedel <joro@8bytes.org>
To: iommu@lists.linux-foundation.org
Cc: linux-kernel@vger.kernel.org, Joerg Roedel <jroedel@suse.de>
Subject: [PATCH 4/5] iommu/amd: Use swiotlb in passthrough mode
Date: Tue, 28 Jul 2015 16:58:50 +0200	[thread overview]
Message-ID: <1438095531-26777-5-git-send-email-joro@8bytes.org> (raw)
In-Reply-To: <1438095531-26777-1-git-send-email-joro@8bytes.org>

From: Joerg Roedel <jroedel@suse.de>

In passthrough mode (iommu=pt) all devices are identity
mapped. If a device does not support 64bit DMA it might
still need remapping. Make sure swiotlb is initialized to
provide this remapping.

Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
 drivers/iommu/amd_iommu.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 6d3dae9..e29baa6 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -2282,12 +2282,10 @@ static int amd_iommu_add_device(struct device *dev)
 
 	/* Domains are initialized for this device - have a look what we ended up with */
 	domain = iommu_get_domain_for_dev(dev);
-	if (domain->type == IOMMU_DOMAIN_IDENTITY) {
+	if (domain->type == IOMMU_DOMAIN_IDENTITY)
 		dev_data->passthrough = true;
-		dev->archdata.dma_ops = &nommu_dma_ops;
-	} else {
+	else
 		dev->archdata.dma_ops = &amd_iommu_dma_ops;
-	}
 
 out:
 	iommu_completion_wait(iommu);
@@ -2852,8 +2850,8 @@ int __init amd_iommu_init_api(void)
 
 int __init amd_iommu_init_dma_ops(void)
 {
+	swiotlb        = iommu_pass_through ? 1 : 0;
 	iommu_detected = 1;
-	swiotlb = 0;
 
 	amd_iommu_stats_init();
 
-- 
1.9.1


  parent reply	other threads:[~2015-07-28 14:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-28 14:58 [PATCH 0/5] AMD IOMMU Fixes for v4.2-rc4 Joerg Roedel
2015-07-28 14:58 ` [PATCH 1/5] iommu/amd: Use iommu_attach_group() Joerg Roedel
2015-07-28 14:58 ` [PATCH 2/5] iommu/amd: Use iommu core for passthrough mode Joerg Roedel
2015-07-28 14:58 ` [PATCH 3/5] iommu/amd: Allow non-IOMMUv2 devices in IOMMUv2 domains Joerg Roedel
2015-07-28 14:58 ` Joerg Roedel [this message]
2015-07-28 14:58 ` [PATCH 5/5] iommu/amd: Set global dma_ops if swiotlb is disabled Joerg Roedel
2015-07-30  9:13 ` [PATCH 0/5] AMD IOMMU Fixes for v4.2-rc4 Oded Gabbay
2015-07-30 10:12 ` Oded Gabbay

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=1438095531-26777-5-git-send-email-joro@8bytes.org \
    --to=joro@8bytes.org \
    --cc=iommu@lists.linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox