Skip to content

powerpc iommu mapping for SR-IOV device

Mamatha Inamdar requested to merge mainamdar/centos-stream-9:RHEL-17959 into main

Description: powerpc iommu mapping for SR-IOV device

JIRA: https://issues.redhat.com/browse/RHEL-17959

Build Info: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=57363604

Tested: Verified Brew build test kernel RPMs and confirmed issue is resovled

commit 3bf983e4e93ce8e6d69e9d63f52a66ec0856672e Author: Gaurav Batra gbatra@linux.vnet.ibm.com Date: Mon Oct 2 22:08:02 2023 -0500

powerpc/pseries/iommu: enable_ddw incorrectly returns direct mapping for SR-IOV device

When a device is initialized, the driver invokes dma_supported() twice -
first for streaming mappings followed by coherent mappings. For an
SR-IOV device, default window is deleted and DDW created. With vPMEM
enabled, TCE mappings are dynamically created for both vPMEM and SR-IOV
device.  There are no direct mappings.

First time when dma_supported() is called with 64 bit mask, DDW is created
and marked as dynamic window. The second time dma_supported() is called,
enable_ddw() finds existing window for the device and incorrectly returns
it as "direct mapping".

This only happens when size of DDW is big enough to map max LPAR memory.

This results in streaming TCEs to not get dynamically mapped, since code
incorrently assumes these are already pre-mapped. The adapter initially
comes up but goes down due to EEH.

Fixes: 381ceda88c4c ("powerpc/pseries/iommu: Make use of DDW for indirect mapping")
Cc: stable@vger.kernel.org # v5.15+
Signed-off-by: Gaurav Batra <gbatra@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20231003030802.47914-1-gbatra@linux.vnet.ibm.com

Signed-off-by: Mamatha Inamdar minamdar@redhat.com

Merge request reports