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 5/5] iommu/amd: Set global dma_ops if swiotlb is disabled
Date: Tue, 28 Jul 2015 16:58:51 +0200 [thread overview]
Message-ID: <1438095531-26777-6-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>
Some AMD systems also have non-PCI devices which can do DMA.
Those can't be handled by the AMD IOMMU, as the hardware can
only handle PCI. These devices would end up with no dma_ops,
as neither the per-device nor the global dma_ops will get
set. SWIOTLB provides global dma_ops when it is active, so
make sure there are global dma_ops too when swiotlb is
disabled.
Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
drivers/iommu/amd_iommu.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index e29baa6..fa9508b 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -2853,6 +2853,15 @@ int __init amd_iommu_init_dma_ops(void)
swiotlb = iommu_pass_through ? 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).
+ */
+ if (!swiotlb)
+ dma_ops = &nommu_dma_ops;
+
amd_iommu_stats_init();
if (amd_iommu_unmap_flush)
--
1.9.1
next prev parent reply other threads:[~2015-07-28 15:01 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 ` [PATCH 4/5] iommu/amd: Use swiotlb in passthrough mode Joerg Roedel
2015-07-28 14:58 ` Joerg Roedel [this message]
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-6-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