From: Mario Limonciello via iommu <iommu@lists.linux-foundation.org>
To: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>
Cc: Hegde Vasant <Vasant.Hegde@amd.com>,
open list <linux-kernel@vger.kernel.org>,
Christoph Hellwig <hch@infradead.org>,
"open list:IOMMU DRIVERS" <iommu@lists.linux-foundation.org>,
Mario Limonciello <mario.limonciello@amd.com>,
Robin Murphy <robin.murphy@arm.com>
Subject: [PATCH v2 0/2] Fix issues with untrusted devices and AMD IOMMU
Date: Mon, 4 Apr 2022 15:47:21 -0500 [thread overview]
Message-ID: <20220404204723.9767-1-mario.limonciello@amd.com> (raw)
It's been observed that plugging in a TBT3 NVME device to a port marked
with ExternalFacingPort that some DMA transactions occur that are not a
full page and so the DMA API attempts to use software bounce buffers
instead of relying upon the IOMMU translation.
This doesn't work and leads to messaging like:
swiotlb buffer is full (sz: 4096 bytes), total 0 (slots), used 0 (slots)
The bounce buffers were originally set up, but torn down during
the boot process.
* This happens because as part of IOMMU initialization
`amd_iommu_init_dma_ops` gets called and resets the global swiotlb to 0.
* When late_init gets called `pci_swiotlb_late_init` `swiotlb_exit` is
called and the buffers are torn down.
This can be observed in the logs:
```
[ 0.407286] AMD-Vi: Extended features (0x246577efa2254afa): PPR NX GT [5] IA GA PC GA_vAPIC
[ 0.407291] AMD-Vi: Interrupt remapping enabled
[ 0.407292] AMD-Vi: Virtual APIC enabled
[ 0.407872] software IO TLB: tearing down default memory pool
```
This series fixes the behavior of AMD IOMMU to enable swiotlb so that
non-page aligned DMA goes through a bounce buffer.
It also adds a message to help with debugging similar problems in the
future.
Mario Limonciello (2):
iommu/amd: Enable swiotlb in all cases
dma-iommu: Check that swiotlb is active before trying to use it
drivers/iommu/amd/iommu.c | 7 -------
drivers/iommu/dma-iommu.c | 5 +++++
2 files changed, 5 insertions(+), 7 deletions(-)
--
2.34.1
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
next reply other threads:[~2022-04-04 20:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-04 20:47 Mario Limonciello via iommu [this message]
2022-04-04 20:47 ` [PATCH v2 1/2] iommu/amd: Enable swiotlb in all cases Mario Limonciello via iommu
2022-04-05 4:34 ` Christoph Hellwig
2022-04-06 17:04 ` Limonciello, Mario via iommu
2022-04-07 7:58 ` Christoph Hellwig
2022-04-21 14:44 ` Limonciello, Mario via iommu
2022-04-07 13:31 ` Robin Murphy
2022-04-07 13:41 ` Christoph Hellwig
2022-04-04 20:47 ` [PATCH v2 2/2] dma-iommu: Check that swiotlb is active before trying to use it Mario Limonciello via iommu
2022-04-05 4:34 ` Christoph Hellwig
2022-04-07 13:07 ` Robin Murphy
2022-04-28 8:27 ` [PATCH v2 0/2] Fix issues with untrusted devices and AMD IOMMU 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=20220404204723.9767-1-mario.limonciello@amd.com \
--to=iommu@lists.linux-foundation.org \
--cc=Vasant.Hegde@amd.com \
--cc=hch@infradead.org \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=robin.murphy@arm.com \
--cc=will@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