Linux IOMMU Development
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Mario Limonciello <mario.limonciello@amd.com>
Cc: Will Deacon <will@kernel.org>,
	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>,
	Robin Murphy <robin.murphy@arm.com>
Subject: Re: [PATCH 0/2] Fix issues with untrusted devices and AMD IOMMU
Date: Mon, 4 Apr 2022 09:54:37 -0700	[thread overview]
Message-ID: <YksizUJzRgEEdHLJ@infradead.org> (raw)
In-Reply-To: <20220404164707.1128-1-mario.limonciello@amd.com>

On Mon, Apr 04, 2022 at 11:47:05AM -0500, Mario Limonciello wrote:
> 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.

I think the proper thing is to do this:

diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index a1ada7bff44e6..079694f894b85 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -1838,17 +1838,10 @@ void amd_iommu_domain_update(struct protection_domain *domain)
 	amd_iommu_domain_flush_complete(domain);
 }
 
-static void __init amd_iommu_init_dma_ops(void)
-{
-	swiotlb = (iommu_default_passthrough() || sme_me_mask) ? 1 : 0;
-}
-
 int __init amd_iommu_init_api(void)
 {
 	int err;
 
-	amd_iommu_init_dma_ops();
-
 	err = bus_set_iommu(&pci_bus_type, &amd_iommu_ops);
 	if (err)
 		return err;
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  parent reply	other threads:[~2022-04-04 16:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-04 16:47 [PATCH 0/2] Fix issues with untrusted devices and AMD IOMMU Mario Limonciello via iommu
2022-04-04 16:47 ` [PATCH 1/2] swiotlb: Check that slabs have been allocated when requested Mario Limonciello via iommu
2022-04-04 16:47 ` [PATCH 2/2] iommu: Don't use swiotlb unless it's active Mario Limonciello via iommu
2022-04-04 16:54 ` Christoph Hellwig [this message]
2022-04-04 17:05   ` [PATCH 0/2] Fix issues with untrusted devices and AMD IOMMU Limonciello, Mario via iommu
2022-04-04 17:24     ` Christoph Hellwig

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=YksizUJzRgEEdHLJ@infradead.org \
    --to=hch@infradead.org \
    --cc=Vasant.Hegde@amd.com \
    --cc=iommu@lists.linux-foundation.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