# Re: \[PATCH v15 06/12\] swiotlb: Use is\_swiotlb\_force\_bounce for swiotlb data bouncing

- From: Christoph Hellwig \<hch@lst.de\>
- Date: 2021-07-06 04:49:00 
- List: linuxppc-dev
- Page: https://ratatoskr.run/linuxppc-dev/2021/07/1433610
- Thread: https://ratatoskr.run/linux-devicetree/2021/06/1425064/t.md

```text
On Mon, Jul 05, 2021 at 08:03:52PM +0100, Will Deacon wrote:
> So at this point, the AMD IOMMU driver does:
> 
> 	swiotlb        = (iommu_default_passthrough() || sme_me_mask) ? 1 : 0;
> 
> where 'swiotlb' is a global variable indicating whether or not swiotlb
> is in use. It's picked up a bit later on by pci_swiotlb_late_init(), which
> will call swiotlb_exit() if 'swiotlb' is false.
> 
> Now, that used to work fine, because swiotlb_exit() clears
> 'io_tlb_default_mem' to NULL, but now with the restricted DMA changes, I
> think that all the devices which have successfully probed beforehand will
> have stale pointers to the freed structure in their 'dev->dma_io_tlb_mem'
> field.

Yeah.  I don't think we can do that anymore, and I also think it is
a bad idea to start with.
```
