OSDN Git Service

Revert "iommu/amd_iommu: Use CONFIG_DMA_DIRECT_OPS=y and dma_direct_{alloc,free}()"
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 11 Jun 2018 19:22:12 +0000 (12:22 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 11 Jun 2018 19:22:12 +0000 (12:22 -0700)
commite16c4790de39dc861b749674c2a9319507f6f64f
treeff59a163d1640813e6f2fc461888aa4167c2c282
parentf7cca14bcec49989bcfe7cf2135ac719352d7022
Revert "iommu/amd_iommu: Use CONFIG_DMA_DIRECT_OPS=y and dma_direct_{alloc,free}()"

This reverts commit b468620f2a1dfdcfddfd6fa54367b8bcc1b51248.

It turns out that this broke drm on AMD platforms. Quoting Gabriel C:
 "I can confirm reverting b468620f2a1dfdcfddfd6fa54367b8bcc1b51248 fixes
  that issue for me.

  The GPU is working fine with SME enabled.

  Now with working GPU :) I can also confirm performance is back to
  normal without doing any other workarounds"

Christan König analyzed it partially:
 "As far as I analyzed it we now get an -ENOMEM from dma_alloc_attrs()
  in drivers/gpu/drm/ttm/ttm_page_alloc_dma.c when IOMMU is enabled"

and Christoph Hellwig responded:
 "I think the prime issue is that dma_direct_alloc respects the dma
  mask. Which we don't need if actually using the iommu. This would be
  mostly harmless exept for the the SEV bit high in the address that
  makes the checks fail.

  For now I'd say revert this commit for 4.17/4.18-rc and I'll look into
  addressing these issues properly"

Reported-and-bisected-by: Gabriel C <nix.or.die@gmail.com>
Acked-by: Christoph Hellwig <hch@lst.de>
Cc: Christian König <christian.koenig@amd.com>
Cc: Michel Dänzer <michel.daenzer@amd.com>
Cc: Joerg Roedel <jroedel@suse.de>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: stable@kernel.org # v4.17
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/iommu/Kconfig
drivers/iommu/amd_iommu.c