]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
powerpc/pseries/iommu: Fix window size for direct mapping with pmem
authorLeonardo Bras <leobras.c@gmail.com>
Tue, 20 Apr 2021 04:54:04 +0000 (01:54 -0300)
committerKelsey Skunberg <kelsey.skunberg@canonical.com>
Mon, 24 May 2021 23:46:41 +0000 (17:46 -0600)
commite7e31bb73781236298e4711bde7a66dd5f443737
tree14f7943e126d3a82eea531ccb25152ec3ca72bcf
parent047772ba6aa1d63f3561fb5bcd3f0efc13f936c6
powerpc/pseries/iommu: Fix window size for direct mapping with pmem

BugLink: https://bugs.launchpad.net/bugs/1929455
[ Upstream commit a9d2f9bb225fd2a764aef57738ab6c7f38d782ae ]

As of today, if the DDW is big enough to fit (1 << MAX_PHYSMEM_BITS)
it's possible to use direct DMA mapping even with pmem region.

But, if that happens, the window size (len) is set to (MAX_PHYSMEM_BITS
- page_shift) instead of MAX_PHYSMEM_BITS, causing a pagesize times
smaller DDW to be created, being insufficient for correct usage.

Fix this so the correct window size is used in this case.

Fixes: bf6e2d562bbc4 ("powerpc/dma: Fallback to dma_ops when persistent memory present")
Signed-off-by: Leonardo Bras <leobras.c@gmail.com>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210420045404.438735-1-leobras.c@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
arch/powerpc/platforms/pseries/iommu.c